結果
| 問題 |
No.327 アルファベット列
|
| コンテスト | |
| ユーザー |
tkw_tech
|
| 提出日時 | 2015-12-20 00:44:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 648 bytes |
| コンパイル時間 | 1,181 ms |
| コンパイル使用メモリ | 159,716 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 20:56:12 |
| 合計ジャッジ時間 | 2,433 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 50 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,n,m) for (int i=n; i<(int)(m); i++)
#define INF 1000000007
#define mp make_pair
typedef long long ll;
typedef long double ld;
ll dy[4]={-1,1,0,0};
ll dx[4]={0,0,1,-1};
/*---------- template ----------*/
ll N;
int main(){
cin >> N;
ll t=1;
ll s=0;
int leng=0;
FOR(i,1,10){
t*=26;
s+=t;
if(s-1 >= N){
s-=t;
N-=s;
leng=i;
break;
}
}
string ans="";
while(N!=0){
int t=N%26;
ans=char('A'+t)+ans;
N/=26;
}
int p = leng-ans.size();
REP(i,p){
ans='A'+ans;
}
cout << ans << endl;
return 0;
}
tkw_tech