結果

問題 No.2087 基数の変換
ユーザー Master wwc
提出日時 2022-10-07 12:07:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 3,070 ms
コンパイル使用メモリ 244,532 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 19:41:54
合計ジャッジ時間 3,868 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void solve()
{
    ll n,m; cin>>n>>m;
    string ans="";
    while(true)
    {
      if(n>m)
       {
          ans.push_back((char)(m%n+48));
          break;
       }
       ans.push_back((char)(m%n+48));
       m/=n;
    }
    reverse(ans.begin(),ans.end());
    cout<< ans << "\n";
}

signed main(){

  ios_base::sync_with_stdio(false),cin.tie(0);
  cout.tie(0);

  solve();
}
0