結果

問題 No.164 ちっちゃくないよ!!
ユーザー kongarishisyamo
提出日時 2016-05-01 23:32:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 62,908 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 01:08:30
合計ジャッジ時間 1,009 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){

	int N;
	string V;
	long long ans=-1;

	cin>>N;

	for(int i=0;i<N;i++){
		cin>>V;
		int num[12];
		for(int j=0;j<V.size();j++){
			if(V[j]>='0'&&V[j]<='9') num[j]=V[j]-'0';
			else num[j]=V[j]-'A'+10;
		}
		int max1=-1;
		for(int j=0;j<V.size();j++){
			max1=max(max1,num[j]);
		}
		max1++;
		long long sum=0;
		for(int j=V.size()-1;j>=0;j--){
			sum+=pow((double)max1,(double)V.size()-j-1)*num[j];
			//cout<<sum<<",";
		}
		//cout<<endl;
		if(ans==-1) ans=sum;
		else ans=min(ans,sum);
	}
	cout<<ans<<endl;
}
0