解题思路:
很想吐槽,为什么用注释的部分就会错,蓝桥杯官网都ac了,,,之后只有改为这个
注意事项:
参考代码:
#include<iostream>
#include<sstream>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include <map>
using namespace std;
int n;
map<int,int> ma;
int main(){
cin >> n;
/*string str;
getchar();
for(int i = 0; i < n; i++){
getline(cin,str);
stringstream ss(str);
int tmp;
while(ss >> tmp){
if(!ma.count(tmp)) ma[tmp] = 1;
else ma[tmp]++;
}
}*/
int tmp;
while(cin >> tmp){
if(!ma.count(tmp)) ma[tmp] = 1;
else ma[tmp]++;
}
int fir = ma.begin()->first;
int que,cho;
for(map<int,int>::iterator it = ma.begin(); it != ma.end(); it++){
//cout << it->first << " " << fir<< endl;
if(it->first != fir){ que = fir; fir++;}
if(it->second == 2) cho = fir;
fir++;
}
cout << que << " " << cho << endl;
return 0;
}
0.0分
0 人评分