2013年2月15日

NYOJ 56 阶乘因式分解(一)

摘要: 地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=56 1 #include<stdio.h> 2 int main() 3 { 4 int i,j,k,m,n,s; 5 scanf("%d",&s); 6 while(s--) 7 { 8 scanf("%d%d",&n,&m); 9 for(i=m,j=0;i<=n;i++)10 for(k=i;!(k%m);j++)11 k=k/m;12 printf("%d\n",j);1... 阅读全文

posted @ 2013-02-15 12:17 mycapple 阅读(1284) 评论(1) 推荐(0) 编辑

2012年12月15日

编程实现x的y次方的最后三位数(x与y至少是两位数以上)

摘要: Sample Input: 13**13(以两个**代表次方) 13**20Sample Output: 253 801 1 #include <stdio.h> 2 int main() 3 { 4 int x,y,i,h; 5 while(scanf("%d%d",&x,&y)!=-1) 6 { 7 8 x=x%1000; 9 for(h=1,i=0;i<y;i++)10 {11 12 h*=x;13 h%=1000;... 阅读全文

posted @ 2012-12-15 21:59 mycapple 阅读(851) 评论(1) 推荐(0) 编辑

三天打鱼两天晒网

摘要: 题目描述:中国有句俗语叫“三天打鱼两天晒网”。某人从1990年1月1日起开始“三天打鱼两天晒网”,问这个人在以后的某一天中是“打鱼”还是“晒网”。Sample Input: Enter year/month/day:1991 10 25 Enter year/month/day:1992 10 25 Enter year/month/day:2011 12 10Sample Output:He was fishing at day. He was sleeping at day. He was sleeping at day问题分析与算法设计根据题意可以将解题过程分为三步:1)计算... 阅读全文

posted @ 2012-12-15 21:10 mycapple 阅读(951) 评论(2) 推荐(2) 编辑

2012年11月24日

NYOJ 473 A^B Problem

摘要: 地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=473 1 #include <stdio.h> 2 int main() 3 { 4 int a,b; 5 int i; 6 while(scanf("%d%d",&a,&b)!=EOF) 7 { 8 if(b==0) 9 printf("1\n");10 else 11 {12 a%=10;13 b=b%4+4;14 int s=a;15 for(i=1;i<b;i++)16 ... 阅读全文

posted @ 2012-11-24 22:20 mycapple 阅读(358) 评论(0) 推荐(0) 编辑

NYOJ 604 小明的难题

摘要: 地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=604 1 #include <stdio.h> 2 int main() 3 { 4 char ch,str[101]; 5 int n,i; 6 scanf("%d",&n); 7 getchar(); 8 while(n--) 9 {10 gets(str);11 for(i = 0; str[i] != '\0'; i++)12 {13 if((i % 2 == 0... 阅读全文

posted @ 2012-11-24 22:16 mycapple 阅读(325) 评论(0) 推荐(0) 编辑

NYOJ 599 奋斗的小蜗牛

摘要: 地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=599 1 #include <stdio.h> 2 int main() 3 { 4 int n,H; 5 scanf("%d",&n); 6 while(n--) 7 { 8 scanf("%d",&H); 9 if(H<=10)10 printf("1\n");11 else if(H%5==0)12 printf("%d\n",(H-10)/5+1);13 else14 阅读全文

posted @ 2012-11-24 22:12 mycapple 阅读(434) 评论(0) 推荐(0) 编辑

NYOJ 596 谁是最好的Coder

摘要: 地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=596 1 #include<stdio.h> 2 int main() 3 { 4 int n,i,max,a,b; 5 while(scanf("%d",&n),n) 6 { 7 max=0; 8 for(i=0;i<n;i++) 9 {10 scanf("%d%d",&a,&b);11 if(a+b>max)12 max=a+b;13 }14 ... 阅读全文

posted @ 2012-11-24 22:09 mycapple 阅读(288) 评论(0) 推荐(0) 编辑

NYOJ 276 比较字母大小

摘要: 地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=276 1 #include<stdio.h> 2 int main() 3 { 4 char a,b; 5 int i; 6 scanf("%d",&i); 7 getchar(); 8 while(i--) 9 {10 scanf("%c",&a);11 getchar();12 scanf("%c",&b);13 if(a!=b)14 {15 ... 阅读全文

posted @ 2012-11-24 22:02 mycapple 阅读(505) 评论(0) 推荐(0) 编辑

NYOJ 148 fibonacci数列(二)

摘要: 地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=148 1 #include<stdio.h> 2 void fun(int a1[][2],int a2[][2]) 3 { 4 int c[2][2],i,j,k; 5 for(i=0;i<2;i++) 6 for(j=0;j<2;j++) 7 { 8 c[i][j]=0; 9 for(k=0;k<2;k++)10 c[i][j]=(c[i][j]+a1[i][k]*a2[k][j... 阅读全文

posted @ 2012-11-24 20:36 mycapple 阅读(318) 评论(0) 推荐(0) 编辑

2012年9月26日

Problem D. A very hard Aoshu problem (金华赛区 2012 09 22)

摘要: DescriptionAoshu is very popular among primary school students. It is mathematics, but much harder than ordinary mathematics for primary school students. Teacher Liu is an Aoshu teacher. He just comes out with a problem to test his students:Given a serial of digits, you must put a '=' and no 阅读全文

posted @ 2012-09-26 12:42 mycapple 阅读(519) 评论(0) 推荐(0) 编辑

导航