社区讨论

80ptsWAon2,4

P14257嫉妒(jealousy)参与者 2已保存回复 1

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
1 条
当前快照
1 份
快照标识符
@mhj0xtaz
此快照首次捕获于
2025/11/03 18:55
4 个月前
此快照最后确认于
2025/11/03 18:55
4 个月前
查看原帖
求调
CPP
#include <bits/stdc++.h>
using namespace std;

int n,y,s,t;

bool chk(int x) {
    for(int i = 0; y + i * s <= x; i++) {
        if(y + i * t == x) return false;
    }
    return true;
}

int main() {
    cin >> n >> y >> s >> t;
    for(int i = 1; i <= n; i++) {
        int a = (i-1) * s;
        int b = i * s;
        if(chk(a) && chk(b)) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

回复

1 条回复,欢迎继续交流。

正在加载回复...