結果

問題 No.975 ミスターマックスバリュ
ユーザー sasa
提出日時 2025-03-17 17:59:33
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 25,216 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-17 17:59:34
合計ジャッジ時間 816 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |         scanf("%d%d%d",&wanted, &element1, &element2);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf("%d",&product1[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:17:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |                 scanf("%d",&product2[j]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(void){
	int wanted, element1, element2;
	scanf("%d%d%d",&wanted, &element1, &element2);
	char *ans = "-1";
	
	int product1[element1];
	for(int i = 0;i < element1;i ++){
		scanf("%d",&product1[i]);
		if(wanted == product1[i]){
			ans = "MrMax";
		}
	}
	
	int product2[element2];
	for(int j = 0;j < element2;j ++){
		scanf("%d",&product2[j]);
		if(wanted == product2[j]){
			if(ans == "MrMax"){
				ans = "MrMaxValu";
			}else{
				ans = "MaxValu";
			}
		}
	}
	printf("%s",ans);
}
0