
ACM
成立不成立自己知道
嘿嘿
展开
-
求任何一年到2013.5.12的天数
求任何一年到2013.5.12的天数#include using namespace std;int tianshu(int y,int m,int d){int sum=0;int a[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};int b[13]={0,31,28,31,30,31,30,31,31,30,31,30,原创 2013-06-13 13:05:18 · 546 阅读 · 0 评论 -
罗马数字求解
#include #include int main(){int n,i,s,k,sum;char a[3000];while(scanf("%s",a)!=EOF){n=strlen(a);sum=0;k=1000;for(i=0;i{switch(a[i]){case 'M':s=1000;break;case 'D':s=500原创 2013-06-07 20:56:08 · 651 阅读 · 0 评论 -
密码学家亘古教授,破解了居民身份证号的密码,他可以分辨出身份证号的真假,还能猜出你身份证最后一位数字。下面是亘古教授计算身份证号末位的办法
#include int main(){int s,sec[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};int i,j,id[17];char a[18],b[11]={'1','0','X','9','8','7','6','5','4','3','2'};while(scanf("%s",a)!=EOF){s=0;fo原创 2013-06-07 20:45:55 · 1649 阅读 · 2 评论 -
C语言 打印*号金字塔~~~
#include int main(){ int n,i,x,y; while(scanf("%d",&n)!=EOF) { for(i=1;i { for(x=1;x printf(" "); for(y=n-i+1;yn-i;y++) printf("*"); printf("\n"); } } retu原创 2013-07-15 21:53:01 · 6449 阅读 · 1 评论 -
~筛选法求素数~欧耶\(^o^)/...
/*-----------筛选法求1-n内的素数的个数,并输出,n最大1000000---------*/#include #include using namespace std;int main(){ int n; bool a[1000000+1]; int i,j,k,num; while(cin >> n) { num=0; for(i原创 2013-07-18 14:38:38 · 683 阅读 · 0 评论 -
硬币拆分问题。
#include using namespace std;int main(){ int x,y,z; while(cin >> x >> y >> z) { if(x==0 && y==0 && z==0) break; if(x==0) cout else if(x+2*y>3) { cout } else原创 2013-07-27 16:09:33 · 3119 阅读 · 0 评论 -
RSA加密解密算法
Problem DescriptionRSA is one of the most powerful methods to encrypt data. The RSA algorithm is described as follow:> choose two large prime integer p, q> calculate n = p × q, calculate F(n)原创 2013-07-27 16:30:44 · 804 阅读 · 0 评论