cjweffort

博客园 首页 联系 订阅 管理
上一页 1 ··· 5 6 7 8 9 10 11 12 13 14 下一页

2013年3月6日

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=59题目描述:实现一个加法器,使其能够输出a+b的值。输入:输入包括两个数a和b,其中a和b的位数不超过1000位。输出:可能有多组测试数据,对于每组数据,输出a+b的值。样例输入:2 6 10000000000000000000 10000000000000000000000000000000样例输出:8 10000000000010000000000000000000// 题目60:a+b.cpp: 主项目文件。 #include "stdafx.h" #include # 阅读全文
posted @ 2013-03-06 11:40 cjweffort 阅读(170) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=58题目描述:A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。输入:数据的第一行是一个T,表示有T组数据。每组数据的第一行有n(2 #include const int N=12; int n; struct Matrix { int arr[N][N]; }; /*Matrix init(Matrix mat) { Matrix res; for(int i=1;i>1); Matrix res=multiply(tmp1,tmp1); ... 阅读全文
posted @ 2013-03-06 11:39 cjweffort 阅读(143) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=57题目描述:Xinlv wrote some sequences on the paper a long time ago, they might be arithmetic or geometric sequences. The numbers are not very clear now, and only the first three numbers of each sequence are recognizable. Xinlv wants to know some numbers i 阅读全文
posted @ 2013-03-06 11:39 cjweffort 阅读(135) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=56题目描述:求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”输入:输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1 int pow(int a,int n) { if(n==1) return a; int res=1; if(n&0x01) res=a%1000; int tmp=pow(a,n>>1); res=(res*((tmp*tmp)%1000))%1000; return res; } int main(array ^arg 阅读全文
posted @ 2013-03-06 11:36 cjweffort 阅读(160) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=55题目描述:输入n个整数,依次输出每个数的约数的个数输入:输入的第一行为N,即数组的个数(N #include #include const int N=31650; bool prime[N]; void selectPrime() { memset(prime,0,sizeof(prime)); prime[0]=prime[1]=true; for(int i=2;i<N;i++) { if(!prime[i]) { for(int j=i+i;j<N;j+=i) ... 阅读全文
posted @ 2013-03-06 11:35 cjweffort 阅读(232) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=54题目描述:给定n,a求最大的k,使n!可以被a^k整除但不能被a^(k+1)整除。输入:两个整数n(2 #include #include const int N=1001; bool prime[N]; int base_n[N]; int base_a[N]; void selectPrime() { memset(prime,0,sizeof(prime)); prime[0]=prime[1]=true; for(int i=2;i<N;i++) { if(!prime[i... 阅读全文
posted @ 2013-03-06 11:34 cjweffort 阅读(165) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=53题目描述:求正整数N(N>1)的质因数的个数。相同的质因数需要重复计算。如120=2*2*2*3*5,共有5个质因数。输入:可能有多组测试数据,每组测试数据的输入是一个正整数N,(1 #include const int N=31650; bool used[N]; void selectPrime() { memset(used,0,sizeof(used)); used[0]=used[1]=true; for(int i=2;i<N;i++) { if(!used[i]) . 阅读全文
posted @ 2013-03-06 11:33 cjweffort 阅读(275) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=52题目描述:Goldbach's Conjecture: For any even number n greater than or equal to 4, there exists at least one pair of prime numbers p1 and p2 such that n = p1 + p2.This conjecture has not been proved nor refused yet. No one is sure whether this conjec 阅读全文
posted @ 2013-03-06 11:32 cjweffort 阅读(153) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=51题目描述:Output the k-th prime number.输入:k≤10000// 题目52:Prime Number.cpp: 主项目文件。 #include "stdafx.h" #include #include const int N=104733; bool used[N]; const int M=10003; int prime[M]; int selectePrime(int n) { memset(used,0,sizeof(used)); in 阅读全文
posted @ 2013-03-06 11:31 cjweffort 阅读(163) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=50题目描述:输入一个整数n(2 #include bool isPrime(int n) { if(n<=1) return false; int tt=(int)sqrt(1.0*n); for(int i=2;i<=tt;i++) if(n%i==0) return false; return true; } int main() { int n; while(scanf("%d",&n)!=EOF) { bool flag=true; for(int 阅读全文
posted @ 2013-03-06 11:30 cjweffort 阅读(182) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9 10 11 12 13 14 下一页