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

本题大意是要求对任意输入的K,找到一个最小的a,使得表达式都能整除65.

自己的做法是在一定范围内去找,1-10000之间找到当x=1时能够整除65的,然后在这基础上让x在1-10000之间去循环整除,如果能满足所有条件那么就找到了这个最小的a。否则就输出no。程序如下,已经AC....

 /*******************************************************
杭电acm 1098 已经AC
*******************************************************/ #include <iostream>
#include <cmath>
#define fx 5*pow(x,13)+13*pow(x,5)+k*a*x
using namespace std; int main(void)
{
int x=;
int k;
int a=;
//long int fx;
int mark=;
int flag=;
while(scanf("%d",&k)!=EOF)
{
mark=;
flag=;
//fx=5*pow(x,13)+13*pow(x,5)+k*a*x;
for(a=;a<;a++)
{
if((+k*a)%==)
{
for(x=;x<;x++)
{
if(fx%==)
continue;
else {break;mark=;}
} }
if(((+k*a)%==)&&mark==)
{flag=;break;}
}
if(mark&&flag)
{
cout<<a<<endl;
}
else cout<<"no"<<endl; }
return ;
}

杭电acm 1098题的更多相关文章

  1. 杭电acm 1076题

    水题,一个求闰年的题目,复习一下闰年的求法.... 1,如果能被4整除但不能被100整除的是闰年 2,能被400整除的是闰年 题目大意是:给定一个开始年份T以及一个正数N,要求求出从T开始,到了哪一年 ...

  2. 杭电acm 1037题

    本题应该是迄今为止最为简单的一道题,只有一组输入,输出也简单.... /****************************************** 杭电acm 1037题 已AC ***** ...

  3. 杭电acm 1038题

    本题比较简单,但是需要掌握几个小技巧,先上代码 /************************************* 杭电ACM 1038题,已AC ********************* ...

  4. 杭电acm 1049题

    一道水题..... 大意是一条1inch的虫子在一个n inch的盒子的底部,有足够的能够每一分钟往上爬u inch,但是需要休息一分钟,这期间会往下掉d inch,虫子爬到盒子口即认为结束.要求计算 ...

  5. 杭电acm 1033题

    Problem Description For products that are wrapped in small packings it is necessary that the sheet o ...

  6. 杭电ACM刷题(1):1002,A + B Problem II 标签: acmc语言 2017-05-07 15:35 139人阅读 评

    最近忙于考试复习,没有多少可供自己安排的时间,所以我利用复习之余的空闲时间去刷刷杭电acm的题目,也当对自己编程能力的锻炼吧. Problem Description I have a very si ...

  7. 杭电acm刷题顺序

    最近兴趣来了,闲暇之余,回顾大学期间刷过的杭电acm那些入门级别的题,以此巩固基础知识! 以下参考刷题顺序,避免入坑 原文传送门:https://blog.csdn.net/liuqiyao_01/a ...

  8. 杭电acm 1015题

    马上要找工作了,锻炼下自己的写程序能力,不多说,上代码 /********************杭电acm 1015 已AC 在这个程序里,使用穷举法来实现,但是输出顺序需要安装字典的最大 来输出 ...

  9. 杭电acm 1040题

    本题是一个非常简单的升序排序题目,但那时在做的时候把题目看错了,导致花费了大量的时间来检查为什么WA,最后发现题目看错了..... /********************************* ...

随机推荐

  1. HDR(High Dynamic Range) - 高动态范围

    1. Dynamic Range 动态范围是指一个场景的最亮和最暗部分之间的相对比值   2. Tone-mapping 现实真正存在的亮度差,即最亮的物体亮度和最暗的物体亮度之比为 , 而人类的眼睛 ...

  2. 0423 hashlib模块、logging模块、configparse模块、collections模块

    一.hashlib模块补充 1,密文验证 import hashlib #引入模块 m =hashlib.md5() # 创建了一个md5算法的对象 m.update(b') print(m.hexd ...

  3. jQuery自定义美化下拉框

    在线演示 本地下载

  4. ansible普通用户su切换问题

    在现网应用中,安全加固后的主机是不允许直接以root用户登陆的,而很多命令又需要root用户来执行,在不改造现网的情况下.希望通过一个普通用户先登陆,再su切到root执行.而且每台主机的普通用户和r ...

  5. Android系统Recovery模式的工作原理【转】

    本文转载自:http://blog.csdn.net/mu0206mu/article/details/7464987  在使用update.zip包升级时怎样从主系统(main system)重启进 ...

  6. 统计apachelog各访问状态个数(使用MapReduce)

    统计日志文件中各访问状态的个数. 1.将日志数据上传到hdfs 路径 /mapreduce/data/apachelog/in 中 内容如下 ::::::: - - [/Feb/::: +] :::: ...

  7. virtualbox 相关操作

    关闭 vboxmanage controlvm nenew poweroff 打开,后台运行 vboxmanage startvm centos0 --type headless 复制虚拟机镜像VBo ...

  8. java读取pdf文档

    import java.io.*;import org.pdfbox.pdmodel.PDDocument;import org.pdfbox.pdfparser.PDFParser;import o ...

  9. C++(四)— 字符串、数字翻转3种方法

    1.使用algorithm中的reverse函数,string类型字符建议使用. #include <iostream> #include <string> #include ...

  10. vuex使用mapActions报错解决办法

    先贴上报错: vuex2增加了mapGetters和mapActions的方法,借助stage2的Object Rest Operator 所在通过 methods:{ ...mapActions([ ...