結果

問題 No.2087 基数の変換
ユーザー loglong
提出日時 2023-11-08 03:31:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 2,055 ms
コンパイル使用メモリ 193,620 KB
最終ジャッジ日時 2025-02-17 20:03:13
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define ll long long

ll N, M;
int main()
{
  cin >> N >> M;
  if (M==0) {cout << M << endl;return 0;}
  string ans = "";
  ll k = N;
  while (M > 0)
  {
    ll rem = M % N;
    ans += char('0'+(rem));
    M /= N;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}
    
0