結果

問題 No.327 アルファベット列
ユーザー Ysmr_Ry
提出日時 2016-03-03 19:27:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 37,504 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 13:52:10
合計ジャッジ時間 1,745 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf( "%lld", &N );
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

// yukicoder 327 (http://yukicoder.me/problems/904)
#include<cstdio>
#include<vector>
#define repd(i,a) for(int i=(a);i>=0;--i)

typedef long long ll;

ll N;

std::vector<int> vs;

int main()
{
	scanf( "%lld", &N );

	if( N <= 25 )
	{ putchar( 'A'+N ); puts(""); return 0; }	

	N -= 26;

	while( N > 0 )
		vs.push_back( N%26 ), N /= 26;

	while( vs.size() < 2 )
		vs.push_back( 0 );

	repd( i, vs.size()-1 )
		putchar( 'A'+vs[i]-(i>=2?vs.size()>=3:0) );

	puts("");

	return 0;
}
0