結果

問題 No.164 ちっちゃくないよ!!
ユーザー nablaenergy_21nablaenergy_21
提出日時 2015-05-25 13:35:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 24,320 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 15:25:24
合計ジャッジ時間 838 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |                     ^~~

ソースコード

diff #

#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);

}
0