- 博客(31)
- 收藏
- 关注
原创 NYOJ199无线网路覆盖
#include#include#includeint main (void){ int t,i,l,d,r; double routernum,c; scanf("%d",&t); while(t--) { scanf("%d%d%d",&l,&d,&r);
2015-05-11 12:31:43 562
原创 NYOJ~1的个数
#include using namespace std;int main () { int N,m,tool; scanf("%d",&N); while (N--){ scanf("%d",&m); tool=0; while(m){ if (m&1){ m=m/2; tool++;} else m=m/2;
2014-11-04 22:11:15 347
原创 NYOJ另一种阶乘
#include int main (){ int a,shu,t,t1,sum,all; scanf("%d",&a); while (a--){ scanf("%d",&shu); all=0; for (t=1;t sum=1; for (t1=1;t1 if (t1==1||t1%2!=0) sum*=t1; } a
2014-11-04 21:29:12 373
原创 NYOJ数数
#include #include using namespace std;int main (){ int T,len,t,tool; int shu[2][11]={{48,49,50,51,52,53,54,55,56,57},{79,79,84,84,70,70,83,83,69,78}}; char c[10]; scanf ("%d",&T); ge
2014-11-04 21:03:35 329
原创 NYOJ素数
#include #include int main (){int a,b,e,f,k,t,x,y,g[100],h[100];scanf("%d",&a);while (a--){scanf ("%d",&b);t=0;for (e=1;ek=0;for (f=1;fif(e%f==0)k++;}if(k==2){t++;g[t-1
2014-10-24 22:23:14 333
原创 NYOJ数数小木块
#includeint main (){int a,b,d,e,sum;int c[1000];scanf ("%d",&a);while(a--){scanf("%d",&b);c[0]=1;sum=0;if(b>1){for (e=0;efor(d=1;dc[d]=d+1+c[d-1];}sum+=c[e];}printf("%d
2014-10-24 22:21:51 520
原创 NYOJ日期计算
#include int main (){int a,b,c,d,f,date;int e[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};scanf ("%d",&a);while (a>0){date=0;scanf("%d %d %d",&b,
2014-10-24 22:20:45 380
原创 NYOJ大小写互换
#include #include int main (){int a,c,d;char b[100];scanf ("%d",&a);getchar();while (a--){scanf("%s",&b);c=strlen(b);for (d=0;dif(b[d]>=65&&b[d]b[d]=b[d]+32;elseb[d]=b[d]-3
2014-10-24 22:17:59 358
原创 NYOJ比较字母大小
#include int main (){int a;char b,c;scanf ("%d",&a);getchar();while (a>0){scanf("%c %c",&b,&c);getchar();if (b==c)printf ("%c=%c\n",b,c);else if (b>c)printf("%celse printf(
2014-10-24 22:16:48 307
原创 NYOJ开灯问题
#include int main() {int a,c,d,e;scanf("%d%d",&a,&d);int b[a];for (e=0;eb[e]=0;}for (c=1;cfor (e=1;eif (e%c==0){b[e-1]++;}}}for (e=0;eif ((b[e]-1)%2==0){printf("%d ",
2014-10-24 22:15:50 333
原创 NYOJ-6174问题
#include int main (){int a,b[4],c,d,e,f,t;scanf("%d",&f);while (f>0){d=1;scanf ("%d",&a);b[3]=a%10;b[2]=a/10%10;b[1]=a/100%10;b[0]=a/1000;for (c=4;c>0;c--){for (e=2;e>=0;e--){
2014-10-24 22:07:54 284
原创 NYOJ小学生算数
#include int main (){int a,b,c,d[8],e,f;while (scanf("%d%d",&a,&b)!=EOF){if (b==0&&a==0)break;f=0;d[0]=a%10;d[1]=a/10%10;d[2]=a/100;d[3]=b%10;d[4]=b/10%10;d[5]=b/100;for(e=0
2014-10-19 01:25:13 277
原创 NYOJ阶乘因式分解
#include int main () {int a,b,c,e,f,g;scanf ("%d",&a);while(a>0){scanf("%d%d",&b,&c);e=0;for (f=c;f=c;f++){for (g=f;g%c==0&&g>=c;){g=g/c;e++;}}printf("%d\n",e);a--;}re
2014-10-19 01:22:55 325
原创 NYOJ鸡兔同笼
#include int main (){int a,b,c,e,f,k;scanf ("%d",&a);while (a>0&&ascanf ("%d %d",&b,&c);k=0;for(e=0;eif (2*e+4*(b-e)==c){printf("%d %d\n",e,b-e);k=1;}}if(k==0)printf ("No a
2014-10-19 01:22:51 279
原创 NYOJ6174问题
#include int main (){int a,b[4],c,d,e,f,t;scanf("%d",&f);while (f>0){d=1;scanf ("%d",&a);b[3]=a%10;b[2]=a/10%10;b[1]=a/100%10;b[0]=a/1000;for (c=4;c>0;c--){for (e=2;e>=0;e--){
2014-10-19 01:18:24 357
原创 NYOJ-A+BproblemIII
#include #include int main () {int T;float a,b,c;scanf ("%d",&T);while (T>0){scanf("%f%f%f",&a,&b,&c);if (fabs(a+b-c)printf("Yes\n");elseprintf ("No\n");T--;}return 0;}
2014-10-17 22:21:05 418
原创 NYOJ九九乘法表
#include int main () {int a,b,c,d; scanf ("%d",&a);while (a>0){scanf ("%d",&b);for (c=1;cfor(d=c;dprintf ("%d*%d=%d ",c,d,c*d);}printf("\n");}a--;}return 0;}
2014-10-17 18:00:43 371
原创 NYOJ素数求和
#include int main () { int a,b,d,e,f,sum; scanf ("%d",&a); while(a>0){ sum=0; scanf("%d",&b); int c[b]; for (d=0;d scanf("%d",&c[d]); } for (d=0;d
2014-10-17 17:31:48 422
原创 NYOJ-Fibonacii数
#include int main (){int a,b[40],c,d;scanf("%d",&a);while (a>0){scanf ("%d",&c);b[0]=1;b[1]=1;if (c>2){for (d=2;db[d]=b[d-1]+b[d-2];}printf("%d\n",b[c-1]);}elseprintf("%
2014-10-16 18:33:59 257
原创 NYOJ数乌龟
#include int main (){ int b,c[55],d; while( (scanf("%d",&b))!=EOF){ if (b==0) break; c[0]=1; c[1]=2; c[2]=3; if (b>3){ for(d=3;d c[d]=c[d-1]+c[d-3]; }printf("%d\n",
2014-10-16 18:14:58 400
原创 NYOJASCII码排序
#include#include int main(){int a,b;char d[3],t;scanf ("%d",&a);getchar();while (a>0){for (b=0;bscanf("%c",&d[b]);}getchar();for (b=2;b>=1;b--){if (d[b-1]>d[b]){t=d[b-1];
2014-10-16 16:56:26 405
原创 NYOJ字母小游戏
#include #include int main () {int a,c,d; char b[200];scanf ("%d",&a);getchar();for (a=a;a>0;a--){scanf("%s",&b);c=strlen(b);d=0;for (c=c;c>0;c--){if(b[c-1]>=97&&b[c-1]{
2014-10-13 18:40:13 416
原创 NYOJ正三角形外接圆面积
#include #include #define pi 3.1415926int main (void) {int a,c;double b,d;scanf("%d",&a);for (c=0;c{scanf("%lf",&b);d=sqrt(pow(b,2)-pow(b/2.0,2))*2.0/3.0;printf("%.2lf\n",pi*pow(
2014-10-13 18:34:45 524
原创 nyoj字符串逆序输出
#include#includeint main () { int a,b,c,e; char d1[40],d2[40]; scanf("%d",&a); getchar(); for(e=0;e { scanf ("%s %s",&d1,&d2); c=strlen(d2); for (c=c;c
2014-10-10 09:27:58 403
原创 HDOJ成绩转换
#include int main () { int a; while ((scanf ("%d",&a))!=EOF){ if (a>=0&&a printf ("E\n"); if (a>=60&&a printf ("D\n"); if (a>=70&&a printf ("C\n"); if (a
2014-10-07 10:19:03 242
原创 HDOJ计算球体积
#include #define PI 3.1415927int main () { double r,V; while ((scanf("%lf",&r))!=EOF){ V=4.0/3.0*PI*r*r*r; printf("%0.3lf\n",V); } return 0;}
2014-10-07 09:52:54 412
原创 HDOJ求绝对值
#include int main () { double a; while ((scanf("%lf",&a))!=EOF) { if ( a > 0 ) printf ("%.2lf\n",a); else printf ("%0.2lf\n",-1*a); }return
2014-10-07 09:51:47 324
原创 NYOJ奇偶数分离
#includeint main () {int a,b,j,o;scanf ("%d",&a);b=a;int c[b];while (b>0) {scanf ( "%d",&c[b] );b = b - 1;}b=a;while ( b > 0){for ( j = 1 ; j {printf ( "%d ",j );}
2014-10-07 01:17:58 430
原创 NYOJ茵茵的第一课
#include#includeint main() { int a; scanf("%d",&a); char b[a]; while(a>0){ scanf("%s",&b[a]); printf("%s\n",&b[a]); a=--a;}return 0;}
2014-10-06 12:28:47 572
原创 NYOJ从小到大排列三个数
#includeint main () { int a , b , c , d; scanf ("%d%d%d",&a,&b,&c); if ( a > b ) { d = a; a = b; b = d; } if ( a > c ) { d = a; a = c; c= d; } if ( b > c) { d = b; b = c; c =
2014-10-06 01:23:17 330
原创 NYOJ 39水仙花数
#includeint main () {int a,b,c,d;while ( scanf("%d",&a)) {b = a%10;c = a%100/10;d = a/100;if (a==0){break;} else {if ((b*b*b+c*c*c+d*d*d)==a)printf ("Yes\n");elseprintf (
2014-10-05 19:51:36 448
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人