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. yaf 生成项目

    yaf 生成项目 yaf下载安装地址 https://github.com/laruence/yaf/releases 生成项目 一定需要在安装yaf的php版本环境中执行该语句 sudo /usr/ ...

  2. css-js-弹出层

    HTML: <!-- 弹出层 --> <div class="popwindow" > <div class="pop" id=& ...

  3. JS几种数组遍历方式总结

    JS数组遍历的几种方式 JS数组遍历,基本就是for,forin,foreach,forof,map等等一些方法,以下介绍几种本文分析用到的数组遍历方式以及进行性能分析对比 第一种:普通for循环 代 ...

  4. select客户端模型封装——回调方式快速建立客户端

    SockClient.h #pragma once #include<functional> #define _WINDOWS #ifdef _WINDOWS #define _WINSO ...

  5. C++ 打印XPS文档

    CoInitializeEx(, COINIT_MULTITHREADED); IXpsOMObjectFactory *xpsFactory; HRESULT hr = CoCreateInstan ...

  6. asp.net ajax传递Json给aspx.cs后台 webmethod方法传递json

    1.提取一个向后台写入数据的方法 ///向后台cs页面请求数据的方法 function myPost(url,data,func) { $.ajax({ type: "post", ...

  7. lines

    lines Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submi ...

  8. Proxy-代理器(预计vue3.0实现双向绑定的方式)

    todo 常见的基于数据劫持的双向绑定有两种实现,一个是目前Vue在用的Object.defineProperty,另一个是ES2015中新增的Proxy,而Vue的作者宣称将在Vue3.0版本后加入 ...

  9. LBS 基于位置的服务

    LBS (Location Based Services)基于位置的服务 基于位置的服务,它是通过电信移动运营商的无线电通讯网络(如GSM网.CDMA网)或外部定位方式(如GPS)获取移动终端用户的位 ...

  10. 阶段3 1.Mybatis_12.Mybatis注解开发_7 Mybatis注解开发一对多的查询配置

    一对多的配置,一个用户对应多个账户 需要在Accout里面增加根据用户的uid查询的方法 在user里面指定子一对多的查询配置 换行显示 测试 把这里注销掉.测试延迟加载,代码注释掉后,延迟加载就没有 ...