题目分析:
因为 且 为质数,那么 和 互质,那么通过费马小定理 和 ,可得 。也不难推出 。所以当 时,符合题意。
代码:
#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long
int a,c,p;
signed main(){
// step 1、读题、声明变量
cin.tie(0);cout.tie(0);
ios::sync_with_stdio(false);
// step 2、输入
cin>>a>>c>>p;
// step 3、处理
// step 4、输出
cout<<(p-1)*(p-1);
return 0;
}