結果
問題 |
No.2087 基数の変換
|
ユーザー |
![]() |
提出日時 | 2022-09-30 22:57:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 1,541 ms |
コンパイル使用メモリ | 168,580 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 00:41:19 |
合計ジャッジ時間 | 2,898 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 51 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:14:28: warning: division by zero [-Wdiv-by-zero] 14 | if(m%n>=10)return 1/0; | ~^~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n,m; vector<ll> ans; cin>>n>>m; if(m==0){ cout<<0<<endl; return 0; } while(m){ ans.push_back(m%n); if(m%n>=10)return 1/0; m/=n; } // while(ans[(int)ans.size()-1]=='0'){ // ans.erase((int)ans.size()-1,1); // } for(int i=(int)ans.size()-1;i>=0;i--){ cout<<ans[i]; } cout<<endl; return 0; }