https://ac.nowcoder.com/acm/contest/43058/B
思路
要求1~n满足如下式子的个数
\((i^{11}-i)(i^{451}-i^4)\equiv(i^{11}-i^4)(i^{11}-i)(mod 451*4)\)
打表可知,全都符合条件,所以输出n就行
代码
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cctype>
#include<bitset>
#define ll long long
#define gc getchar
#define maxn 10005
#define mo 1804
using namespace std;
inline ll read(){
ll a=0;int f=0;char p=gc();
while(!isdigit(p)){f|=p=='-';p=gc();}
while(isdigit(p)){a=(a<<3)+(a<<1)+(p^48);p=gc();}
return f?-a:a;
}int n;
inline int kuai(int a,int k){
int p=1;
while(k){
if(k&1)p=p*a%mo;
a=a*a%mo;k>>=1;
}
return p;
}
inline bool pan(int x){
return ((kuai(x,451)-kuai(x,4))%mo+mo)%mo==((kuai(x,11)-kuai(x,4))%mo+mo)%mo;
}
int main(){
n=read();
cout<<n<<endl;
/*for(int i=1;i<=n;++i){
printf("%d %d\n",i,pan(i));
}*/
return 0;
}
标签:11,练习赛,int,mo,牛客,kuai,include,114514,define
From: https://www.cnblogs.com/hanruyun/p/16814894.html