problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
luogu::P1598类 参考

洛谷 P1598 垂直柱状图 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P1598 垂直柱状图

在文件 luogu.h585 行定义.

成员函数说明

◆ main()

int luogu::P1598::main ( istream &  cin,
ostream &  cout 
)
static

在文件 luogu.cpp2231 行定义.

2231 {
2232 char ch;
2233 int count[26] = {};
2234 int maximum = 0;
2235 while(cin >> ch) {
2236 if(isupper(ch) != 0) {
2237 count[ch - 'A']++;
2238 maximum = max(maximum, count[ch - 'A']);
2239 }
2240 }
2241 for(int i = maximum; i > 0; i--) {
2242 for(int j = 0; j < 26; j++) {
2243 if(count[j] >= i) {
2244 cout << '*';
2245 } else {
2246 cout << ' ';
2247 }
2248 cout << ' ';
2249 }
2250 cout << endl;
2251 }
2252 for(char ch = 'A'; ch <= 'Z'; ch++) {
2253 cout << ch << ' ';
2254 }
2255 return 0;
2256 }

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: