95,过不了第二个测试点,求助
查看原帖
95,过不了第二个测试点,求助
1455500
ChaoDaiShi楼主2025/7/23 01:59
#include <iostream>
using namespace std;
double ks = 7.0;

int main() {
	int a[2] = { 0 };
	double m=0.0;
	double s, x;
	cin >> s >> x;
	double tou = s - x;
	double wei = s + x;
	while (1) {
		if (m > tou && m < wei) {
			a[0]++;
		}
		else if(m>=wei){
			a[1]++;
		}
		if (a[1] == 1||a[0]>1) {
			break;
		}
		m += ks;
		ks *= 0.98;
	}
	if (a[0] <= 1) {
		cout << 'n' << endl;
	}
	else {
		cout << 'y' << endl;
	}

}

2025/7/23 01:59
加载中...