解题思路:
很想吐槽,为什么用注释的部分就会错,蓝桥杯官网都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 人评分
C二级辅导-求偶数和 (C语言代码)浏览:645 |
C语言训练-排序问题<1> (C语言代码)浏览:1368 |
C语言训练-大、小写问题 (C语言代码)浏览:2395 |
C语言训练-计算一个整数N的阶乘 (C语言代码)浏览:960 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:573 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:541 |
sizeof的大作用 (C语言代码)浏览:1517 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:721 |
输入输出格式练习 (C语言代码)浏览:852 |
杨辉三角 (C语言代码)浏览:692 |