結果
問題 | No.499 7進数変換 |
ユーザー |
![]() |
提出日時 | 2019-07-18 22:53:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 496 bytes |
コンパイル時間 | 763 ms |
コンパイル使用メモリ | 73,216 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 22:43:01 |
合計ジャッジ時間 | 2,228 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 |
ソースコード
#include <algorithm> #include <iostream> #include <vector> using namespace std; template<typename T> vector<T> convert_base(T x, T base) { if (x == 0) return {0}; vector<T> ret; while (x) { T r = x % base; if (r < 0) r -= base; x = (x - r) / base; ret.emplace_back(r); } reverse(ret.begin(), ret.end()); return ret; } int main() { int n; cin >> n; for (int sept: convert_base(n, 7)) cout << sept; cout << endl; return 0; }