Ignatius's puzzle

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

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

若对任意x成立,则当x=1时必然成立.若当x=1时成立,则对任意正整数x都成立.

观察题目中给出的式子可以看出每一项都有公因子x,所以f(x)必然是f(1)的x倍,若f(1)是65的倍数,则f(x)必然也是65的倍数.

#include<stdio.h>
int main()
{
int k;
while (scanf("%d",&k)!=EOF)
{
if (k== || (k%!= && k%!= && k%!=))
{
for (int i=;;i++)
if ((+k*i)%==)
{
printf("%d\n",i);
break;
}
}
else printf("no\n");
}
return ;
}

Ignatius's puzzle的更多相关文章

  1. HDUOJ-----1098 Ignatius's puzzle

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

  2. 数学: HDU1098 Ignatius's puzzle

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

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

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

  4. HDOJ 1098 Ignatius's puzzle

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

  5. 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 因为 ...

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

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

  7. 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等 ...

  8. 【HDOJ】1098 Ignatius's puzzle

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

  9. HDU Ignatius's puzzle

    链接 [http://acm.hdu.edu.cn/showproblem.php?pid=1098] 分析: 数学归纳法 f(1) = 18 + ka; 假设f(x) = 5x^13+13x^5+k ...

随机推荐

  1. NYOJ题目1045看美女

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAskAAAK5CAIAAADCdSR7AAAgAElEQVR4nO3dP3Lbuv434HcT7r2Q1F

  2. hdu 2027统计元音

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2027 思路:主要考察gets()函数用法,能够接受输入的空格,如果用%s或是cin>>st ...

  3. JavaScript基础——实现循环

    循环是多次执行同一段代码的一种手段.当你需要在一个数组或对象集上重复执行相同的任务时,这是非常有用的. JavaScript提供执行for和while循环的功能. 1.while循环 JavaScri ...

  4. mysql可以用这种方式<<! 输入内容 ! 做成脚本

    以这种文件式做交接NB!!!!! [root@NB test]# mysql -uroot -p$passwd <<! > use mysql > select user,ho ...

  5. php重修

    阅读顺序: http://www.laruence.com/2008/08/11/147.html  深入浅出php http://www.laruence.com/2008/06/18/221.ht ...

  6. Install PIL on mac osX10.9

    follow this instruction: http://blog.csdn.net/liushuaikobe/article/details/8729652 and if you encoun ...

  7. scala中的抽象类

    scala中也有和java,c#类似的抽象类,抽象类会有部分实现,也有没有实现的方法定义.抽象类最大的特征是不能直接实例化.下面我们看个例子. abstract class Animal { def ...

  8. Quick-Cocos2dx 快速了解

    set_dev_envirment // */ // ]]> Cocos2dx快速了解 1. Quick-Cocos2dx 开发环境搭建 1.1. 官网: 1.2. Github: 1.3. s ...

  9. Android 图表绘制 achartengine 示例解析

    一. AChartEngine 简介 1. 项目地址 AChartEngine 简介 : AChartEngine 是 Android 平台的图表开发库, 能绘制 折线图, 饼图, 气泡图, 柱状图, ...

  10. 搭建ASP JSP运行环境

    搭建JSP 服务器 Java + HTML 的运行环境 服务端搭建ASP.NET运行环境