結果
問題 | No.600 かい文回 |
ユーザー |
![]() |
提出日時 | 2017-06-18 19:17:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 592 bytes |
コンパイル時間 | 825 ms |
コンパイル使用メモリ | 76,112 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-01 20:21:52 |
合計ジャッジ時間 | 1,832 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int64_t N; cin>>N; vector<int> V; for(int i=0;i<32;i++){ if(N&(1<<i)) V.push_back(i); } string s; char c='a'; for(int i=0;i<V.size();i++){ int len; if(i){ len=V[i]-V[i-1]; }else{ len=V[i]; } if(i!=V.size()-1) len++; s=string(len,c)+s; c++; if(c=='d')c='a'; } string ans = "z"+s; reverse(s.begin(), s.end()); ans=s+ans; cout<<ans<<endl; return 0; }