天空


私信TA

用户名:673953508

访问量:14714

签 名:

别看了,全是水题

等  级
排  名 482
经  验 4524
参赛次数 1
文章发表 22
年  龄 20
在职情况 学生
学  校 广东技术师范学院
专  业 计算机科学与技术

  自我简介:

解题思路:

很想吐槽,为什么用注释的部分就会错,蓝桥杯官网都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 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区