結果
| 問題 |
No.164 ちっちゃくないよ!!
|
| コンテスト | |
| ユーザー |
nablaenergy_21
|
| 提出日時 | 2015-05-25 13:35:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 737 bytes |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 24,320 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 14:15:51 |
| 合計ジャッジ時間 | 626 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:25: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[13]’ [-Wformat=]
20 | scanf("%s",&V[i]);
| ~^ ~~~~~
| | |
| | char (*)[13]
| char*
main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:20:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
20 | scanf("%s",&V[i]);
| ~~~~~^~~~~~~~~~~~
main.cpp:16:21: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
16 | long long m,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);
}
nablaenergy_21