社区讨论
为什么自己的编译器能编译,洛谷编译失败
P1598[USACO03FEB] 垂直柱状图 Vertical Histogram参与者 5已保存回复 11
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 11 条
- 当前快照
- 1 份
- 快照标识符
- @lpt9xiwk
- 此快照首次捕获于
- 2023/12/06 12:33 2 年前
- 此快照最后确认于
- 2023/12/06 17:08 2 年前
CPP
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[26] = {0},max,len;
char z[400];
for(int i = 0;i < 4;i++){
gets(z);
len = strlen(z);
for(int i = 0;i < len;i++){
if(z[i] >= 'A'&&z[i] <= 'Z'){
a[z[i]-'A']++;
}
}
}
for(int i = 0; i < 26;i++) max = max > a[i]?max:a[i];
for(int i = max;i > 0;i--){
for(int j = 0;j < 26;j++){
if(a[j] >= i) cout<<"* ";
else cout<<" ";
}
cout<<endl;
}
cout<<"A B C D E F G H I G K L M N O P Q R S T U V W X Y Z"<<endl;
return 0;
}
回复
共 11 条回复,欢迎继续交流。
正在加载回复...