結果
問題 | No.600 かい文回 |
ユーザー |
![]() |
提出日時 | 2016-06-03 20:44:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 477 bytes |
コンパイル時間 | 655 ms |
コンパイル使用メモリ | 67,724 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 00:44:54 |
合計ジャッジ時間 | 1,651 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <iostream> #include <string> #include <cassert> using namespace std; int main(){ long long x; cin >> x; assert(1<=x && x<=1000000000); if(x==1){ puts("a"); return 0; } string ch = "abc"; string ans = ""; long long k = 0; while((1LL<<k) <= x) k++; int i = 0; for(k-=2; k>=0; k--){ ans += ch[i%3]; if((x>>k)&1){ i++; ans += ch[i%3]; } } cout << string(ans.rbegin(), ans.rend()) << ans << endl; return 0; }