結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー | nablaenergy_21 |
提出日時 | 2015-05-25 13:35:22 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 737 bytes |
コンパイル時間 | 226 ms |
コンパイル使用メモリ | 27,048 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-03 17:11:15 |
合計ジャッジ時間 | 845 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 1 ms
4,380 KB |
testcase_10 | AC | 1 ms
4,380 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:44:8: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized] printf("%lld\n",ans); ~~~~~~^~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<string.h> int max(int a,int b){ if(a>b){return a;}else{return b;} } long long min(long long a,long long b){ if(a<b){return a;}else{return b;} } int main(void){ int N; char V[1000][13]; int i,j,c; long long m,ans; scanf("%d",&N); for(i=0;i<N;i++){ scanf("%s",&V[i]); } for(i=0;i<N;i++){ c=0; for(j=0;j<strlen(V[i]);j++){ if('0' <= V[i][j] && V[i][j] <= '9'){ c = max(c,V[i][j] - '0'); }else{ c = max(c,V[i][j] - 'A' + 10); } } c++; m = 0; for(j=0;j<strlen(V[i]);j++){ if('0' <= V[i][j] && V[i][j] <= '9'){ m = m*c + V[i][j] - '0'; }else{ m = m*c + V[i][j] - 'A' + 10; } } if(i==0){ans = m;}else{ans = min(ans,m);} } printf("%lld\n",ans); }