0pts警示后人
查看原帖
0pts警示后人
1368930
chenzhexuan1楼主2024/12/1 18:35

绝对,绝对不要像我这样不用数组存数据

(代码↓)

#include <iostream>
using namespace std;
bool p[30005];
int n,k,x,ct;
int main(){
	cin>>n>>k;
	while(n--){
		cin>>x;
		p[x]=true;
	}
	for(int i=1;i<30000;i++){
		if(p[x])ct++;
		if(ct==k){
			cout<<i;
			return 0;
		}
	}
	cout<<"NO RESULT";
	return 0;
} 

一看0pts,下载完数据发现

这个数据数字和数字之间有俩空格?!!

比如这样:

10  3
37  6  44  40  52  73  94  82  89  63  

2024/12/1 18:35
加载中...