60分求助!!!!!!!
查看原帖
60分求助!!!!!!!
932162
Paulpeng楼主2023/5/10 18:16
#include<iostream>
#include<cstdio>
using namespace std;

int main()
{
	int n = 7;
	double a, b, wei = 0;
	cin >> a >> b;
	while(1)
	{
		wei += n;
		n *= 0.98;
		if(wei >= a + b)
		{
			cout << "n";
			return 0; 
		}
		if(wei >= a - b && wei <= a + b)
		{
			if(wei + n >= a - b && wei + n <= a + b)
			{
				cout << "y";
				return 0;
			}
			else
			{
				cout << "n";
				return 0;
			}
		}
		
	} 
	return 0;
}

2023/5/10 18:16
加载中...