結果
問題 | No.499 7進数変換 |
ユーザー |
![]() |
提出日時 | 2017-04-07 22:40:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 480 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 31,104 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-16 02:20:31 |
合計ジャッジ時間 | 1,011 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <cstdio>typedef long long ll;using namespace std;int main(){int n;scanf("%d", &n);ll ans = 0, power = 1;for (int i = 0; ; ++i) {int add = n % 7;n = n / 7;ans += add * power;power *= 10;if (7 > n && n > 0) {ans += n * power;break;} else if (n == 0) {break;}}printf("%lld\n", ans);return 0;}