全wa,样例没有问题
查看原帖
全wa,样例没有问题
922193
_wsh_楼主2023/3/13 23:04
#include<iostream>
using namespace std;
#include<math.h>
#include<string> 
#include<vector> // vextor容器 
#include<algorithm> // 标准算法的头文件 
#include<iomanip> // 小数点后几位运算 
#include <climits> // 为了使用min=LONG_MAX
#include<cstdlib> // 生成随机数 
#include<ctime> // 生成随机数 
#include<stack>
#include<queue>
#include<list>

int ZH(char c){
	if(c=='0') return 0;
	if(c=='1') return 1;
	if(c=='2') return 2;
	if(c=='3') return 3;
	if(c=='4') return 4;
	if(c=='5') return 5;
	if(c=='6') return 6;
	if(c=='7') return 7;
	if(c=='8') return 8;
	if(c=='9') return 9;
}

int ZHNum(string s){
	if(s.size()==1){
		int num = ZH(s[0]);
		return num;
	}
	if(s.size()==2){
		int a = ZH(s[0]);
		int b = ZH(s[1]);
		return a*10 + b;
	}
	if(s.size()==3){
		int a = ZH(s[0]);
		int b = ZH(s[1]);
		int c = ZH(s[2]);
		return a*100 + b*10 + c;
	}
	if(s.size()==4){
		int a = ZH(s[0]);
		int b = ZH(s[1]);
		int c = ZH(s[2]);
		int d = ZH(s[3]);
		return a*1000 + b*100 + c*10 + d;
	}
} 

void ZMZNUM(string s,int a[],int &k){
	int pos = s.find(" ");
	while(pos!=-1){
		string str = s.substr(0,pos);
		a[k]=ZHNum(str);
		k++;
		s.erase(0,pos+1);
		pos = s.find(" ");
	}
	a[k]=ZHNum(s);
	k++;
} 

int main(){
	int N,a[100000],k=0;
	cin >> N;
	getchar();
	for(int i=0;i<N;i++){
		string s;
		getline(cin,s);
		ZMZNUM(s,a,k);
	}
	sort(a,a+k);
	int z=a[0];
	for(int i=0;i<k;i++){
		if(a[i]!=z){
			cout << z << " ";
			break;
		}else {
			z++;
		}
	}
	for(int i=0;i<k-1;i++){
		if(a[i]==a[i+1]){
			cout << a[i];
			break;
		}
	}
    return 0;
} 

2023/3/13 23:04
加载中...