上一页 1 ··· 16 17 18 19 20
摘要: Let us define a regular brackets sequence in the following way:Empty sequence is a regular sequence.If S is a regular sequence, then (S) and [S] are both regular sequences.If A and B are regular sequences, then AB is a regular sequence.For example, all of the following sequences of characters are re 阅读全文
posted @ 2013-08-03 13:53 persistent codeants 阅读(299) 评论(0) 推荐(0)
摘要: A题: 判断>2的偶数;B题:(回溯)#include #include#include#include#include#include#includeusing namespace std;int days,times;int xt1[1000],xt2[1000];int sum,i,j,k;int a[1000];int main(){ cin>>days>>times; for(i=1;i>xt1[i]>>xt2[i]; } for(i=1;idays) { cout#include#include#include#include#inc 阅读全文
posted @ 2013-08-03 08:05 persistent codeants 阅读(308) 评论(0) 推荐(0)
摘要: Let'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 tree, points of branching and the ends of twigs. This way we may 阅读全文
posted @ 2013-08-01 13:52 persistent codeants 阅读(279) 评论(0) 推荐(0)
摘要: #include#include#include#include#define LL long longusing namespace std;int we,n,a[1050],i,j,dp[110005],num[101000],ans[1050]={0};//变量常量说明void init(){ cin>>we>>n; for(i=1;i>a[i]; memset(dp,0,sizeof(dp)); dp[0]=1;}void solve(){ for(j=1;j=a[j];i--) if(dp[i-a[j]]) { dp[i]+=dp[... 阅读全文
posted @ 2013-06-25 18:28 persistent codeants 阅读(489) 评论(0) 推荐(0)
摘要: 有一个三角形木板,竖直立放,上面钉着n(n+1)/2颗钉子,还有(n+1)个格子(当n=5时如图1)。每颗钉子和周围的钉子的距离都等于d,每个格子的宽度也都等于d,且除了最左端和最右端的格子外每个格子都正对着最下面一排钉子的间隙。让一个直径略小于d的小球中心正对着最上面的钉子在板上自由滚落,小球每碰到一个钉子都可能落向左边或右边(概率各1/2),且球的中心还会正对着下一颗将要碰上的钉子。例如图2就是小球一条可能的路径。我们知道小球落在第i个格子中的概率pi= ,其中i为格子的编号,从左至右依次为0,1,...,n。现在的问题是计算拔掉某些钉子后,小球落在编号为m的格子中的概率pm。假定最下面. 阅读全文
posted @ 2013-06-23 14:28 persistent codeants 阅读(534) 评论(0) 推荐(0)
摘要: 问题描述设有N*N的方格图(N 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int n,num[150][50][50],map[50][50],i,j,k;//变量常量说明 8 int max(int a,int b)//比较函数 9 {10 return a>b?a:b;11 }12 int max(int a,int b,int c,int d)//比较函数13 {14 int m=a;15 if(m>n;23 memset(map,0,sizeof(map));24 ... 阅读全文
posted @ 2013-06-23 14:03 persistent codeants 阅读(679) 评论(0) 推荐(0)
摘要: 描述农民约翰在一片边长是N (2 =2x2)的个数。当然,放牧区域可能是重叠。格式PROGRAM NAME: rangeINPUT FORMAT:(file range.in)第 1 行:N,牧区的边长。第 2 到 n+1行:N个没有空格分开的字符。0 表示 "那一个区段被毁坏了";1 表示 " 准备好被吃"。OUTPUT FORMAT:(file range.out)输出那些存在的正方形的边长和个数,一种一行。SAMPLE INPUT 6101111001111111111001111101101111001SAMPLE OUTPUT 2 103 44 阅读全文
posted @ 2013-06-23 13:29 persistent codeants 阅读(209) 评论(0) 推荐(0)
上一页 1 ··· 16 17 18 19 20