为什么0分?????

P1598 垂直柱状图

本人也是个蒟蒻。初步判断你的代码输入好像有问题。
by hexuchen @ 2023-07-09 15:20:56


你的输入没有停止啊
by hexuchen @ 2023-07-09 15:21:47


你看你的代码,用while循环不断输入,但没有停止,他输入永远不会停止,当然WA了
by hexuchen @ 2023-07-09 15:22:51


备注:数组在main内部写 ```cpp int a[26]={0}; ``` 只会把数组第1个元素赋值,不会赋值全部的。 你可以把数组写在main函数外面,或者用 ```cpp memst(a,0,sizeof a); ``` 这样写。
by hexuchen @ 2023-07-09 15:24:58


@[hexuchen](/user/945742) 此代码自测通过,与样例**肉眼看**无区别
by TT20100707 @ 2023-07-10 14:03:54


max可以当变量咩?
by Zlfxxhrhsalal6 @ 2023-07-15 11:56:16


为什么不行???
by TT20100707 @ 2023-07-22 15:14:14


本人也是个蒟蒻,但是真心劝你改改输入,在测测(逃
by iranai @ 2023-07-23 11:54:03


这样就能ac了 ```c #include<bits/stdc++.h> using namespace std; int c[30]; string s[11]; int ma=-0x3f3f3f3f; int main() { for(int i=1; i<=4; i++) getline(cin,s[i]); for(int j=1; j<=4; j++) { for(int l=0; l<s[j].size(); l++) { if(s[j][l]=='A') { c[1]++; } else if(s[j][l]=='B') { c[2]++; } else if(s[j][l]=='C') { c[3]++; } else if(s[j][l]=='D') { c[4]++; } else if(s[j][l]=='E') { c[5]++; } else if(s[j][l]=='F') { c[6]++; } else if(s[j][l]=='G') { c[7]++; } else if(s[j][l]=='H') { c[8]++; } else if(s[j][l]=='I') { c[9]++; } else if(s[j][l]=='J') { c[10]++; } else if(s[j][l]=='K') { c[11]++; } else if(s[j][l]=='L') { c[12]++; } else if(s[j][l]=='M') { c[13]++; } else if(s[j][l]=='N') { c[14]++; } else if(s[j][l]=='O') { c[15]++; } else if(s[j][l]=='P') { c[16]++; } else if(s[j][l]=='Q') { c[17]++; } else if(s[j][l]=='R') { c[18]++; } else if(s[j][l]=='S') { c[19]++; } else if(s[j][l]=='T') { c[20]++; } else if(s[j][l]=='U') { c[21]++; } else if(s[j][l]=='V') { c[22]++; } else if(s[j][l]=='W') { c[23]++; } else if(s[j][l]=='X') { c[24]++; } else if(s[j][l]=='Y') { c[25]++; } else if(s[j][l]=='Z') { c[26]++; } } } for(int i=1; i<=26; i++) if(c[i]>ma) ma=c[i] ; int mi=ma; for(int i=1; i<=mi; i++) { for(int j=1; j<=26; j++) { if(c[j]<ma) { if(j==26) { cout<<" "<<endl; ma--; } else { cout<<" "; } } else if(c[j]>=ma) { if(j==26) { cout<<"*"<<endl; ma--; } else { cout<<"* "; } } } if(i==mi) { cout<<"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; } } return 0; } ```
by iranai @ 2023-07-23 11:58:00


@[TT20100707](/user/794388) while循环没有break无法停止,你这个输入无法停止,就会wa,我拿你代码用样例测了,输入听不了,建议可以用for循环,这个题目数据是确定了的
by iranai @ 2023-07-23 12:00:05


| 下一页