Ignatius ' s puzzle
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others) total submission (s): 6683 Accepted Submission (s): 4625
Problem Descriptionignatius is poor at Math,he falls across a puzzle problem,so he have 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 Nonegat Ive integer a,make The arbitrary integer x, 65|f (x) if no exists that a,then print "no".
Inputthe input contains several test cases. Each test case consists of a nonegative an integer k, more details in the Sample Input.
Outputthe output contains a string "No" if you can ' t find a,or you should output a line contains the A.more details in the Sample Output.
Sample Input111009999
Sample output22no43 PS: Some trickery, when satisfied with the x=1, the smallest can be divisible by 65 detailed proof: http://www.cnblogs.com/g 0feng/archive/2012/08/23/2652996.html#include "Stdio.h"
int main ()
{
int k,a;
while (~SCANF ("%d", &k))
{
for (a=1;a<=65;a++)//651 loops, so to 65 is OK.
if ((18+a*k)%65==0)
{
printf ("%d\n", a);
Break
}
if (a==66)
printf ("no\n");
}
return 0;
}
HDU 1098 A typical math problem.