P1426 85求调
查看原帖
P1426 85求调
1044318
ZhangShuai2012楼主2024/12/1 19:23

传送门

本来想shui道题,结果85分,我懵了

#include<bits/stdc++.h>
using namespace std;
int s,x;
double cnt=0; 
double speed = 7;
int main()
{	
	cin>>s>>x;
	int ma=s+x,mi=s-x;
	while(1){
		if(cnt>ma){
		cout<<'n' ;
		return 0;
		}
		if(cnt>=mi&&cnt<=ma){

			cnt+=speed;
			if(cnt>ma){
				cout<<'n';
				return 0;
			}else{
				cout<<'y';
				return 0;
			}
			//return 0;
		}
		
		cnt+= speed;
		speed*=0.98;
	}
	
    return 0;
}
2024/12/1 19:23
加载中...