HDU-4618 Palindrome Sub-Array 暴力枚举】的更多相关文章

Palindrome Sub-Array 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=4618 Description A palindrome sequence is a sequence which is as same as its reversed order. For example, 1 2 3 2 1 is a palindrome sequence, but 1 2 3 2 2 is not. Given a 2-D array…
题目 这是一道可以暴力枚举的水题. //以下两个都可以ac,其实差不多一样,呵呵 //1: //4 wei shu #include<stdio.h> struct tt { ],b[],c[]; }e[]; int main() { ],mark[],yi,flag,a1,a2,a3,a4; while(scanf("%d",&n),n) { ;i<n;i++) { scanf("%s%s%s",e[i].a,e[i].b,e[i].c)…
Crazy Tank Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4562    Accepted Submission(s): 902 Problem Description Crazy Tank was a famous game about ten years ago. Every child liked it. Time f…
又一发吐血ac,,,再次明白了用函数(代码重用)和思路清晰的重要性. 11779687 2014-10-02 20:57:53 Accepted 4770 0MS 496K 2976 B G++ czy Lights Against Dudely Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1360    Accepted Subm…
Palindrome Sub-Array Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 173    Accepted Submission(s): 80 Problem Description A palindrome sequence is a sequence which is as same as its reversed or…
http://acm.hdu.edu.cn/showproblem.php?pid=4618 直接DP+记忆化 虽然时间复杂度看起来是300^4 但实际执行起来要远远小于这个值 所有可以水过 代码: #include<iostream> #include<cstdio> #include<string> #include<cstring> #include<cmath> #include<set> #include<map>…
HDU 4930 Fighting the Landlords 题目链接 题意:就是题中那几种牌型.假设先手能一步走完.或者一步让后手无法管上,就赢 思路:先枚举出两个人全部可能的牌型的最大值.然后再去推断就可以 代码: #include <cstdio> #include <cstring> #include <algorithm> using namespace std; struct Player { int rank[15]; } p1, p2; int t,…
题目链接 我还是图样啊....比赛的时候没敢暴力去搜... #include <cstdio> #include <cstdlib> #include <cstring> #include <map> #include <ctime> #include <cmath> using namespace std; #define LL __int64 ][][]; ][]; int n,m; int dfs(int x,int y,int…
题意:给定 13 张麻将牌,问你是不是“听”牌,如果是输出“听”哪张. 析:这个题,很明显的暴力,就是在原来的基础上再放上一张牌,看看是不是能胡,想法很简单,也比较好实现,结果就是TLE,一直TLE,这不科学啊... 好不容易写出来的,竟然TLE...心痛.就是先确定一个将牌,然后再对刻子和顺子进行分析,其实是要剪枝的,就是在如果有1张或者两张牌,而你又不能构成刻子的时候,就要返回false,因为这就已经没解了. 这一个剪枝,就AC了. 代码如下: #pragma comment(linker,…
题意:... 析:我们可以知道,a1+a2=b1,那么我们可以枚举a1,那么a2就有了,并且a1+a3=b2,所以a3就有了,我们再从把里面的剩下的数两两相加,并从b数组中去掉, 那么剩下的最小的就是a4,然后依次可以求出a5,a6....由于a最大才是5000,并且保证有唯一解,那么找到一个就直接退出. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #incl…