编译成功
foo.cpp: In function 'int main()':
foo.cpp:13:45: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[21]' [-Wformat=]
scanf("%s%d%d",&name,&ave1,&ave2);
^
foo.cpp:15:36: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[2]' [-Wformat=]
scanf("%s%s%d",&c,&d,&e);
^
foo.cpp:15:36: warning: format '%s' expects argument of type 'char*', but argument 3 has type 'char (*)[2]' [-Wformat=]
测试数据 #0: Accepted, time = 0 ms, mem = 732 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 732 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 728 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 728 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 728 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 728 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 728 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 728 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 728 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 728 KiB, score = 10
Accepted, time = 0 ms, mem = 732 KiB, score = 100
/*此题我也是有点纳闷,后来看别人的题解,要用到strcmp函数会过,或者直接暴力枚举就会过*/
1 #include <bits/stdc++.h>
2 using namespace std;
3 int main()
4 {
5 int n,ave1,ave2,e,ch[101];
6 char name[21],maxname[21],c[2],d[2];
7 memset(ch,0,sizeof(ch)); //数组要清零
8 while(scanf("%d",&n)!=EOF)
9 {
10 int max=0,count=0;
11 for(int i=0;i<n;i++)
12 {
13 scanf("%s%d%d",&name,&ave1,&ave2);
14 getchar();
15 scanf("%s%s%d",&c,&d,&e);
16 if(ave1>80&&e>=1)ch[i]+=8000;
17 if(ave1>85&&ave2>80)ch[i]+=4000;
18 if(ave1>90)ch[i]+=2000;
19 if(ave1>85&&strcmp(d,"Y")==0)ch[i]+=1000;//比较的是ASCII码表上的值,其实是若两个字符不相同,那就返回0,说明命题为真!
20 if(ave2>80&&strcmp(c,"Y")==0)ch[i]+=850;//这里也是一个意思
21 count+=ch[i];
22 if(ch[i]>max)
23 {
24 max=ch[i];
25 strcpy(maxname,name);
26 }
27 }
28 printf("%s\n%d\n%d\n",maxname,max,count);
29 }
30 return 0;
31 }