Submission #1570849


Source Code Expand

#include <iostream>
#include <string.h>
using namespace std;

int main(void){
	int n;
	string s[60];
	int p[60];
	int max;
	int a;


	cin >> n;

	for(int i=0; i<n; i++){
		cin >> s[i];
		for(int j=0; j<i; j++){
			if(s[i] == s[j]){
				p[i]++;
				s[i]=0;
			}
		}
		max = 0;
		if(max < p[i]){
			a = i;
		}
	}


	cout << s[a] << endl;

	return 0;
}

Submission Info

Submission Time
Task B - 投票
User SSK
Language C++14 (GCC 5.4.1)
Score 0
Code Size 381 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:20:9: error: ambiguous overload for ‘operator=’ (operand types are ‘std::string {aka std::basic_string<char>}’ and ‘int’)
     s[i]=0;
         ^
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/basic_string.h:3026:7: note: candidate: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       operator=(const basic_string& __str) 
       ^
/usr/include/c++/5/bits/basic_string.h:3034:7: note: candidate: std::basic_string<_CharT, _Traits, _A...