結果

問題 No.499 7進数変換
コンテスト
ユーザー zengyongxu-jerry
提出日時 2026-06-21 20:42:23
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 867 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,022 ms
コンパイル使用メモリ 332,980 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-21 20:42:29
合計ジャッジ時間 4,551 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define piii pair<pii, int>
#define pll pair<ll, ll>
#define plll pair<pll, ll>
#define fi first
#define se second
const int N = 2e5 + 5, M = 1e6 + 5;
const int inf = 1e9, mod = 998244353;
const ll INF = 1e18;

namespace ARIS0_0{
	int n; 
	
	void init(){
	}
	void solve(){
		cin >> n;
		if (n == 0){
			cout << n << "\n";
			return ;
		}
		
		vector <int> v;
		while (n){
			v.push_back(n % 7);
			n /= 7;
		}
		
		reverse(v.begin(), v.end());
		for (auto i : v) cout << i;
		cout << "\n";
	}
	void single(){ init(), solve(); }
	void multi(){ init(); int T; cin >> T; while (T -- ) solve(); }
	void idmulti(){ init(); int id, T; cin >> id >> T; while (T -- ) solve(); }
};

signed main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ARIS0_0::single();
}

/*



*/
0