题解:P13678 [GCPC 2023] Mischievous Math

· · 题解

正解

我们对 d 进行分类讨论:当 d \ge 10 时,我们令 a = 1, b = 2, c = 3,一定满足条件,因为凑出来的数最大是 9。

当 d < 10 时,我们令 a = 31, b = 53, c = 74,同理也一定满足条件,凑不出 i 满足 1 \le i < 10。

代码

#include <bits/stdc++.h>
using namespace std;
int d;
int main(void) {
    cin >> d;
    if (d >= 10)
        cout << "1 2 3";
    else
        cout << "31 53 74";
    return 0;
}