为什么全WA,大佬求助

P1598 垂直柱状图

充分发扬了人类智慧![](//图.tk/a)
by lingfunny @ 2022-05-11 14:29:16


@[lingfunny](/user/280800) 我也就只能这样暴力了哈哈哈哈
by no2lxs @ 2022-05-12 09:38:09


emmm我也是个蒟蒻,但是貌似不用这样 ~~虽然也是暴力~~ 代码: ``` #include<cstdio> #include<iostream> using namespace std; int main(){ int a[26]={0}; string str1,str2,str3,str4; getline(cin,str1); getline(cin,str2); getline(cin,str3); getline(cin,str4); for(int i=0;i<str1.size();i++){ if(isupper(str1[i])){ a[str1[i]-65]++; } } for(int i=0;i<str2.size();i++){ if(isupper(str2[i])){ a[str2[i]-65]++; } } for(int i=0;i<str3.size();i++){ if(isupper(str3[i])){ a[str3[i]-65]++; } } for(int i=0;i<str4.size();i++){ if(isupper(str4[i])){ a[str4[i]-65]++; } } // for(int i=0;i<26;i++){ // cout<<a[i]<<' '; // } int f=0,z=0; for(int i=0;i<26;i++){ if(a[i]>f){ f=a[i]; z=i; } } // cout<<f; for(int i=f;i>0;i--){ for(int j=0;j<26;j++){ if(i<=a[j]){ printf("* "); }else{ printf(" "); } } printf("\n"); } for(int i=0;i<26;i++){ printf("%c ",i+'A'); } } //注释是我写的时候测试用的 ```
by Happy_WA_Day @ 2022-06-03 14:01:52


说实话这真的是我写过zui~~暴力~~文雅的代码
by Happy_WA_Day @ 2022-06-03 14:04:41


@[xuehaochen](/user/592463) orz
by no2lxs @ 2022-07-05 15:13:48


|