結果

問題 No.499 7進数変換
ユーザー aitdccd
提出日時 2018-01-07 00:34:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 450 bytes
コンパイル時間 1,631 ms
コンパイル使用メモリ 168,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 09:20:49
合計ジャッジ時間 2,869 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#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