http://acm.hdu.edu.cn/showproblem.php?pid=4861

结论题:p是奇素数,1^n+2^n+...+(p-1)^n=0(mod p),其中p-1不整除n

#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <cmath>
#include <map>
#include <queue>
using namespace std ;
int main()
{
    int k,p ;
    while(~scanf("%d%d",&k,&p))
    {
        if(p==2)
        {
            puts("NO") ;
            continue ;
        }
        int temp=k/(p-1) ;
        if(temp&1)puts("YES") ;
        else puts("NO") ;
    }
    return 0 ;
}
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-08-04
  • 2021-06-25
相关资源
相似解决方案