結果

問題 No.327 アルファベット列
ユーザー tkw_tech
提出日時 2015-12-20 00:34:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 652 bytes
コンパイル時間 1,201 ms
コンパイル使用メモリ 161,340 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-17 11:09:53
合計ジャッジ時間 2,758 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 > N){
			s-=t;
			N-=s;
			leng=i;
			break;
		}
	}

	string ans="";
	if(N==0) ans+='A';
	while(N!=0){
		int t=N%26;
		ans=char('A'+t)+ans;
		N/=26;
	}

	REP(i,leng-ans.size()){
		ans=ans+'A';
	}

	cout << ans << endl;

	return 0;
}
0