結果
問題 | No.499 7進数変換 |
ユーザー |
![]() |
提出日時 | 2017-11-05 01:00:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 318 bytes |
コンパイル時間 | 609 ms |
コンパイル使用メモリ | 60,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-24 01:15:14 |
合計ジャッジ時間 | 1,517 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <iostream> #include <algorithm> #include <string> int main() { int n; std::cin >> n; std::string str_n7 = n == 0 ? "0" : ""; for (;;) { if (n == 0) { break; } str_n7 += std::to_string(n % 7); n /= 7; } std::reverse(str_n7.begin(), str_n7.end()); std::cout << std::stol(str_n7) << "\n"; }