Ignatius's puzzle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5035    Accepted Submission(s): 3426

Problem Description
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".
 
Input
The input contains several test cases. Each test case consists of a nonegative integer k, More details in the Sample Input.
 
Output
The 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 Input
11
100
9999
 
Sample Output
22
no
43
 
Author
eddy
 
 
 
 
 
 
 
 
 
 
这道题,如果能够在高中的时候,很定能够求出来的..
 
  对于           F(x)=5*x^13+13*x^5+k*a*x;
  数学归纳如下:
                              当x=1时,F(1)=5+13+k*a (此时需要找一个a使得,条件成立)。
                           假设  当x=k时,其成立;
                             当.x=k+1时,也应当成立。但实际上5*(x+1)^13+13*(x+1)^5+k*a*(x+1);
                     展开之后                 0                     13 
                                           5*(C  *x^13.........C *x^0)+13*(.....同前头.....)+k*a*x + k*a ;
                                                       13                    13                  
             最后我5*x^13+13*x^5+kax +5+13+ka  +后面部分(由于是65的倍数,就不讲啦)....由于当x=xs十,条件是成立的....所以最后只需要将(13+5+ka)%65
            等于0就行了!!而a必须小于65,不然就没有意义了!!试想a如果是65的倍数的话....那么F(x+1)处,便放到后头省掉了...
由此就不难写出代码了!!
代码如下:

 #include<iostream>
using namespace std;
int main( void )
{
int k,a;
while(cin>>k)
{
a=;
for(int i=;i<;i++)
{
if((+i*k)%==)
{ a=i;
break;
}
}
if(a)cout<<a<<endl;
else cout<<"no"<<endl; }
return ;
}
 

HDUOJ-----1098 Ignatius's puzzle的更多相关文章

  1. 数学--数论--HDU 1098 Ignatius's puzzle (费马小定理+打表)

    Ignatius's puzzle Problem Description Ignatius is poor at math,he falls across a puzzle problem,so h ...

  2. HDOJ 1098 Ignatius's puzzle

    Problem Description Ignatius is poor at math,he falls across a puzzle problem,so he has no choice bu ...

  3. HDU 1098 Ignatius's puzzle(数学归纳)

    以下引用自http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=8466&messageid=2&deep=1 题意以 ...

  4. HDU 1098 Ignatius's puzzle

    http://acm.hdu.edu.cn/showproblem.php?pid=1098 题意 :输入一个K,让你找一个a,使得f(x)=5*x^13+13*x^5+k*a*x这个f(x)%65等 ...

  5. HDU - 1098 - Ignatius's puzzle - ax+by=c

    http://acm.hdu.edu.cn/showproblem.php?pid=1098 其实一开始猜测只要验证x=1的时候就行了,但是不知道怎么证明. 题解表示用数学归纳法,假设f(x)成立,证 ...

  6. 题解报告:hdu 1098 Ignatius's puzzle

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1098 题目中文是这样的: 伊格内修斯在数学上很差,他遇到了一个难题,所以他别无选择,只能上诉埃迪. 这 ...

  7. HDU 1098 Ignatius's puzzle 费马小定理+扩展欧几里德算法

    题目大意: 给定k,找到一个满足的a使任意的x都满足 f(x)=5*x^13+13*x^5+k*a*x 被65整除 推证: f(x) = (5*x^12 + 13 * x^4 + ak) * x 因为 ...

  8. 【HDOJ】1098 Ignatius's puzzle

    数学归纳法,得证只需求得使18+ka被64整除的a.且a不超过65. #include <stdio.h> int main() { int i, j, k; while (scanf(& ...

  9. 数学: HDU1098 Ignatius's puzzle

    Ignatius's puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  10. Ignatius's puzzle

    Ignatius's puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

随机推荐

  1. arm指令版本

    arm-linux-readelf 查看 armeabi Tag_CPU_name: "5TE" Tag_CPU_arch: v5TE armeabi-v7a Tag_CPU_na ...

  2. Go 语言简介(下)— 特性

    希望你看到这篇文章的时候还是在公交车和地铁上正在上下班的时间,我希望我的这篇文章可以让你利用这段时间了解一门语言.当然,希望你不会因为看我的文章而错过站.呵呵. 如果你还不了解Go语言的语法,还请你移 ...

  3. php扩展开发笔记(2)多个源代码文件的配置和编译

    我们在开发过程中,为了代码得可读性和易维护性,肯定是须要多个代码文件的,而不不过通过 ext_skel 生成得骨架文件. 这篇文章主要介绍下.多个代码文件的时候.我们须要注意什么,以及怎么做. 我的代 ...

  4. android 中的 window,view,activity具体关系

    通过讨论这个问题,我们能够见识到google是对面向对象模式的理解,能够理解android底层的一些调用.这也是一道很常见的面试题. 我们这篇文章就来解决这四个问题: Android  中view的显 ...

  5. 图片文字OCR识别-tesseract-ocr

    帮助文件:https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc 下载地址:https://github. ...

  6. word图片自动编号与引用(转)

    http://blog.csdn.net/hunauchenym/article/details/5915616 用Word时,可能会遇到文中使用了大量的图片的情况,这时,若采用手动为图片编号的方法, ...

  7. COM的一些基本概念

      Windows lets you share code at the binary level using DLLs. After all, that's how Windows apps fun ...

  8. ystem.Windows.Forms.SplitContainer : ContainerControl, ISupportInitialize

    #region 程序集 System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...

  9. 直接修改class文件内容即使是文本会导致App异常,正确方式是修改java再用生成的class替换掉原有的class

    前几天来了个小任务,把某项目中某人的邮件地址改了下. 由于对项目不熟悉,于是采用find方式找出app中所有包含某人邮件地址的文件都找出来了. xml,properties大约三四个,还有两个clas ...

  10. 劣质代码评析——《写给大家看的C语言书(第2版)》附录B之21点程序(八)

    [重构](续) 牌的表示: 一副牌有52张,可用一整数数组描述.但是由于在游戏过程中牌数在不断减少,所以用一表示剩余张数的整数和一整数数组共同描述.C99支持一种变量长度数组,但用在这里并没有什么特别 ...