結果

問題 No.327 アルファベット列
ユーザー suppy193
提出日時 2017-02-02 14:54:02
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-24 03:52:22
合計ジャッジ時間 1,484 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%lld", &n);
      |         ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {
	long long int n;
	char s[20] = {0};
	int i;
	scanf("%lld", &n);

	s[0] = n % 26 + 'A';
	n /= 26;
	i = 1;
	while(n > 0) {
		if(n % 26 == 0){
			s[i] = 'Z';
			n /= 26;
		}
		else{
			s[i] = n % 26 - 1 + 'A';
		}
		n /= 26;
		i++;
	}
	s[i] = '\0';
	//printf("%s\n", s);
	i--;
	do {
		printf("%c", s[i]);
		i--;
	}while(i >= 0);
	printf("\n");

	return 0;
}
0