一道简单的模拟
思路
只需要依次计算出小 Y 每次到面试的时间,接着判断是否和小 S 面试开始或结束的时间重复,记录结果即可。
代码
#include<bits/stdc++.h>
using namespace std;
int n , y , s , t;
bool check(int x)
{
if((x * s >= y) && (x * s - y) % t == 0)
return 1;
return 0;
}
int msin()
{
cin >> n >> y >> s >> t;
bool f = 0;
for(int i = 1;i <= n; ++ i)
if(!check(i - 1) && !check(i))
f = 1;
if(f)
cout<<"Yes\n";
else
cout<<"No\n";
return 0;
}