結果
問題 |
No.423 ハムスター語初級(数詞)
|
ユーザー |
![]() |
提出日時 | 2016-09-22 22:35:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 449 bytes |
コンパイル時間 | 623 ms |
コンパイル使用メモリ | 69,336 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-17 13:49:19 |
合計ジャッジ時間 | 1,345 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 8 RE * 1 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main(){ string n ,s = "", ans = ""; cin >> n; for(int i = 0; i < n.size() - 3; i += 3){ s += n[i + 3] == 'u' ? '1' : '0'; if(n[i + 3] == 'u') i++; } int num = 2 * stoi(s, nullptr, 2); s = ""; while(num){ s += num & 1 ? '1' : '0'; num >>= 1; } reverse(s.begin(), s.end()); for(int i = 0; i < s.size(); i++) ans += s[i] == 1 ? "hamu" : "ham"; cout << ans << endl; }