P7979 「Stoi2033」世界未末日 加强版骗分出奇迹

· · 题解

首先看一下难度,哇,黑题

像我这种蒟蒻正解是不可能的,但是这题输出只有 YES 和 NO ,而且还没有多组数据,就可以骗分了!

先判断奇偶做一下。

#include<bits/stdc++.h>
using namespace std;
int n;
int main() {
    cin >> n;
    if(n & 1) cout << "NO\n";
    else cout << "YES\n";
    return 0;
}

只有 80 pts 。

然后考虑在 NO 那边换成 (rand() % 4 ? "NO\n" : "YES\n") 。( \frac{1}{4} 概率输出 YES )。

最后再一顿骗分,就可以 AC 了。

#include<bits/stdc++.h>
using namespace std;
int n;
int main() {
    cin >> n;
    srand(n * 2 + 76334);
    if(n & 1) cout << (rand() % 4 ? "NO\n" : "YES\n");
    else cout << "YES\n";
    return 0;
}