HDU1098

来源:互联网 发布:黑刀秋水淘宝网 编辑:程序博客网 时间:2024/05/29 17:24
题目描述:
Ignatius is poor at math,he falls across a puzzle problem,so he has no choice but to appeal to Eddy. this problem describes that:f(x)=5*x^13+13*x^5+k*a*x,input a nonegative integer k(k<10000),to find the minimal nonegative integer a,make the arbitrary integer x ,65|f(x)if
no exists that a,then print "no".
大致思路:
简单的数论问题,把表达式化简之后就比较好做了。
代码:
#include<cstdio>using namespace std;int main(){    int n,i,t;    while(scanf("%d",&n)!=EOF)    {        t=0;        for(i=1;i<=65;i++)        {            if((18+n*i)%65==0)            {                printf("%d\n",i);                t++;                break;            }        }        if(t==0) printf("no\n");    }}


0 0