結果
問題 | No.499 7進数変換 |
ユーザー |
|
提出日時 | 2017-04-11 13:50:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 394 bytes |
コンパイル時間 | 634 ms |
コンパイル使用メモリ | 74,700 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 07:04:42 |
合計ジャッジ時間 | 1,546 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include<iostream>#include<vector>#include<algorithm>#include<cmath>#include<string>using namespace std;int main(){int n;cin >> n;int b;string res = "";while(true){b = n%7;res.push_back(to_string(b)[0]);if(n/7 == 0){if(n/7 == 1)res.push_back('1');break;}else{n /= 7;}}for(int i=res.length()-1; i>-1; i--) cout << res[i];cout << endl;}