結果
問題 |
No.499 7進数変換
|
ユーザー |
![]() |
提出日時 | 2025-03-06 16:31:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 390 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 35,968 KB |
実行使用メモリ | 8,608 KB |
最終ジャッジ日時 | 2025-03-06 16:31:15 |
合計ジャッジ時間 | 1,896 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d", &val); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <math.h> int main(){ int val, ele; scanf("%d", &val); if(val == 0){ printf("0"); return 0; } ele = (int)(log(val) / log(7)); int a[ele]; for(int i = 0; i <= ele; i++){ a[i] = val % 7; val /= 7; } for(int i = ele; i >= 0; i--){ printf("%d", a[i]); } return 0; }