結果

問題 No.164 ちっちゃくないよ!!
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-05-01 23:32:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 62,380 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 08:36:55
合計ジャッジ時間 1,360 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 WA -
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

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