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. UVA 156 (13.08.04)

     Ananagrams  Most crossword puzzle fans are used to anagrams--groupsof words with the same letters i ...

  2. 基于JDK动态代理实现的接口链式调用(Fluent Interface)工具

    什么是链式接口(Fluent Interface) 根据wikipedia上的定义,Fluent interface是一种通过链式调用方法来完成方法的调用,其操作分为终结与中间操作两种.[1] 下面是 ...

  3. [Webpack] Externalize Dependencies to be Loaded via CDN with webpack

    We can separate our custom application code from the common libraries we leverage, such as React and ...

  4. 【Nodejs】nimble或async并不能保证程序串行执行,回调是回避不了的坑

    先看一段例程: //------------------------------- // 用于创建目录 //------------------------------- function creat ...

  5. 【nodejs】使用put方式向后端提交数据

    页面代码: <!DOCTYPE html> <html lang="utf-8"> <meta http-equiv="Content-Ty ...

  6. 如何解决Win7将任务栏程序自动分组的困扰

    Win7默认把任务栏程序自动分组,比如多个资源管理器窗口被分到一起,其实这挺让人恼火的,关键弊病是多出一个人工检查的步骤,这在操作繁忙时容易增加人的负担,不能按预定记忆处理. 还好微软也没把蠢事做绝, ...

  7. 在Win7上安装MySql5.2遇到Write configuration file的解决

    机器从XP翻新到Win7后,原有的环境也被清除了,因此找了个时间重新安装MySql. 以前轻车熟路的过程,在最后一环却卡住了,出现Write configuration file 错误. 以前从来没有 ...

  8. C#.NET常见问题(FAQ)-如何修改代码字体

    工具-选项-字体和颜色     更多教学视频和资料下载,欢迎关注以下信息: 我的优酷空间: http://i.youku.com/acetaohai123   我的在线论坛: http://csrob ...

  9. springboot项目启动报错

    启动springboot项目报错: NoSuchMethodError: org.apache.tomcat.util.scan.StandardJarScanner.setJarScanFilter ...

  10. Python编程-Office操作-操作Excel(上)

    首先,需要安装openpyxl库 http://openpyxl.readthedocs.org/en/default/ pyton 2.xpip install openpyxl python 3. ...