結果
問題 |
No.256 桁の数字を入れ替え (2)
|
ユーザー |
![]() |
提出日時 | 2016-06-25 21:25:51 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 653 ms |
コンパイル使用メモリ | 68,784 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 23:22:32 |
合計ジャッジ時間 | 1,131 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 |
ソースコード
#include <iostream> #include <string> #include <map> using namespace std; int main() { map<char, int> cnt; cnt['0'] = 0; cnt['1'] = 0; cnt['2'] = 0; cnt['3'] = 0; cnt['4'] = 0; cnt['5'] = 0; cnt['6'] = 0; cnt['7'] = 0; cnt['8'] = 0; cnt['9'] = 0; string n; cin >> n; for (auto itr = cnt.begin(); itr != cnt.end(); ++itr) { for (int j = 0, size = n.size(); j < size; ++j) { if (itr->first == n[j]) itr->second++; } } for (auto itr = cnt.rbegin(); itr != cnt.rend(); ++itr) { for (int j = 0; j < itr->second; ++j) { cout << itr->first; } } cout << endl; return 0; }