- 博客(37)
- 收藏
- 关注
原创 空心三角形
c!='@' 要这样子写,不能写成c!=@scanf("%c\n",&c) 写成这样 或者后面加getchar吸收回车这道格式真的是日了够了,好气,烦的我要死。 pe了好多次。。。。。。。#includeint main(){ char c; int n; int m=0; while(scanf("%c",&c)!=EOF
2017-04-22 00:03:32
316
原创 数列有序!
数列有序!#include#define N 150int main(){ int n,m,flag; int a[N]; while(scanf("%d%d",&n,&m)!=EOF&&n&&m) { for(int i=0;i scanf("%d",&a[i]); for(int i=0;i { if(a
2017-04-21 20:59:24
268
原创 海选女主角
海选女主角我真的。。。。居然忘记了fabs(a[i][j])>fabs(max)要写两个绝对值函数啊啊啊啊#include#include#define N 100int main(){ int a[N][N]; int n,m; int max,maxi,maxj; while(scanf("
2017-04-21 20:58:42
244
原创 数据的交换输出
数据的交换输出#include#define N 100int main(){ int n; int a[N]; while(scanf("%d",&n)!=EOF&&n) { for(int i=0;i { scanf("%d",&a[i]); } int min=a[0];
2017-04-04 12:22:51
352
原创 绝对值排序
忘记排序算法了,原本想写冒泡法,结果忘记了,然后看到题解你有简单排序法,就看了下自己写出来了。。。。。。菜鸡一只。。。。#include#define N 10000#includeint main(){ int n; int a[N]; int max,temp; while(scanf("%d",&n)!=EOF&&n)
2017-03-25 17:27:16
280
原创 偶数求和
我好渣,,,,不会做,,看了题解,,自己才写出来的#include#define N 10000int main(){ int m,n; int a[N]; while(scanf("%d %d",&n,&m)!=EOF) { a[0]=2; int sum=0,count=0,flag=0;
2017-03-25 16:50:53
1254
原创 青年歌手大奖赛_评委会打分
#include#define N 10000int main(){ int n; int a[N]; double result; while(scanf("%d",&n)!=EOF) { for(int i=0;i { scanf("%d",&a[i]); } int max,min; min=max=a[0]; re
2017-03-25 15:59:32
325
原创 蟠桃记
#includeint main(){ int n,x; while(scanf("%d",&n)!=EOF) { x=1; for(int i=n;i>1;i--) { x=(x+1)*2; } printf("%d\n",x); } return 0;}
2017-03-25 15:36:59
270
原创 算菜价
#includeint main(){ char c; double a,b,sum=0; while(scanf("%s %lf %lf",&c,&a,&b)!=EOF) { sum+=a*b; } printf("%.1lf\n",sum); return 0;}
2017-03-25 15:21:54
420
原创 发工资咯:)
感觉自己的算法好渣,强行过了测试。。。最蠢的办法。。。。。#include #define N 10000int main(){ int n,i; int sum; int a[N]; int b,c,d,e,f,g; while(scanf("%d",&n)!=EOF&&n) { sum=0; i
2017-03-25 15:18:44
233
原创 素数判定
神他妈坑啊,刚刚开始的时候没注意到x和y的顺序问题,改了之后,还是错,然后看了半天才知道原来是flag赋初值赋在了while循环外面,结果gg,把flag改到while循环里就好了。#includeint main(){ int x,y,i,j,f,flag,temp; while(scanf("%d%d",&x,
2017-03-25 15:16:28
323
原创 多项式求和
#includeint main(){ int m,n,i; double sum; while(scanf("%d",&m)!=EOF) { while(m--) { sum=0; scanf("%d",&n); for(i=1;i { if(i%2!=0) sum=sum+1.0/i; else sum=s
2017-03-25 14:43:11
227
原创 水仙花数
#includeint main(){ int m,n,sum,a,b,c,i,flag; while(scanf("%d%d",&m,&n)!=EOF) { flag=0; for(i=m;i { sum=0; a=i/100; b=i/10-a*10; c=i-a*100-b*10; sum=a*a*a+b*b*b+
2017-03-25 14:42:02
161
原创 母牛的故事
#includeint main(){ int n,i; int a[55]; while(scanf("%d",&n)!=EOF&&n) { a[1]=1; a[2]=2; a[3]=3; for(i=4;i { a[i]=a[i-3]+a[i-1]; } printf("%d\n",a[n]); } return
2017-03-18 00:59:14
164
原创 最小公倍数
最小公倍数#includeint main(){int a,b,r,t,min,max;while(scanf("%d%d",&a,&b)!=EOF){min=a*b;if(a>b){t=a;a=b;b=t;}while(a){r=b%a;b=a;a=r;}printf("%d\n",min/b);}retur
2017-03-18 00:58:09
247
原创 A+B for Input-Output Practice (V)
A+B for Input-Output Practice (V)#includeint main(){int T,M,sum,a;scanf("%d",&T);while(T--){sum=0;scanf("%d",&M);while(M--){scanf("%d",&a);sum+=a;}printf("%d\n",sum);
2017-03-18 00:57:37
167
原创 A+B for Input-Output Practice (IV)
A+B for Input-Output Practice (IV)#includeint main(){int T,sum,a;while(scanf("%d",&T)!=EOF){sum=0;if(T==0) break;while(T--){scanf("%d",&a);sum+=a;}printf("%d\n",sum);}r
2017-03-13 00:11:49
264
原创 A+B for Input-Output Practice (III)
A+B for Input-Output Practice (III)#includeint main(){int a,b;while(scanf("%d%d",&a,&b)!=EOF){if(a==0&&b==0) break;printf("%d\n",a+b);}return 0;}
2017-03-13 00:11:12
165
原创 A+B for Input-Output Practice (II)
A+B for Input-Output Practice (II)#includeint main(){int T,a,b;scanf("%d",&T);while(T--){scanf("%d%d",&a,&b);printf("%d\n",a+b);}return 0;}
2017-03-13 00:10:34
171
原创 Sum Problem
Sum Problem#includemain(){long i,sum,n;while(scanf("%ld",&n)!=EOF){sum=0;for(i=1;i{sum+=i;}printf("%ld\n",sum);printf("\n");}}
2017-03-13 00:09:58
157
原创 A+B for Input-Output Practice (I)
A+B for Input-Output Practice (I)#includeint main(){int a,b;while(scanf("%d%d",&a,&b)!=EOF){printf("%d\n",a+b);}return 0;}
2017-03-13 00:09:11
177
原创 成绩转换
成绩转换#includeint main(){int t;while(scanf("%d",&t)!=EOF){if(t>=90&&tif(t>=80&&tif(t>=70&&tif(t>=60&&tif(t>=0&&tif(t100) printf("Score is error!\n");}return 0;}
2017-03-13 00:08:34
316
原创 第几天?
第几天?#includeint main(){int year,month,day,days,i;int months[12]={0,31,28,31,30,31,30,31,31,30,31,30};while(scanf("%d/%d/%d",&year,&month,&day)!=EOF){days=0;for(i=0;idays+=months[i]
2017-03-13 00:08:02
232
原创 计算两点间的距离
计算两点间的距离#include#includeint main(){double x1,x2,y1,y2,d;while(scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2)!=EOF){d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));printf("%.2lf\n",d);}return 0
2017-03-13 00:07:34
660
原创 计算球体积
计算球体积#include#define PI 3.1415927int main(){double s,r;while(scanf("%lf",&r)!=EOF){s=4.0/3*PI*r*r*r;printf("%.3lf\n",s);}return 0;}
2017-03-13 00:07:06
522
原创 平方和与立方和
平方和与立方和#includeint main(){int m,n,i,sum1,sum2,t;while(scanf("%d %d",&m,&n)!=EOF){if(m>n){t=m;m=n;n=t;}sum1=0;sum2=0;for(i=m;i{if(i%2!=0) sum1=sum1+i*i*i;if(i%2==0)
2017-03-13 00:06:37
206
原创 求绝对值
求绝对值#includeint main(){double a;while(scanf("%lf",&a)!=EOF){if(a{a=-a;}printf("%.2lf\n",a);}return 0; }
2017-03-13 00:06:07
305
原创 求奇数的乘积
求奇数的乘积#include#define N 10000int main(){int n,sum,i;int a[N];while(scanf("%d",&n)!=EOF){sum=1;for(i=0;i{scanf("%d",&a[i]);if(a[i]%2!=0) sum=sum*a[i];}printf("%d\n",sum);
2017-03-13 00:05:28
694
原创 数值统计
数值统计#include#define N 10000int main(){int n,i,fu,zheng,ling;double a[N];while(scanf("%d",&n)!=EOF){if(n==0) return 0;else{fu=0;zheng=0;ling=0;for(i=0;i{scanf("%lf",
2017-03-13 00:04:56
160
原创 字符串统计
字符串统计#include#define N 10000int main(){int T,i,num;char a[N];scanf("%d",&T);while(T--){scanf("%s",a);i=0;num=0;while(a[i]!='\0'){if(a[i]>='0'&&a[i]i++;}printf("%d\n
2017-03-13 00:04:26
199
原创 1056这道题不能做
1056这道题不能做#include#define N 100int main(){int t,n,max,i,max1;int a[N];scanf("%d",&t);while(t--){scanf("%d",&n);for(i=0;i{scanf("%d",&a[i]);}max=a[0];max1=0;for(i=0;i
2017-03-13 00:03:37
203
原创 1134求最大值
1134求最大值#includeint main(){float a,b,c,max;int i;while(scanf("%f%f%f",&a,&b,&c)!=EOF){max=a;if(b>max) max=b;if(c>max) max=c;printf("%.1f\n",max);}return 0; }
2017-03-13 00:03:02
134
原创 1135降序排序
1135降序排序#includeint main(){double a[6],temp;int n,i,j,k;scanf("%d",&n);while(n--){for(i=1;iscanf("%lf",&a[i]);for(i=1;i{k=i;for(j=i+1;jif(a[j]>a[k]) k=j;if(i!=k) {t
2017-03-13 00:02:32
248
原创 A+B for Input-Output Practice (II)
A+B for Input-Output Practice (II)#includevoid main(){int T,i=0;long long sum,a,b;scanf("%d",&T);while(T--){sum=0;scanf("%lld%lld",&a,&b);sum=a+b;i++;printf("Case %d:\n",i);
2017-03-13 00:01:21
174
原创 A + B Problem
A + B Problem#includeint main(){int a,b;while(scanf("%d%d",&a,&b)!=EOF){printf("%d\n",a+b);}return 0;}
2017-03-13 00:00:50
128
原创 A+B for Input-Output Practice (IV)
A+B for Input-Output Practice (IV)#includeint main(){int T,a,sum;while(scanf("%d",&T)!=EOF){sum=0;while(T--){scanf("%d",&a);sum+=a;}printf("%d\n",sum);}return 0;}
2017-03-13 00:00:15
273
原创 ASCII码排序
ASCII码排序#includeint main(){char a,b,c,t;while(scanf("%c%c%c",&a,&b,&c)!=EOF){getchar();if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(b>c){t=b;b=c;c=t;}
2017-03-12 23:49:53
233
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人