結果

問題 No.2087 基数の変換
ユーザー 👑 p-adic
提出日時 2022-09-16 09:45:56
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 530 bytes
コンパイル時間 890 ms
コンパイル使用メモリ 69,700 KB
最終ジャッジ日時 2025-02-07 05:49:26
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <stdio.h>
#include <stdint.h>
using namespace std;

using ll = long long;

#define CIN( LL , A ) LL A; cin >> A 
#define RETURN( ANSWER ) cout << ( ANSWER ) << endl; return 0 

#include <cassert>

int main()
{
  CIN( ll , N );
  assert( 2 <= N && N <= 10 );
  CIN( ll , M );
  assert( 0 <= M && M <= 1000000000 );
  if( N == 10 || M == 0 ){
    RETURN( M );
  }
  string answer = "";
  while( M != 0 ){
    answer = to_string( M % N ) + answer;
    M /= N;
  }
  RETURN( answer );
}
0