题解:P17659 [IO 2025 #3] 费斯特大定理

· · 题解

如果 n=0,则相当于解方程 a^0+b^0=1,a,b\neq 0。但此时 a^0=b^0=1,即 2\neq 1 无解。

如果 n=1,可以构造 0^1+c^1=c^1,则 a=0,b=c 即可。

时间复杂度 \mathcal{O}(1)。

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