非欧拉函数解法,MLE7个点

P2158 [SDOI2008] 仪仗队

~~废话这样不MLE才怪~~ 还是建议你去系统地学习一下欧拉函数
by Smile_Cindy @ 2019-11-12 16:40:54


@[云雨亦有情](/user/147987)
by Smile_Cindy @ 2019-11-12 16:40:58


@[云雨亦有情](/user/147987) ~~您也可以考虑一下反演~~
by CreeperLordVader @ 2019-11-12 16:47:32


@[CreeperLordVader](/user/68207) 请问反演是什么
by 云雨亦有情 @ 2019-11-12 16:57:57


@[云雨亦有情](/user/147987) 莫比乌斯反演
by CreeperLordVader @ 2019-11-12 17:23:52


``` #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<cmath> #include<algorithm> using namespace std; int main() { int a,b,c,d,e,f,g,h,i,j,k,l,m,n; cin>>a; for(b=1,d=0;a>=b;++b) { for(c=1;a>=c;++c) { if(__gcd(b-1,c-1)==1) { d++; } } } printf("%d",d); }
by xb谢神noreply @ 2019-12-22 10:57:46


|