結果

問題 No.2087 基数の変換
ユーザー madokamadoka
提出日時 2022-09-30 22:49:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 3,113 bytes
コンパイル時間 1,117 ms
コンパイル使用メモリ 145,384 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-24 16:23:51
合計ジャッジ時間 2,851 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 1 ms
4,376 KB
testcase_42 AC 1 ms
4,376 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 1 ms
4,376 KB
testcase_46 AC 2 ms
4,380 KB
testcase_47 AC 1 ms
4,376 KB
testcase_48 AC 1 ms
4,376 KB
testcase_49 AC 2 ms
4,376 KB
testcase_50 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <bits/stdc++.h>
#include <time.h>
#include <stack>
#include <array>



#define popcount __builtin_popcount
using namespace std;

#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define rrep(i,x) for(long long i=x-1;i>=0;i--)
#define rrepn(i,x) for(long long i=x;i>1;i--)
#define REP(i,n,x) for(long long i=n;i<x;i++)
#define REPN(i,n,x) for(long long i=n+1;i<x;i++)

#define re return
#define fi first
#define se second
#define pr printf
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

#define all(x) (x).begin(),(x).end()

typedef long long int ll;

const double PI=3.14159265358979323846;
//#define INF 1e18+5//19桁
#define INF 9223372036854775807
//-9,223,372,036,854,775,808~9,223,372,036,854,775,807
//-9223372036854775808~9223372036854775807

#define inf  INT_MAX//19桁
//#define mp make_pair
//using lll=__int128_t;

const ll mask=(1<<20)-1;
typedef pair<long long, long long> P;


//int dp[MAX][MAX];
const int MAX = 500;
const int MOD = 1000000007;
//#define MAX 105
ll wk,wk1,wk2,wk3,wk4;
double dA,dB,dC,dD,dE,dF,dG,dH,dI,dJ,dK,dL,dM,dN,dO,dP,dQ,dR,dS,dT,dU,dV,dW,dX,dY,dZ;
double dwk,dwk1,dwk2,dwk3,dwk4,dsum;
ll A,B,C,D,E,F,G,I,J,K,L,M,N,O,R,S,T,U,V,X,Y,Z;//P,Q,H,Wは無し
//ll a,b,c,d,e,f,g,i,j,k,l,m,n,o,r,s,t,u,v,x,y,z;//p,q,h,wは無し
ll cnt,flg;
ll ans,sum=0;
//int n;
//int t[200020];
//int a[200020], b[200020];

//vector<ll> A[MAX];
//int ans[200020];

//#define mod 1000000007//atcoder/allを使う時にはコメントアウト
//#define mod 998244353//atcoder/allを使う時にはコメントアウト

//g++ new_formatcopy.cpp -std=c++14 -I /mnt/c/code/
//もしくはexport CPATH=$CPATH:/mnt/c/code/

//**************ここまでフォーマット***************
//v(10進数)からbase進数へ変換
template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
    static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string ret;
    static numeric_limits<TypeInt> t;
    TypeInt n = v;
    if (t.is_signed) {
        if (v < 0) n *= -1;
    }

    while (n >= base) {
        ret += table[n%base];
        n /= base;
    }
    ret += table[n];
    if (t.is_signed) {
        if (v < 0 && base == 10) ret += '-';
    }
    // 文字列の順番を逆にする
    std::reverse(ret.begin(), ret.end());

    return ret;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin>>N;
    cin>>M;
    //10進数(N)からK進数へ
    string s;
    s=Itoa(M,N);
    cout<<s<<"\n";
}


0