跳到正文

题解

题解:P14257 嫉妒(jealousy)

lyc_qwq约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年10月21日
收录
2025年12月12日
更新
2026年11月18日
篇幅
约 1 分钟
获赞
1
题目
P14257

版本

  1. v2当前
  2. v1

一道简单的模拟。

思路

只需要依次计算出小 Y 每次到面试的时间,接着判断是否和小 S 面试开始或结束的时间重复,记录结果即可。

代码

C++
#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; 
}
原文