結果

問題 No.499 7進数変換
ユーザー butsurizuki
提出日時 2017-05-01 10:20:31
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 293 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 01:49:19
合計ジャッジ時間 1,155 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%lld",&n);
      |         ^~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {
	char s[16]="0123456";
	long long x,n,f;
	scanf("%lld",&n);
	if(n == 0){printf("0\n");return 0;}
	x = 13841287201;
	f = 0;
	while(x != 0){
		if(!((n/x) == 0 && f == 0)){
			printf("%c",s[(n/x)]);
			f = 1;
		}
		n%=x;
		x/=7;
	}
	printf("\n");
	return 0;
}
0