結果

問題 No.499 7進数変換
コンテスト
ユーザー aitdccd
提出日時 2018-01-07 00:34:49
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 528µs
コード長 450 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,012 ms
コンパイル使用メモリ 184,608 KB
実行使用メモリ 9,868 KB
最終ジャッジ日時 2026-10-06 11:26:06
合計ジャッジ時間 2,972 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

#define REPR(i, n) for(int i = n; i >= 0; i--)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;

    if (n == 0) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> a;
    while (n > 0) {
        a.push_back(n % 7);
        n /= 7;
    }

    REPR(i, a.size() - 1) {
        cout << a[i];
    }
    cout << endl;
    return 0;
}
0