随笔分类 -  ACM--DP

摘要:题意:求n位数字,满足非递减的个数。dp[ i ] [ j ] = sum( dp[i -1] [ k ] ); k =>( j , 9); 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int dp[100002][11]={0}; 7 int mod=1000000007; 8 void prepare() 9 {10 int i,j,s;11 for(i=0;i<=9;i++)12 {13 dp[2][i]=10-i;14 dp[2][10]... 阅读全文
posted @ 2013-11-19 17:47 芷水 阅读(177) 评论(0) 推荐(0)
摘要:PiecesTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1418 Accepted Submission(s): 724 Problem DescriptionYou heart broke into pieces.My string broke into pieces.But you will recover one day,and my string will never go back. Given a string s.We 阅读全文
posted @ 2013-11-14 22:40 芷水 阅读(231) 评论(0) 推荐(0)
摘要:炮兵阵地Time Limit:2000MSMemory Limit:65536KTotal Submissions:16619Accepted:6325Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示:如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中的黑色的网格表示它能够攻击到的区域:沿 阅读全文
posted @ 2013-11-13 21:04 芷水 阅读(228) 评论(0) 推荐(0)
摘要:方格取数(1)Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3848Accepted Submission(s): 1473Problem Description给你一个n*n的格子的棋盘,每个格子里面有一个非负数。从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取的数所在的2个格子不能相邻,并且取出的数的和最大。Input包括多个测试实例,每个测试实例包括一个整数n 和n*n个非负数(n 2 #include 3 #inc 阅读全文
posted @ 2013-11-12 20:09 芷水 阅读(183) 评论(0) 推荐(0)
摘要:Corn FieldsTime Limit:2000MSMemory Limit:65536KTotal Submissions:5763Accepted:3052DescriptionFarmer John has purchased a lush new rectangular pasture composed ofMbyN(1 ≤M≤ 12; 1 ≤N≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, some of the squ 阅读全文
posted @ 2013-11-12 17:12 芷水 阅读(238) 评论(0) 推荐(0)
摘要:最大连续子序列Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16193 Accepted Submission(s): 7109 Problem Description给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 4 5 int a[10003]; 6 7 int main() 8 { 9 int i,n,l,r,num,max,dp;... 阅读全文
posted @ 2013-11-08 17:26 芷水 阅读(408) 评论(0) 推荐(0)
摘要:Find Metal MineralTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 2018 Accepted Submission(s): 913 Problem DescriptionHumans have discovered a kind of new metal mineral on Mars which are distributed in point‐like with paths connecting each of the 阅读全文
posted @ 2013-11-04 17:59 芷水 阅读(202) 评论(0) 推荐(0)
摘要:TELETime Limit:1000MSMemory Limit:65536KTotal Submissions:3230Accepted:1655DescriptionA TV-network plans to broadcast an important football match. Their network of transmitters and users can be represented as a tree. The root of the tree is a transmitter that emits the football match, the leaves of 阅读全文
posted @ 2013-10-31 22:34 芷水 阅读(226) 评论(0) 推荐(0)
摘要:1018. Binary Apple TreeTime limit: 1.0 secondMemory limit: 64 MBLet's imagine how apple tree looks in binary computer world. You're right, it looks just like a binary tree, i.e. any biparous branch splits up to exactly two new branches. We will enumerate by integers the root of binary apple 阅读全文
posted @ 2013-10-30 20:03 芷水 阅读(244) 评论(0) 推荐(0)
摘要:Starship TroopersTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8540 Accepted Submission(s): 2379 Problem DescriptionYou, the leader of Starship Troopers, are sent to destroy a base of the bugs. The base is built underground. It is actually a h 阅读全文
posted @ 2013-10-30 10:02 芷水 阅读(244) 评论(0) 推荐(0)
摘要:The more, The BetterTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4442Accepted Submission(s): 2639Problem DescriptionACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多 阅读全文
posted @ 2013-10-29 19:39 芷水 阅读(160) 评论(0) 推荐(0)
摘要:Anniversary partyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3623 Accepted Submission(s): 1684 Problem DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical 阅读全文
posted @ 2013-10-29 10:49 芷水 阅读(240) 评论(0) 推荐(0)
摘要:Proud MerchantsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 1978 Accepted Submission(s): 792 Problem DescriptionRecently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a r 阅读全文
posted @ 2013-10-29 08:40 芷水 阅读(209) 评论(0) 推荐(0)
摘要:Strategic GameTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4061 Accepted Submission(s): 1791 Problem DescriptionBob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he 阅读全文
posted @ 2013-10-28 23:11 芷水 阅读(230) 评论(0) 推荐(0)
摘要:Party at Hali-BulaTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1365Accepted Submission(s): 454Problem DescriptionDear Contestant,I'm going to have a party at my villa at Hali-Bula to celebrate my retirement from BCM. I wish I could invite al 阅读全文
posted @ 2013-10-28 21:38 芷水 阅读(248) 评论(0) 推荐(0)
摘要:选课时间(题目已修改,注意读题)Problem Description又到了选课的时间了,xhd看着选课表发呆,为了想让下一学期好过点,他想知道学n个学分共有多少组合。你来帮帮他吧。(xhd认为一样学分的课没区别)Input输入数据的第一行是一个数据T,表示有T组数据。每组数据的第一行是两个整数n(1 <= n <= 40),k(1 <= k <= 8)。接着有k行,每行有两个整数a(1 <= a <= 8),b(1 <= b <= 10),表示学分为a的课有b门Output对于每组输入数据,输出一个整数,表示学n个学分的组合数。22 21 22 阅读全文
posted @ 2013-04-14 23:01 芷水 阅读(144) 评论(0) 推荐(0)
摘要:Big Event in HDU hdu1171题目意思: 给很多组数组,平方他们,使他们的相差尽可能小。#include<stdio.h>int f[250001],a[51],b[51];int main(){int i,j,k,n,t,s,temp;__int64 m;while(scanf("%d",&t)>0){if(t<0)break;for(i=1,m=0;i<=t;i++){scanf("%d%d",&a[i],&b[i]);m=m+a[i]*b[i];}k=m/2;for(i=1;i 阅读全文
posted @ 2013-04-07 12:27 芷水 阅读(229) 评论(0) 推荐(0)