結果
| 問題 |
No.499 7進数変換
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-24 17:44:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 1,000 ms |
| コード長 | 428 bytes |
| コンパイル時間 | 2,029 ms |
| コンパイル使用メモリ | 194,524 KB |
| 最終ジャッジ日時 | 2025-02-25 06:07:18 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
| 外部呼び出し有り |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:28: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | int main() { solve();system("pause"); }
| ~~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
vector<ll> numeral_7(ll n){
vector<ll> answer;
if(n==0){
answer.push_back(0);
return answer;
}
while(n>0){
answer.push_back(n%7);
n/=7;
}
return answer;
}
void solve() {
ll n;
cin>>n;
vector<ll> a=numeral_7(n);
for(ll i=a.size()-1;i>=0;i--){
cout<<a.at(i)<<(i==0?"\n":"");
}
}
int main() { solve();system("pause"); }