Ignatius's puzzle
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的更多相关文章
- HDUOJ-----1098 Ignatius's puzzle
Ignatius's puzzle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- 数学: HDU1098 Ignatius's puzzle
Ignatius's puzzle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- 数学--数论--HDU 1098 Ignatius's puzzle (费马小定理+打表)
Ignatius's puzzle Problem Description Ignatius is poor at math,he falls across a puzzle problem,so h ...
- HDOJ 1098 Ignatius's puzzle
Problem Description Ignatius is poor at math,he falls across a puzzle problem,so he has no choice bu ...
- 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 因为 ...
- HDU 1098 Ignatius's puzzle(数学归纳)
以下引用自http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=8466&messageid=2&deep=1 题意以 ...
- 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等 ...
- 【HDOJ】1098 Ignatius's puzzle
数学归纳法,得证只需求得使18+ka被64整除的a.且a不超过65. #include <stdio.h> int main() { int i, j, k; while (scanf(& ...
- HDU Ignatius's puzzle
链接 [http://acm.hdu.edu.cn/showproblem.php?pid=1098] 分析: 数学归纳法 f(1) = 18 + ka; 假设f(x) = 5x^13+13x^5+k ...
随机推荐
- UbuntuLinux安装Mysql
1.安装Mysql5.7 方法:手动安装5.7 One: $ wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb 下载 ...
- uitableviewcell cell.accessoryType 右箭头
实现右侧的小灰色箭头 只要将cell的accessoryType属性设置为 UITableViewCellAccessoryDisclosureIndicator就可以了. 代码为:cell.acc ...
- 三、jQuery--Ajax基础--Ajax全接触--Ajax在JS中的应用
Ajax的全称:Asynchronous JavaScript And XML(异步的 JavaScript 和 XML). Ajax不是某种编程语言,是一种在无需重新加载整个网页的情况下能够更新部分 ...
- linux cpuInfo
转自:http://blog.csdn.net/lgstudyvc/article/details/7889364 /proc/cpuinfo文件分析 在Linux系统中,提供了proc文件系统显 ...
- Linux内核驱动之GPIO子系统(一)GPIO的使用
转自:http://blog.csdn.net/mirkerson/article/details/8464290 一 概述 Linux内核中gpio是最简单,最常用的资源(和 interrupt , ...
- JAVA基础学习之final关键字、遍历集合、日期类对象的使用、Math类对象的使用、Runtime类对象的使用、时间对象Date(两个日期相减)(5)
1.final关键字和.net中的const关键字一样,是常量的修饰符,但是final还可以修饰类.方法.写法规范:常量所有字母都大写,多个单词中间用 "_"连接. 2.遍历集合A ...
- python中的Iterable, Iterator,生成器概念
https://nychent.github.io/articles/2016-05/about-generator.cn 这个深刻 谈起Generator, 与之相关的的概念有 - {list, s ...
- 设计工具 -uml
- hdu 4046 2011北京赛区网络赛G 线段树 ***
还带这么做的,卧槽,15分钟就被A了的题,居然没搞出来 若某位是1,则前两个为wb,这位就是w #include<cstdio> #include<cstring> #defi ...
- C语言中的位操作(14)--反转比特位
本篇文章主要讲述几种反转比特位的方法: 将一个32位数:abcd efgh 转置为hgfe dcba 1.常规方法 unsigned int v; // 目标待转置数 unsigned int r = ...