hdu1015】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1015 代码1: #include<stdio.h>//hdu1015 #include<string.h> #include<math.h> #include<stdlib.h> double tg; int len; char a[20],b[20];//a存输入的字母,从0开始存. b存目标字母,从1开始. int cmp(const void*a, con…
hdu1015:给定一串可用序列值,每个字符映射到一个1-26之间的整数,选择五个有序数使得满足 a-b2+c3-d4+e5=target. #include<iostream> #include<cstdio> #include<string.h> #include<algorithm> #include<map> using namespace std; int target; ]; ]; map<char,int>mp; ],c…
http://acm.hdu.edu.cn/showproblem.php?pid=1010 这题就是问能不能在t时刻走到门口,不能用bfs的原因大概是可能不一定是最短路路径吧. 但是这题要过除了细心外,还需要强力的剪枝. 奇偶性剪枝:参考 http://www.cppblog.com/Geek/archive/2010/04/26/113615.html #include <iostream> #include <cstring> #include <cstdio>…
Safecracker Problem Description === Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and his factory, were des…
Problem Description === Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with Klein and his factory, were destroyed in Wo…
#include <stdio.h>#include <string.h>#include <stdlib.h> int cmp(void* a, void* b){ return *((char*)a)-*((char*)b);} void solve(int t, char* dic){ int v,w,x,y,z,l; int p[12]; l = strlen(dic); qsort((void*)dic,l,sizeof(char),cmp); for(v=0…
http://acm.hdu.edu.cn/showproblem.php?pid=1015 Safecracker Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6327    Accepted Submission(s): 3160 Problem Description === Op tech briefing, 2002/11…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1015 因为之前看了下刘汝佳的<算法入门经典>,就用类似打印全排列,八皇后的方法做.本以为不难,结果却被两个细节搞了很久.1.在递归函数的出口没有把sum设为原来的值,结果导致当不符合条件时sum一直加下去. 2.pow() 函数的返回值是浮点型,而我一开始将sum和tg定为int类型,导致比较是否相等时出现了误差(其实自己不太清楚这方面的东西) 下面是代码: #include<stdio.h…
题意是A-Z对应1-26,然后给个目标数字和字符串,看看字符串里的某5个字符的组合能不能使v - w^2 + x^3 - y^4 + z^5 = target等式成立,其实多写几个循环也可以达到目的,不过应该会超时,所以还是dfs. result数组保存最后5个数字,注意要用sort先降序排序,sort默认升序,得加个compare函数,因为本题可能有多解,人家要字典序最大的.num1数组是用来标记该数字被用过没有,注意要memset一下(忘了memset于是每次只能对一组数据也是醉了). #i…
ACM训练计划建议 From:freecode#  Date:2015/5/20 前言: 老师要我们整理一份训练计划给下一届的学弟学妹们,整理出来了,费了不少笔墨,就也将它放到博客园上供大家参考. 菜鸟之作,大牛勿喷,如有不当或补充之处,欢迎指出. 本建议书分为三个阶段,大一.大二.大三.大四暂没整理,一方面是大四要面临考验和找工作的问题,坚持继续acm的很少,另一方面,本人还没大四…… 下面以个人经验分析一下这三个阶段建议学习的内容和具体的训练计划. 正文: 大一(第一阶段): 大一是时间最充…