[WA]40分求助
查看原帖
[WA]40分求助
668222
Blue_cat楼主2022/7/24 16:19
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
bool Yee(int ai,int a[],int n){
	for(int i=1;i <= n;i++){
		if(a[i] == ai){
			return true;
		}
	}
	return false;
}
int a[11];
int main(){
	int n , m , k , ai=1 , aidid=0 , c=0;
	cin >> n >> m >> k;
	if(k == 0){
		cout << n / m;
		return 0;
	}
	for(int i=1;i <= k;i++){
		cin >> a[++aidid];
	}
	while(ai < n){
		ai += m;
		if(Yee(ai,a,aidid)){
			m += 1;
		}
		c++;
	}
	c--;
	cout << c;
	// system("pause");
	return 0;
}
2022/7/24 16:19
加载中...