結果
| 問題 | No.499 7進数変換 |
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2019-12-26 22:53:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 1,000 ms |
| コード長 | 731 bytes |
| 記録 | |
| コンパイル時間 | 1,988 ms |
| コンパイル使用メモリ | 195,764 KB |
| 最終ジャッジ日時 | 2025-01-08 15:13:02 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
ソースコード
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
vector<T> convert_base(T x,T b){
vector<T> res;
T t=1,k=abs(b);
while(x){
res.emplace_back((x*t)%k);
if(res.back()<0) res.back()+=k;
x-=res.back()*t;
x/=k;
t*=b/k;
}
if(res.empty()) res.emplace_back(0);
reverse(res.begin(),res.end());
return res;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
// verify positive base
signed YUKI_499(){
long long p;
cin>>p;
auto ans=convert_base(p,7LL);
for(auto x:ans) cout<<x;
cout<<endl;
return 0;
}
/*
verified on 2019/12/26
https://yukicoder.me/problems/no/499
*/
signed main(){
YUKI_499();
return 0;
}
#endif
beet