题目描述:
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".
转换一下,5x^13+13x^5+k*a*x | 65,∵x是任意的,∴5x^12+13x^4+k*a | 65,又∵5(x+t)^12+13(x+t)^4-5x^12-13x^4 | 65,∴5*1^12+13*1^4+k*a | 65,所以AC代码:
#include<stdio.h>
int main(){
int k;
while(scanf("%d",&k)!=EOF){
int i;
for(i=1;i<66;i++)
if((18+k*i)%65==0) break;
if(i==66) printf("no\n");
else printf("%d\n",i);
}
return 0;
}