HDU 4861

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
原文地址:https://www.cnblogs.com/xiaohongmao/p/3874007.html