提出 #7955977


ソースコード 拡げる

Copy
#include <bits/stdc++.h>
using namespace std;

int main() {
int X,N;
  cin>>N>>X;
vector<int> vec(X);
  for(int i=0;i<X;i++){
    cin>>vec.at(i);
  }
vector<int> N(N);
  for(int i=0;i<X;i++){
    N.at(vec.at(i)-1)++;
  }
  int max=0;
for(int i=0;i<N;i++){
  if(max<N.at(i)){
    max=N.at(i);
}
}
  int c=0;
  for(int i=0;i<N;i++){
  if(max==N.at(i)){
    c++;
  }
  }
  print(c);
}

提出情報

提出日時
問題 A - November Festival
ユーザ abaabbab
言語 C++14 (GCC 5.4.1)
得点 0
コード長 412 Byte
結果

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:16: error: conflicting declaration ‘std::vector<int> N’
 vector<int> N(N);
                ^
./Main.cpp:5:7: note: previous declaration as ‘int N’
 int X,N;
       ^
./Main.cpp:13:7: error: request for member ‘at’ in ‘N’, which is of non-class type ‘int’
     N.at(vec.at(i)-1)++;
       ^
./Main.cpp:17:12: error: request for member ‘at’ in ‘N’, which is of non-class type ‘int’
   if(max<N.at(i)){
            ^
./Main.cpp:18:11: error: request for member ‘at’ in ‘N’, which is of non-class type ‘int’
     max=N.at(i);
           ^
./Main.cpp:23:13: error: request for member ‘at’ in ‘N’, which is of non-class type ‘int’
   if(max==N.at(i)){
             ^
./Main.cpp:27:10: error: ‘print’ was not declared in this scope
   print(c);
          ^