hdu1098:Ignatius's puzzle
来源:互联网 发布:java旅游管理项目描述 编辑:程序博客网 时间:2024/05/16 15:10
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".
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
111009999
Sample Output
22no43
题意就是给定k的值,求出最小的a,是的x为任何整数值时,方程的值总是能整除65
这是一道数学题
用数学归纳法
设f(x)能整除65
要证明f(x+1)能整除65的话就只需要证明f(x+1)-f(x)能整除65
用二项式分拆
因为常数是13的总能提出一个5的系数相乘,5的则能提出13相乘
所以前面的项必能被65整除,现在只许看后面的a*k了
所以最后只需证明18+a*k能否被65整除就行了
推出了这个就简单了
#include <stdio.h>int main(){ int k,a; while(~scanf("%d",&k)) { for(a = 1;a<=65;a++) { if((18+a*k)%65 == 0) { printf("%d\n",a); break; } } if(a>65) printf("no\n"); } return 0;}
- hdu1098 Ignatius's puzzle
- hdu1098:Ignatius's puzzle
- hdu1098-Ignatius's puzzle
- HDU1098 Ignatius's puzzle
- hdu1098 Ignatius's puzzle
- HDU1098 Ignatius's puzzle
- hdu1098 Ignatius's puzzle
- (hdu1098)Ignatius's puzzle
- HDU1098 Ignatius's puzzle 【数论】
- 数学: HDU1098 Ignatius's puzzle
- HDU1098 Ignatius's puzzle(数学归纳法求解)(数论)
- Ignatius's puzzle
- Ignatius's puzzle
- Ignatius's puzzle
- Ignatius's puzzle
- Ignatius's puzzle
- hdu1068 Ignatius's puzzle
- Ignatius's puzzle HDU
- MySQL通过命令行存储中文
- POJ 1422 最小路径覆盖
- oracle_时间函数
- 网络编程中的超时检测
- Linux下Qt 安装及环境变量设置(Ubuntu 10.04)
- hdu1098:Ignatius's puzzle
- 排序算法---选择排序
- ORACLE_CMD命令(最全的)
- 一路向北,是否可以不回头?
- C语言const修饰符探秘
- php知识盲点
- 最大子段和问题,最大子矩阵和问题,最大m子段和问题
- Oracle 11G在RHEL 5.3上的安装文档
- D-separation 2013/4/21 0:59