結果
| 問題 | No.327 アルファベット列 |
| コンテスト | |
| ユーザー |
btk
|
| 提出日時 | 2015-12-21 21:13:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 682 bytes |
| コンパイル時間 | 1,761 ms |
| コンパイル使用メモリ | 169,636 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-18 18:08:06 |
| 合計ジャッジ時間 | 3,000 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 42 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
LL N;cin>>N;
string _s;
while(N>=26*27){
_s+=('A'+(N%26));
N/=26;
if(N<26*27&&N>=0){
N--;
}
}
vector<string> unko;
string s="AA";
for(s[0]='A';s[0]<='Z';s[0]++)
for(s[1]='A';s[1]<='Z';s[1]++)unko.push_back(s);
s="A";
for(s[0]='A';s[0]<='Z';s[0]++)unko.push_back(s);
sort(unko.begin(),unko.end(),
[](string& x,string& y){
if(x.size()==y.size())return x<y;
else return x.size()<y.size();
});
reverse(_s.begin(),_s.end());
if(N>=0)_s=unko[N]+_s;
cout<<_s<<endl;
return 0;
}
btk