Ignatius's puzzle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 9934    Accepted Submission(s): 6959


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

Problem : 1098 ( Ignatius's puzzle )     Judge Status : Accepted

RunId : 21248504    Language : G++    Author : hnustwanghe

Code Render Status : Rendered By HDOJ G++ Code Render Version 0.01 Beta

#include<iostream>
#include<cstring>
#include<cstdio>

using namespace std;

int main(){
int k,i;
while(scanf("%d",&k)==1){
for(i=1;i<=65;i++)
if((18 + i*k)%65==0)
break;
if(i<=65)
printf("%d\n",i);
else
printf("no\n");
}
}

#include<iostream>
#include<cstring>
#include<cstdio>

using namespace
std; int main(){
int
k,i;
while(
scanf("%d",&k)==1){
for(
i=1;i<=65;i++)
if((
18 + i*k)%65==0)
break;
if(
i<=65)
printf("%d\n",i);
else

printf("no\n");
}
}

数学: HDU1098 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. Ignatius's puzzle

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

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

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

  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

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

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

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

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

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

  9. 【HDOJ】1098 Ignatius's puzzle

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

随机推荐

  1. PHP基础教程探讨一些php编程性能优化总结

      兄弟连PHP培训 小编最近在做php程序的性能优化,一些经过测试后发现的东西就先记录下来,以备后用. 首先对于一些反应慢的操作或页面要跟踪处理一下,可以使用webGrind的方式看一下主要问题出在 ...

  2. SpringBoot项目中,cookie的设置与销毁

    cookie的设置与销毁 1.设置cookie /** * 设置一个cookie * @param response HttpServletResponse * @param name cookie的 ...

  3. (69)Python异常处理与断言

    http://blog.csdn.net/pipisorry/article/details/21841883 断言 断言是一句必须等价于布尔真的判定;此外,发生异常也意味着表达式为假.这些工作类似于 ...

  4. PO,BO,VO和POJO的区别

    PO:persistent object 持久对象 1 .有时也被称为Data对象,对应数据库中的entity,可以简单认为一个PO对应数据库中的一条记录. 2 .在hibernate持久化框架中与i ...

  5. 2-gitblit添加项目,项目成员

    创建代码仓库,如下图所示, 然后填个项目的名称和描述即可点击保存. 用户也是,还是相同的位置,点击用户,而不是用户中心,创建用户也是填写用户名称和简称,最后对在旁边有个用户的权限,选择相应的代码仓库即 ...

  6. centos64位编译32位程序

    test.c #include <stdio.h> int main() { printf("sizeof long is %d\n",sizeof(long)); ; ...

  7. http://www.malware-traffic-analysis.net/2018/index.html

    http://www.malware-traffic-analysis.net/2018/index.html

  8. 为java类起别名

    <typeAliases> <!-- 1.typeAlias:为某个java类型起别名 type:指定要起别名的类型全类名;默认别名就是类名小写:employee alias:指定新 ...

  9. 使用xampp和HBuilder搭建php环境

    1.首先你的电脑里面要有两个软件  xampp 和 HBuilder xampp: HBuilder: 这两个软件都是免费的,在安装过程中也无需费力,只要设置好路径就行了. 在xampp安装过程中,需 ...

  10. C# .Net动态调用webService实现思路及代码

    加载: using System; using System.Collections.Generic; using System.Linq; using System.Web; using Syste ...