- 博客(125)
- 收藏
- 关注
原创 乌龟棋
1. 子问题描述:用dp[i][j][x][y] 表示当4种卡片剩余量分别是i,j,x,y 的时候,获得的最大积分。(设4种卡片总量分别为a,b,c,d) 2. 状态迁移方程:dp[i][j][x][y]=max(dp[i+1][j][x][y], dp[i][j+1][x][y], dp[i][j][x+1][y], dp[i][j][x][y+1])+ chess[(a-i)+(
2014-04-29 07:41:16 845
原创 codeforces 401A Vanya and Cards
题目链接:http://codeforces.com/problemset/problem/401/A
2014-04-04 23:14:38 817
原创 Who's in the Middle(简单快排)
题目链接:http://poj.org/problem?id=2388 题目意思:有一些牛,产了一些奶,找一个中间数,该数钱面的都小,。后面的都大,也即找一个钟位数。 简单快排,但要注意结构体排序的写法! 代码: #include #include using namespace std; typedef struct Node{ int i; int n
2014-03-09 15:57:13 957
原创 Ultra-QuickSort(归并排序+逆序数)
题目链接:http://poj.org/problem?id=2299 题目意思:给你一个离散的数列,然后要排序成有序的序列,但每次只能在相邻的两个之间交换,问你要交换的最小次数。 这是简单的归并排序题, 给出归并排序的模板: void merge(int low, int mid, int high) { int i,j,k; i=k=low; j
2014-03-09 15:49:39 2136 1
原创 nefu 2 猜想(素数&&筛选)
题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemshow.php?problem_id=2 题目中文题目,很好理解,就是要判断一个偶数有多少对素数相加之和为该偶数。 只要把素数全部标记就好了。 #include #include #include #include using namespace std; const int m
2014-02-09 14:07:14 623
原创 ZOJ 2541 Goods Transportation
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1523 题目大意:用传送带,传送物品,有m个起点,n个目的的,要你计算最大的物品传送量和最少的花费。 贪心,是贪心吗?应该是的。 #include using namespace std; int Sc[10005]; int De[10
2014-02-07 15:12:35 959
原创 ZOJ 3058 The War(简单贪心)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4351 题目大意:有N个士兵,每个士兵所能拿动的武器为【minWi, maxWi】,为了能打胜战,要尽可能多的拿到武器。问你如何能拿到更多。 其实这题和那个活动时间安排极其相似。比较简单,排序就好了。#include #include #include #i
2014-02-07 12:08:57 809
原创 hdoj 畅通工程(简单最小生成树问题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1863 题目为中文题目,简单易懂,从题目就可以很容易的知道是最小生成树,也可以说就是纯模板题。但还是需要了解和掌握模板。 #include #include #include using namespace std; const int MAXN=0x3f3f3f3
2014-02-06 19:27:44 704
原创 codeforces Strings of Power
题目链接:http://codeforces.com/problemset/problem/318/B 题目大意:字符串匹配问题。找heavy和metal搭配的总数。 #include #include #include using namespace std; int main(void) { string str; int i; cin>>str;
2014-02-05 16:40:35 751
原创 codeforces Way Too Long Words
题目链接:http://codeforces.com/problemset/problem/71/A 题目大意:给你一个字符串,若长度小于等于10,原样输出,反之,输出首字母和字符串长度-2和最后一个字母。 #include #include #include using namespace std; char ch[105]; int main(void) {
2014-02-05 15:01:43 883
原创 codeforces Fox and Box Accumulation
http://codeforces.com/problemset/problem/388/A 题目大意:有n个箱子,每个箱子都是同宽等高的,但承受压力的能力不同,压力的大小一箱子的表面第一个箱子的大小有关,与表面第2第3.....均无关,要把这些箱子分堆,看看能分成多少堆。 #include #include using namespace std; int n; int A
2014-02-05 11:29:33 902
原创 codeforces Fox and Cross
题目链接:http://codeforces.com/problemset/problem/389/B 题目大意:给你一个n*n的方形板块,在上面铺上且只能铺”.“、"#"两只中的一种或两种,要你在上面把”#“全部用上,组合成十字,用过的”#“不能再用。‘’ 题目简单易懂,直接搜索就好了。 #include using namespace std; char ch[
2014-02-05 10:29:52 792
原创 codeforecs Fox and Number Game
题目链接:http://codeforces.com/problemset/problem/389/A 非常简单的一题,也非常蛋疼的一题。 #include int GCD(int a, int b) { return b==0? a : GCD(b, a%b); } int main() { int n, x, y, i; scanf("%d%d", &n, &x);
2014-02-04 20:58:16 800
原创 codeforces Letter
题目链接:http://codeforces.com/problemset/problem/43/B 题目:字符匹配的问题。 #include int main(void) { char ch[205]; int c[128]={}; char ch1[205]; int i; gets(ch); for(i=0;ch[i];i++) c[ch[i]]++;
2014-02-03 23:07:35 820
原创 codeforces Football
题目链接:http://codeforces.com/problemset/problem/43/A 题目:两个队比赛,看看哪个队赢。字符串的比较和计数。 #include #include #include using namespace std; int main(void) { int n; int i; string str[105];
2014-02-03 22:17:36 794
原创 codeforces Ultra-Fast Mathematician
题目链接:http://codeforces.com/problemset/problem/61/A 题目意思我也不知道,好长。没看,但一看样例就知道了,直接AC。#include #include #include using namespace std; char ch1[101]; char ch2[101]; char ch3[101]; int main(void) {
2014-02-03 18:36:51 673
原创 codeforces Word
题目链接‘:http://codeforces.com/problemset/problem/59/A 题目:给你一个大小写混合的长度不超过100的字符串,按照题目给定的要求,将其转换为大写字符串或者小写字符串,大写字符个数不小写字符个数多时,就转换为大写的,小写字符大于或者等于大写字符 时,就转换为小写字符! #include #include #include using
2014-02-03 16:54:51 899
原创 codeforces Calendar
题目链接:http://codeforces.com/problemset/problem/58/D 题目:有 n个城市(n为偶数),然后n个城市的名字,用这些名字来出版这么个东西( calendar ),要求按照(n/2)行输出,且每行要等长。 #include #include #include #include #include using namespace std;
2014-02-03 11:50:02 614
原创 codeforces Coins
题目链接:http://codeforces.com/problemset/problem/58/B 题目大意:给你一张钱吧,然后让你找钱,(类似于贪心算法的找钱,尽可能的找最大值的),但一定要是倍数。 #include using namespace std; int n; int main(void) { int i,j; scanf("%d",
2014-02-02 21:21:08 752
原创 codeforces Chat room
题目链接:http://codeforces.com/problemset/problem/58/A 题目要求:给你一个字符串,要你在这个字符串里面看看能不能找到一个“hello”,当然按顺序来找,若能够,则输出“YES”, 否则“NO”。 #include #include using namespace std; char ch[105]; const char ch1[6]={
2014-02-02 21:01:19 991
原创 codeforces Chess
题目链接:http://codeforces.com/problemset/problem/38/B 题目大意:给你两颗棋子,分别为车和士,在8*8的方块中,该死了你两颗棋子的位置(这两颗棋子不会受到对方的攻击),要你在摆一颗棋子,问你摆的方法有几种。 #include #include using namespace std; int main() { char c;
2014-02-02 14:10:35 749
原创 codeforces Army
题目链:http://codeforces.com/problemset/problem/38/A 题目大意:就是说有有有一个人想从A等级上升到B等级,然后给你每上升一级所需要的年份,问你一共需要多少年。 本人错误的理解为第一个所给的年份就是从A开始的,所以直接累加就好了,然后WA之,在看题目,才明白非也。应该从i=a,直接累加到B就好了。 #include
2014-02-02 11:45:51 608
原创 codeforces George and Round
题目链接:http://codeforces.com/problemset/problem/387/B #include #include using namespace std; int n,m,A[3005],B[3005]; int main(void) { scanf("%d%d", &n, &m); int i,j; for(i=0; i<n; ++i)
2014-01-31 11:02:46 708
原创 codeforces George and Sleep
题目链接:http://codeforces.com/problemset/problem/387/A 题目好长,也没有看懂,其实也没有必要看懂,只要看样例就知道是什么回事了。而且非常水。 #include using namespace std; int main(void) { int h1,m1; int h2,m2; scanf("%d:%d", &h1, &
2014-01-31 10:12:42 929
原创 codeforces Bear and Raspberry
题目链接:http://codeforces.com/problemset/problem/385/A 题目有点长啊。呵呵,但是很水,就是寻找最大利益! 代码如下:#include int A[105],n,c; int main(void) { int i; scanf("%d%d", &n, &c); for(i=0; i<n; ++i)
2014-01-25 21:15:03 678
原创 codeforces Playing with Dice
题目链接:http://codeforces.com/problemset/problem/378/A 题目意思:简单,给你两个数a、b,其中a、b都不大于6,然后抛色子,哪个数更接近色子的数字,那么谁就是赢家!; 解题过程: #include #include using namespace std; int main(void) { int a,b,c;
2014-01-24 00:10:35 659
原创 codeforces Second-Price Auction
题目链接:http://codeforces.com/problemset/problem/386/A 题目意思:简单,就是有n个人投标某个东西,有n个数,找出最大的数的下标和第二大数就好了!就是这么简单。 #include #include using namespace std; int A[1001]; int main(void) { int
2014-01-23 23:28:24 976
原创 codeforces Multitasking
题目链接:http://codeforces.com/problemset/problem/384/B 题意:题目的表面意思就是说有个人想提高自己的多做任务的能力,然后给n个数组,每个数组里面又有m个元素,其中元素的大小为 1 详细请看代码:#include int main(void) { int n,m,k; scanf("%d%d%d", &n, &m
2014-01-23 22:05:00 613
原创 codeforces Coder
题目链接:http://codeforces.com/problemset/problem/384/A 题目还是比较简单的,就是给你一个n*n(n 题解:其实还是比较简单的,最多能摆几个,是有规律的,即为(n*n+1)/2个。那么在哪个位置放"C",或者“.”,就是循环变量来决定了,详细情况请看代码: #include int n; int mai
2014-01-21 23:11:24 644
原创 nefu 斐波那契的整除
题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemshow.php?problem_id=115 题目为中文题目,不长,很好理解,呵呵。 题意:一个公式,题目中有。按照公式的运算要求,算出Fn,看Fn的值能否被3 或者 4整除。 由于题目给的数据非常大,故若直接运算,肯定会发生溢出,难以处理,因此我们应该看看题目是否有循环节,从题目
2014-01-21 17:19:55 646
原创 hdoj 2099 整除的尾数
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2099 题目是中文题,也比较短,还是很好理解的。 直接贴代码吧,我觉得这题只要有C语言入门知识的人就可以解决了。 #include int a,b; int main(void) { int i; while(2==scanf("%
2014-01-21 16:59:43 527
原创 Sereja and Stairs
题目:http://codeforces.com/problemset/problem/381/B 题意很简单:给你一个长为|a|是数字序列,按照题目所给的条件,看看这个序列是否存在这样的一个i(1ai+1>ai+2>......>a|a|. 如果存在,那么就输出序列的长度和满足要求的序列。 题解:先将这些数字先排序一下,然后先除去重复的数字,这样就可以得到前面的小于部分,然后
2014-01-16 11:54:18 576
原创 codeforce Domino
Domino time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera has got n domino pieces in a row. Each piece c
2013-12-04 21:25:24 659
原创 codeforce Find Maximum
Find Maximum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera has array a, consisting of n integers a0
2013-12-04 20:46:13 551
原创 codeforce Valera and Contest
Valera and Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera loves to participate in competitio
2013-11-30 09:26:23 664
原创 codeforce Valera and Plates
Valera and Plates time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera is a lazy student. He has m clean b
2013-11-30 09:05:59 911
原创 codeforce Helpful Maths
Helpful Maths time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Xenia the beginner mathematician is a third y
2013-11-30 01:03:47 738
原创 codeforce Dima and Guards
Dima and Guards time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nothing has changed since the last round. Di
2013-11-29 21:57:14 717
原创 codeforce Sereja and Suffixes(简单题)
Sereja and Suffixes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja has an array a, consisting of n i
2013-11-28 00:07:35 779
原创 codeforce Sereja and Coat Rack(简单排序)
A. Sereja and Coat Rack time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja owns a restaurant for n peopl
2013-11-28 00:03:50 831
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人