rt,我的代码在自己的机子上是可以跑出正确答案的
但是在洛谷的Linux下却没法跑出正确答案
想知道是哪里出现了问题
以下是我的代码
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<cstring>
#include<queue>
#include<algorithm>
#include<vector>
#define ll long long
#define reg register int
#define gc getchar()
#define MAXN 1000001
#define MOD
using namespace std;
inline ll read( void ) ;
int from,to,top;
int num ;
string s;
int a[MAXN];
int main( void ) {
from = read();
char ch;
while(1){
ch = gc;
if( ch == '\n' ) break;
num *= from;
if( ch >= '0' && ch <= '9' ) num += (ch-'0');
else num += ( ch-'A'+10 );
}
to = read();
int top = 0;
while(1){
top++;
a[top] = num % to;
num /= to;
if(!num)break;
}
for( reg i = top ; i >= 1 ; i-- ){
if( a[i] < 10 ) cout << a[i];
else cout << char( a[i]-10+'A' );
}
return 0;
}
inline ll read( void ) {
ll x = 0 , f = 0 ;
char ch = gc ;
while( !isdigit( ch ) )
f |= ( ch == '-' ) , ch = gc ;
while( isdigit( ch ) )
x = ( x << 1 ) + ( x << 3 ) + ( ch ^ 48 ) , ch = gc ;
return f ? -x : x ;
}