水题
文章平均质量分 67
azhuge233
Keep ya head up,legs closed,eyes open.
展开
-
HDU 1431 素数回文
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1431此题用无耻法:#include using namespace std;__int64 ans[790]={ 5, 7, 11, 101, 131, 151, 181, 191, 313, 353原创 2016-04-27 16:52:45 · 418 阅读 · 0 评论 -
2016"百度之星" - 资格赛(Astar Round1)
Problem Description度熊所居住的 D 国,是一个完全尊重人权的国度。以至于这个国家的所有人命名自己的名字都非常奇怪。一个人的名字由若干个字符组成,同样的,这些字符的全排列的结果中的每一个字符串,也都是这个人的名字。例如,如果一个人名字是 ACM,那么 AMC, CAM, MAC, MCA, 等也都是这个人的名字。在这个国家中,没有两个名字相同的人。度熊想统原创 2016-05-14 22:34:13 · 181 阅读 · 0 评论 -
HDU 2212 DFS (伪·DFS)
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=2212本来是想练下DFS的,结果被题目标题坑了(HDU也搞标题党?),更坑的是题还这么水直接输出四个数,那么大的范围只考察这四个数#include using namespace std;int main(){ printf("1\n2\n145\n40原创 2016-05-04 20:12:47 · 308 阅读 · 0 评论 -
HDU 1164 Eddy's research I
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1164题意 : 将任意一个数拆成多个素数相乘的形式(素数可重复)水题,本来想素数表,发现有点脱裤子放屁的意味= =#include using namespace std;int main(){ int n,a[21]; while(cin>>n原创 2016-05-06 21:33:56 · 222 阅读 · 0 评论 -
HDU 2029 Palindromes _easy version
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=2029栈的运用 //不用栈也可以当时把奇数和偶数分开写了,有点啰嗦,其实非常简单#include #include #include using namespace std;int main(){ int T; cin>>T; while(T--)原创 2016-05-06 21:53:43 · 221 阅读 · 0 评论 -
HDU 2163 Palindromes
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=2163还是判断回文,栈,输入“STOP”时停止#include #include #include #include using namespace std;int main(){ int k=1; char str[53]; while(ci原创 2016-05-06 21:57:51 · 218 阅读 · 0 评论 -
HDU 1397 Goldbach's Conjecture
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1397题意:哥德巴赫猜想,这次是求 给定偶数 有多少种 素数和,注意同一组数算一次(例如 6=2+3 和 6=3+2 算一个)素数表,循环到n/2即可#include #include using namespace std;bool prime[32770];in原创 2016-05-07 15:23:28 · 437 阅读 · 0 评论 -
HDU 1128 POJ 1316 Self Numbers
HDU链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1128POJ链接 : http://poj.org/problem?id=1316对于每个正整数n,定义运算方式d(n)为:n+n的各位数字,得到新的数要求我们找到不存在于d(n)里的数比如1~10内,1+1=2,2+2=4,4+4=8,3+3=6,5+5=10,那原创 2016-05-07 16:04:25 · 235 阅读 · 0 评论 -
HDU A+B类型
还没全做完,先上做完的A+B problem链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1000#include void main(){ int x,y; while(scanf("%d%d",&x,&y)!=EOF) { printf("%d\n",x+y); }}A原创 2016-05-07 20:41:43 · 318 阅读 · 0 评论 -
HDU 2094 产生冠军
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=2094因为冠军一定一次都没输过,所以判断总人数和输过的人数是否相差1即可C++ STL set容器,set自带去重,省去判重的麻烦#include #include using namespace std;int main(){ int n; while(ci原创 2016-05-09 10:19:51 · 215 阅读 · 0 评论 -
HDU 5538 House Building
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5538题意:给你一个矩阵表示房子的俯视图,数字是几就代表此处有几块砖,要求出房子的表面积,不算底面首先先把俯视图的面积加起来,再对每个数字的上下左右做差,有高度差就有表面积#include #include using namespace std;int dir[4原创 2016-07-13 11:08:51 · 214 阅读 · 0 评论 -
HDU 2205 亲和串
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=2205只要把第一个字符串复制两遍,在其中找字串2的字串即可,水过#include #include #define MAX 100001using namespace std;char str1[MAX],str2[MAX],str3[MAX*2];int main()原创 2016-05-03 22:05:32 · 316 阅读 · 0 评论 -
HDU 1035 Robot Motion
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1035题意 : 一个机器人在图上走,图上的E,W,N,S分别代表四个方向——右,左,上,下最终机器人有两种下场:1、进入一个循环;2、走出图走出图的话输出总共的步数,进入循环的话输出进入循环前的步数和循环的步数简单模拟(DFS),used数组来记录步数#include原创 2016-05-13 12:43:18 · 240 阅读 · 0 评论 -
HDU 4548 美素数
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=4548美素数:本身是素数,并且各位数字的和也是素数打出素数表,再对各位数字求和,访问素数表考察各位和是否为素数详见代码:#include #include #define MAX 1000001using namespace std;bool prime[原创 2016-04-27 17:43:30 · 284 阅读 · 0 评论 -
HDU 2521 反素数
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=2521首先,了解一下反素数 :对于任何正整数x,其约数的个数记做g(x).例如g(1)=1,g(6)=4.如果某个正整数x满足:对于任意i(0也就是说,有一个数,它的约数的个数 比 比它小的数的约数个数 都要大,那么 这个数 就是 反素数(若理解有误请指正)但是本题似乎跟反素数没原创 2016-04-27 17:19:19 · 239 阅读 · 0 评论 -
HDU 1262 寻找素数对
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1262#include #include using namespace std;bool is_prime(int n) //素数筛{ for(int i=2; i<=sqrt(n); i++) if(!(n%i)) return 0; return 1;}int原创 2016-04-27 17:04:28 · 211 阅读 · 0 评论 -
HDU 2012 判断素数
链接 :http://acm.hdu.edu.cn/showproblem.php?pid=2012最水的素数题,打表也可以#include #include using namespace std;bool prime(int n){ for(int i=2;i<=sqrt(n);i++) if(!(n%i)) return 0;原创 2016-04-27 18:11:10 · 268 阅读 · 0 评论 -
HDU 2098 分拆素数和
链接 :http://acm.hdu.edu.cn/showproblem.php?pid=2098同2012,加个判断#include #include using namespace std;bool is_prime(int n){ for(int i=2;i<=sqrt(n);i++) if(!(n%i)) return 0;原创 2016-04-27 18:14:02 · 277 阅读 · 0 评论 -
HDU 2136 Largest prime factor
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=2136题意:给你一个数n,输出这个数的最大素因子在素数表的位置(或在素数表中找出这个数最大的因子,输出其位置)P.s. cin,cout超时,可能方法本身就不太好吧#include #include #define MAX 1000001using namespace std;原创 2016-04-27 18:29:49 · 233 阅读 · 0 评论 -
HDU 1008 Elevator
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1008题意:一电梯,上一层耗时6s,下一层耗时4s,每到达指定的一层停留5s,给出一串楼层数,问按此顺序运行下来的总耗时水题,主要注意楼层没变也要+5s#include using namespace std;int main(){ int n; whi原创 2016-05-11 15:18:29 · 228 阅读 · 0 评论 -
HDU 1005 Number Sequence
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=1005题意 : 给定a,b,n, 存在下面的序列 : s[1]=s[2]=1,s[n]=(a*s[n-1]+b*s[n-2])%7,计算出第n项强行算的话肯定会耗时耗空间,找规律,每7个数取模,貌似是7个一循环,但是暴力后得知7*7=49一循环#include using原创 2016-05-11 15:53:31 · 176 阅读 · 0 评论 -
HDU 5019 Revenge of GCD
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=5019题意:输出x和y的第k个最大公约数先找出x和y的最大公约数,再对公约数找约数#include #include using namespace std;__int64 s[1000001];__int64 gcd(__int64 a,__int64 b)原创 2016-05-11 19:38:41 · 298 阅读 · 0 评论 -
HDU 2564 词组缩写
链接 : http://acm.hdu.edu.cn/showproblem.php?pid=2564水题#include #include #include using namespace std;int main(){ char str[150]; int T; scanf("%d%*c",&T); while(T-- && gets(原创 2016-05-12 11:04:15 · 647 阅读 · 0 评论 -
HDU 5327 Olympiad
链接 :http://acm.hdu.edu.cn/showproblem.php?pid=5327题意:美丽数?漂亮数 ???Excuse me???一个数,它的各位数字都不相同,称之美数(这个还能听),给你一个区间,要求输出其间的美数的个数打表#include #include #define MAX 100000using namespace std;in原创 2016-07-13 11:14:54 · 222 阅读 · 0 评论