HDU 1098 A typical math problem.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.