Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <set>
- #include <map>
- using namespace std;
- int cnt[500];
- int diag[500][11000]
- int main()
- {
- #if _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- char c;
- while (cin >> c) {
- cnt[c]++;
- }
- int max_h = 0;
- for (int i = 0; i < 500; ++i) {
- max_h = max(max_h, cnt[i]);
- }
- for (int i = max_h; i > 0; --i) {
- for (int c = 0; c < 500; ++c) {
- if (cnt[c] == 0) {
- continue;
- }
- if (cnt[c] >= i) {
- cout << '#';
- }
- else {
- cout << ' ';
- }
- }
- cout << "\n";
- }
- for (int c = 0; c < 500; ++c) {
- if (cnt[c] == 0) {
- continue;
- }
- cout << static_cast<char>(c);
- }
- return 0;
- }
- #include <iostream>
- #include <vector>
- #include <string>
- #include <set>
- #include <map>
- using namespace std;
- int cnt[500];
- char diag[11000][500];
- int main()
- {
- #if _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- char c;
- while (cin >> c) {
- cnt[c]++;
- }
- int max_h = 0;
- for (int i = 0; i < 500; ++i) {
- max_h = max(max_h, cnt[i]);
- }
- int pos = 0;
- for (int c = 0; c < 500; ++c) {
- if (cnt[c] == 0) continue;
- for (int i = 0; i < cnt[c]; ++i) {
- diag[i][pos] = '#';
- }
- for (int i = cnt[c]; i < max_h; ++i) {
- diag[i][pos] = ' ';
- }
- pos++;
- }
- for (int i = max_h - 1; i >= 0; --i) {
- for (int j = 0; j < pos; j++) {
- cout << diag[i][j];
- }
- cout << '\n';
- }
- return 0;
- }
RAW Paste Data