AtCoder Beginner Contest 009

Submission #3972635

Source codeソースコード

#include<iostream>
#include<cstdio>
using namespace std;

int main(){
	int n,m1,m2,a; scanf("%d",&n);
	scanf("%d",&m1);
	for(int i=2;i<=n;i++){
		scanf("%d",&a); if(a>=m1) m2=m1,m1=a;
		else if(a>m2) m2=a;
	}
	printf("%d",m2);
	return 0;
}

Submission

Task問題 B - 心配性な富豪、ファミリーレストランに行く。
User nameユーザ名 luogu_bot2
Created time投稿日時
Language言語 C++ (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 252 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:6:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int n,m1,m2,a; scanf("%d",&n);
^
./Main.cpp:7:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&m1);
^
./Main.cpp:9:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a); if(a>=m1) m2=m1,m1=a;
^

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 random_1.txt,random_10.txt,random_2.txt,random_3.txt,random_4.txt,random_5.txt,random_6.txt,random_7.txt,random_8.txt,random_9.txt,sample_1.txt,sample_2.txt,sample_3.txt,small_1.txt,small_2.txt,small_3.txt,small_4.txt,small_5.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
random_1.txt WA
random_10.txt WA
random_2.txt WA
random_3.txt WA
random_4.txt WA
random_5.txt WA
random_6.txt WA
random_7.txt WA
random_8.txt WA
random_9.txt WA
sample_1.txt WA
sample_2.txt WA
sample_3.txt WA
small_1.txt WA
small_2.txt WA
small_3.txt WA
small_4.txt WA
small_5.txt WA