有关数论方面的题要仔细阅读,分析公式。

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;输入任意一个数k,是否存在一个数a,对任意x都能使得f(x)能被65整出;输入a;

解题报告:假设存在这个数a ,因为对于任意x方程都成立,所以,当x=1时f(x)=18+ka;有因为f(x)能被65整出,这可得出f(x)=n*65;

即:18+ka=n*65;若该方程有整数解则说明假设成立。

所以,只要找到a,使得18+k*a能被65整除,也就解决了这个题目.

 #include<iostream>
using namespace std;
int main()
{
int k,i;
while(scanf("%d",&k)!=EOF)
{
for(i=;i<=;i++)
{
if((+k*i)%==){printf("%d\n",i);break;}
}
if(i>)printf("no\n");
}
return ;
}
 

hdu 1098 Ignatius's puzz的更多相关文章

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

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

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

  3. HDU - 1098 - Ignatius's puzzle - ax+by=c

    http://acm.hdu.edu.cn/showproblem.php?pid=1098 其实一开始猜测只要验证x=1的时候就行了,但是不知道怎么证明. 题解表示用数学归纳法,假设f(x)成立,证 ...

  4. 题解报告:hdu 1098 Ignatius's puzzle

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

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

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

  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. ACM: HDU 1028 Ignatius and the Princess III-DP

     HDU 1028 Ignatius and the Princess III Time Limit:1000MS     Memory Limit:32768KB     64bit IO Form ...

  8. hdu 1028 Ignatius and the Princess III 简单dp

    题目链接:hdu 1028 Ignatius and the Princess III 题意:对于给定的n,问有多少种组成方式 思路:dp[i][j],i表示要求的数,j表示组成i的最大值,最后答案是 ...

  9. HDU 1029 Ignatius and the Princess IV --- 水题

    HDU 1029 题目大意:给定数字n(n <= 999999 且n为奇数 )以及n个数,找出至少出现(n+1)/2次的数 解题思路:n个数遍历过去,可以用一个map(也可以用数组)记录每个数出 ...

随机推荐

  1. [Django] Base class in the model layer

    In the model layer, the Model class is the base class while the ModelBase class is metaclass.

  2. 在JBuilder8中使用ANT

    在JBuilder8中使用ANT                                                            作者:翁驰原    在JBuilder8中,Ap ...

  3. (转)maven设置内存

    Windows环境中 找到文件%M2_HOME%\bin\mvn.bat ,这就是启动Maven的脚本文件,在该文件中你能看到有一行注释为: @REM set MAVEN_OPTS=-Xdebug - ...

  4. IT忍者神龟之使用 PowerDesigner

    1. 启动 PowerDesigner 新建物理数据模型 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdmlweWhk/font/5a6L5L2T/fon ...

  5. CodeForces 484A Bits

    意甲冠军: 10000询价  每次查询输入L和R(10^18)  在区间的二进制输出指示1大多数数字  1个数同样输出最小的 思路: YY一下  认为后几位全是1的时候能保证1的个数多  那么怎样构造 ...

  6. charles抓包

    charles使用教程指南 charles使用教程指南 前言 移动APP抓包 PC端抓包 查看模式 其他功能 问题汇总 1. 前言: Charles是一款抓包修改工具,相比起burp,charles具 ...

  7. Ozmosis实现BIOS直接启动Yosemite,基本完美

    我的主板是 技嘉 z97 d3h,共享一下我制作好的  Ozmosis

  8. 两次fclose引发的血案

    代码本来在Windows上开发的,功能基本完毕迁移到Linux上,结果一跑,乱象重重.这里只列出两个.   一崩溃: /mnt/diskc/db/app/bin/mysqld: double free ...

  9. Asp.net中Postback及Callback

    我们知道,在默认的情况下,当我们点击Asp.net Page中的一个服务器Button时(默认其实是Submit Form),会导致Page被Recreated,这个过程我们称之为Postback,它 ...

  10. oracle学习笔记(转)

    命令行操作:打开服务: services.msc启动Oracle: net start OracleOraHome92TNSListener     net start OracleService实例 ...