P17659 [IO 2025 #3] 费斯特大定理
题意简述
给定 ,。求出满足 的一组 ,保证 。
分析
我们注意到:
-
当 时,对于任意非零整数 ,。若 与 中不存在 ,等式等价为 ,显然不成立。又因为题目中说明了,若等式中有 则认定等式不成立,所以当 时等式不成立。
-
当 时,等式等价为 。不难发现当 且 时等式成立。
运用上述分析编程即可。
代码如下:
#include<bits/stdc++.h>
using namespace std;
int n,c;
int main(){
ios::sync_with_stdio(0);
cin.tie(nullptr),cout.tie(nullptr);
cin>>n>>c;
if(n==1) cout<<"YES\n"<<(c>>1)<<' '<<(c-(c>>1));else cout<<"NO";
return 0;
}