結果
| 問題 |
No.600 かい文回
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-09 16:50:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 512 bytes |
| コンパイル時間 | 764 ms |
| コンパイル使用メモリ | 74,112 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 07:29:40 |
| 合計ジャッジ時間 | 1,713 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main()
| ^~~~
ソースコード
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
string s;
int N;
main()
{
cin>>N;
if(N==1)
{
cout<<"a"<<endl;
return 0;
}
vector<int>bit;
while(N)
{
bit.push_back(N%2);
N>>=1;
}
reverse(bit.begin(),bit.end());
int cnt=0;
for(int i=0;i<bit.size();cnt++)
{
int j=i+1;
while(j<bit.size()&&bit[j]==0)j++;
int t=j-i;
i=j;
if(i<bit.size())t++;
if(cnt==0)t--;
s+=string(t,cnt%26+'a');
}
string t=s;
reverse(t.begin(),t.end());
cout<<t+s<<endl;
}