雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 50 下一页

2011年10月27日

摘要: 1 2 38 9 47 6 5View Code #include<stdio.h>#include<string.h>int map[99][99];int pi[4]={0,-1,0,1};int pj[4]={-1,0,1,0};int step=0;void dfs(int fi,int fj){ int i,k; for(i=0;i<=3;i++) { if(map[fi+pi[i]][fj+pj[i]]!=0) continue; for(k=1;;k++) { ... 阅读全文

posted @ 2011-10-27 21:30 huhuuu 阅读(241) 评论(0) 推荐(0) 编辑

2011年10月23日

摘要: 给你一个n个数的数列,其中某个数出现了超过n div 2次即众数,请你找出那个数。由于数据Memory Limit:1 MB开数组开不了,两个不一样的时候,抵消即可View Code #include<stdio.h>int main(){ int n; while(scanf("%d",&n)!=EOF) { int i,add=0,temp,bef; for(i=0;i<n;i++) { scanf("%d",&temp); if(add==0) { ... 阅读全文

posted @ 2011-10-23 18:12 huhuuu 阅读(275) 评论(0) 推荐(0) 编辑

2011年10月19日

摘要: 读题发现 每个物品有三种执行方式:1。放到轻的那边2。放到重的那边3。不放dp[i][j]表示到第n个物品时,重量差为j时的重量小的一端的重量,不存在则为-1。View Code #include<stdio.h>#include<string.h>#include<iostream>using namespace std;int dp[109][2009];int a[109];int main(){ int i,j,t,n,add=0,s,z=0; scanf("%d",&t); while(t--) { z=0; s=0; 阅读全文

posted @ 2011-10-19 22:27 huhuuu 阅读(260) 评论(0) 推荐(0) 编辑

2011年10月11日

摘要: http://www.zybbs.org/JudgeOnline/problem.php?id=1668类似于数字金字塔的DP先对数字处理如:1 2 3 41 2 3 41 2 3 4就要处理成1 2 0 00 2 3 00 0 3 4因为是起点是左上角,终点是右下角,方便dp方程,所以赋值为‘0’,在转移方程:dp[i][j]+=max(max(dp[i][j+1],dp[i-1][j+1]),dp[i+1][j+1]);View Code #include<stdio.h>#include<iostream>using namespace std;int dp[10 阅读全文

posted @ 2011-10-11 21:20 huhuuu 阅读(352) 评论(2) 推荐(0) 编辑

2011年10月10日

摘要: DescriptionFarmer John 决定给他的奶牛们照一张合影,他让 N (1 ≤ N ≤ 50,000) 头奶牛站成一条直线,每头牛都有它的坐标(范围: 0..1,000,000,000)和种族(0或1)。 一直以来 Farmer John 总是喜欢做一些非凡的事,当然这次照相也不例外。他只给一部分牛照相,并且这一组牛的阵容必须是“平衡的”。平衡的阵容,指的是在一组牛中,种族0和种族1的牛的数量相等。 请算出最广阔的区间,使这个区间内的牛阵容平衡。区间的大小为区间内最右边的牛的坐标减去最做边的牛的坐标。 输入中,每个种族至少有一头牛,没有两头牛的坐标相同。Input行 1: 一个整 阅读全文

posted @ 2011-10-10 22:43 huhuuu 阅读(697) 评论(0) 推荐(0) 编辑

2011年10月9日

摘要: 有N个球每个球的颜色不同,取一个球后放回,取几次可以取完所有的球,求期望s=n*(1/n+1/n-1+1/n-2+...+1/1); 阅读全文

posted @ 2011-10-09 19:18 huhuuu 阅读(210) 评论(0) 推荐(0) 编辑

摘要: C(N,K),n,k很大判断C(N,K) 是否是奇数还是偶数if(N&K==K)就是奇数 阅读全文

posted @ 2011-10-09 15:58 huhuuu 阅读(255) 评论(0) 推荐(0) 编辑

2011年10月8日

摘要: 三国杀摆放自己的英雄,使敌方英雄不管怎么摆都你赢N<=6暴力枚举自己英雄序列6!*敌方英雄序列6!*6判断这种题目还是不够仔细,错了几次View Code #include<stdio.h>#include<iostream>#include<algorithm>#include<string.h>using namespace std;bool hash[9];int no[9];bool hash2[9];int no2[9];struct data{ int n; char name[9][29];}node[9];struct Na 阅读全文

posted @ 2011-10-08 21:46 huhuuu 阅读(226) 评论(0) 推荐(0) 编辑

2011年9月26日

摘要: View Code //第七题import java.util.*;class Vehicle{ protected int speed, kind; protected String color; Scanner cin=new Scanner(System.in); public Vehicle(int a){ //不带参数的构造方法 kind=a; System.out.println("构造完成"); } public void setSpeed(int a){ speed=a; } public vo... 阅读全文

posted @ 2011-09-26 21:00 huhuuu 阅读(1058) 评论(0) 推荐(0) 编辑

摘要: View Code import java.util.*;import java.math.*;import java.text.DecimalFormat;public class Main { public static void main(String args[]) { Scanner cin=new Scanner(System.in); double x1,y1,x2,y2; DecimalFormat df = new DecimalFormat("0.00"); while... 阅读全文

posted @ 2011-09-26 15:07 huhuuu 阅读(698) 评论(0) 推荐(0) 编辑

上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 50 下一页