Submission #4024812
Source Code Expand
#include<iostream> #include<vector> #include<algorithm> #include<string.h> typedef long long int llint; using namespace std; int main(){ int n; cin >> n; char s[51]; vector<pair <char[51], int>>a(n); int cnt = 0; int tmp = 0; for (int i = 0; i < n; i++){ cin >> s; for (int i = 0; i < cnt; i++){ if (strcmp(a[i].first, s) == 0){ a[i].second++; tmp = 1; break; } } if (tmp == 1){ tmp = 0; continue; } else{ strcpy_s(a[cnt].first, s); a[cnt].second = 0; cnt++; } } int max = 0; for (int i = 0; i < cnt; i++){ if (max < a[i].second){ max = a[i].second; tmp = i; } } cout << a[tmp].first << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 投票 |
User | tRue |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 717 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:28:28: error: ‘strcpy_s’ was not declared in this scope strcpy_s(a[cnt].first, s); ^