UVA - 524 Prime Ring ProblemTime Limit:3000MSMemory Limit:0KB64bit IO Format:%lld & %lluDescriptionA ring is composed of n (even number) circ...
分类:
其他好文 时间:
2015-07-27 20:42:14
阅读次数:
150
两个暴力题。。
题目传送:11827 Maximum GCD
AC代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define LL l...
分类:
其他好文 时间:
2015-07-27 16:24:02
阅读次数:
66
参数返回值解析:参数:m:int,需要判断的值;返回值:0:非素数 1:素数函数解析:注意:函数没有对输入进行判断,请自己屏蔽非法输入 1 int prime(int m) 2 { 3 int temp=(m+1)/2+1; 4 int i=2; 5 while(i<temp...
分类:
移动开发 时间:
2015-07-27 11:04:58
阅读次数:
137
Again Prime? No time.The problem statement is very easy. Given a number n you have to determine the largest power of m,not necessarily prime...
分类:
其他好文 时间:
2015-07-27 10:40:18
阅读次数:
92
Ugly NumbersTime Limit:1000MSMemory Limit:10000KTotal Submissions:20294Accepted:9018DescriptionUgly numbers are numbers whose only prime factors are 2...
分类:
其他好文 时间:
2015-07-27 10:37:39
阅读次数:
99
Count Primes
Description:
Count the number of prime numbers less than a non-negative number, n.
题目 Count Primes
计算小于n的所有素数的总数。
用一般的方法超时,应该用筛选法求素数 ,参考 筛选法求素数
class Solution {
publ...
分类:
其他好文 时间:
2015-07-26 21:01:15
阅读次数:
164
给你一个数n,请问n以内有多少个素数?(n 6 #include 7 using namespace std; 8 const int SIZE = 1e7; 9 10 int prime[SIZE]; // 第i个素数11 bool is_prime[SIZE]; ...
分类:
其他好文 时间:
2015-07-26 20:51:21
阅读次数:
301
第一次无指导写的回溯。感觉也不难,小紫书上说“学习回溯短则数天,长则数月或一年以上”, 但我没用一小时就懂了回溯,不知道是真懂还是假懂。这道题很简单。细心就好。代码如下:#include #include #include #include using namespace std;int n, an...
分类:
其他好文 时间:
2015-07-26 18:53:50
阅读次数:
118
题目如下:
Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…*pm^km.
Input Specification:
Each input file contai...
分类:
其他好文 时间:
2015-07-26 14:18:45
阅读次数:
124
Prime PathTime Limit:1000MSMemory Limit:65536KTotal Submissions:13813Accepted:7796DescriptionThe ministers of the cabinet were quite upset by the mess...
分类:
其他好文 时间:
2015-07-24 22:30:38
阅读次数:
120