AtCoder Beginner Contest 009

Submission #3975443

Source codeソースコード

#include<iostream>
using namespacestd;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;++i)cin>>a[i];
  sort(a,a+n);
  int ans=0;
  for(int i=n-1;i>0;--i){
   if(a[i]==a[i-1])continue;
   ans=a[i-1];
    break;
  }
  cout<<ans<<endl;
  return 0;
}

Submission

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

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

./Main.cpp:2:7: error: expected nested-name-specifier before ‘namespacestd’
using namespacestd;
^
./Main.cpp: In function ‘int main()’:
./Main.cpp:5:3: error: ‘cin’ was not declared in this scope
cin>>n;
^
./Main.cpp:5:3: note: suggested alternative:
In file included from ./Main.cpp:1:0:
/usr/include/c++/5/iostream:60:18: note: ‘std::cin’
extern istream cin; /// Linked to standard input
^
./Main.cpp:8:13: error: ‘sort’ was not declared in this scope
sort(a,a+n);
^
./Main.cpp:15:3: error: ‘cout’ was not declared in this scope
cout<<ans<<endl;
^
./Main.cpp:15:3: note: suggested alternative:
In file included from ./Main.cpp:1:0:
/usr/include/c++/5/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
^
./Main.cpp:15:14: error: ‘endl’ was not declared in this scope
cout<<ans<<endl;
^
./Main.cpp:15:14: note: suggested alternative:
In file included from /usr/include/c++/5/iostream...

Test case