自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

ChallenChenZhiPeng的专栏

记录自己成长的点点滴滴

  • 博客(52)
  • 收藏
  • 关注

转载 poj 1035 串 枚举 暴力 tmp.insert(i, 1, current[i]); //谁能告诉我这句什么意思?

#include #include #include using namespace std; int ok;int ldic, lstr;string current;vector dic; /* 替换一个字符 */void replace(string dic){ int count = 0; /* 只有一个字符不一样就OK */ for (

2012-06-28 22:12:18 1155

原创 Ubuntu Hadoop 完全分布式安装

参考文献:1.   http://hadoop.apache.org/common/docs/r0.19.2/cn/quickstart.html#%E8%BF%90%E8%A1%8CHadoop%E9%9B%86%E7%BE%A4%E7%9A%84%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C2.  http://yymmiinngg.iteye.com/b

2012-06-27 15:02:44 1293

原创 程序开发过程

一.   问题分析       问题是什么?怎样使用这程序?程序会表现出怎样的行为?。。。。。。。二.  问题分解:问题分解成各个对象,每个对象都要设计一个类      使用哪些对象?它们之间怎样交互.....三.  类的设计      对象充当什么角色?     它需要哪些属性(变量),方法(行为)?      它会呈现出怎样的界面?      它会隐藏哪些信息?

2012-06-27 08:45:19 584

转载 网线排线顺序及常规用法

双绞线的接法按照10/100 BASE T的规定应该是有两种固定的标准,这就是T568A和T568B。      这两种接法如下:           T568B:橙白、橙、绿白、蓝、蓝白、绿、棕白、棕           T568A:绿白、绿、橙白、蓝、蓝白、橙、棕白、棕      为了保证最佳的兼容性,普遍采用EIA/TIA 568B标准来制作网线。这两种接法的只要记住一个就可

2012-06-26 20:38:08 4227

转载 poj 1664 递归

设f(m,n)为m个苹果,n个盘子的放法数目1:若n>m,必定有n-m个盘子永远空着,去掉它们对摆放苹果方法数目不产生影响,即f(m,n)=f(m,m)2:若n<=m时,不同的放法可以分为两类:即有至少一个盘子空着或者所有盘子都有苹果,前一种情况相当于f(m,n)=f(m,n-1),后一种情况可以从每个盘子中拿走一个苹果,不影响不同放法的数目,即f(m,n)=f(m-n,n),总的放苹果的

2012-06-25 19:00:34 724

原创 poj 1936 All in All 水题

#include using namespace std;const int MAX = 100001;int main(){ char s[MAX], t[MAX], *ps, *pt; while (cin >> s >> t){ ps = s; pt = t; while (*pt){ if (*p

2012-06-25 18:40:46 578

原创 poj 2305 Java 做,水过了 Basic remains

import java.io.*;import java.util.*;import java.math.*;public class Main { /** * @param args */ public static void main(String[] args) throws IOException { // TODO A

2012-06-25 18:31:48 600

原创 poj 2578 水题 Keep on Truckin'

题目其实是要我们读入三个数,然后判断是否比小于168,如果小于168,就输出第一个小于168的否则输出‘NO CRASH’#include using namespace std;int main(){ int arr[3]; int NotSafe; int i; while(cin>>arr[0]>>arr[1]>>arr[2]) { NotSafe=0;

2012-06-25 18:20:56 878

原创 poj 2390 水题 Bank Interest

#include #include #include using namespace std;int main(){ int r,m,y,t; double sum=0; cin>>r>>m>>y; sum=m*pow((1+r/100.0),y); // cout<<sum<<endl; t=(int)sum; cout<<t<<e

2012-06-25 17:21:29 784

原创 poj 2583 水题 Series Determination

#includeint main(){ int f[6]; int i; while(scanf("%d%d%d",&f[0],&f[1],&f[2])!=EOF) { f[3] = 3*(f[2]-f[1])+f[0]; f[4] = 2*(f[3]-f[1])+f[0]; f[5] = 5*(f[3]-f[2])+

2012-06-25 17:10:59 626

原创 poj2707 Copier Reduction

#includeusing namespace std;double a,b,c,d,t;// 模拟题 int main(){ double n1,n2,t; while(cin>>a>>b>>c>>d)//保证a,c是较小的,b,d是较大的 小的和小的比,大的和大的比 {

2012-06-25 16:52:41 675

原创 POJ 1316 Self Numbers

#include#include using namespace std;#define MAX 10003int main(){ int i, b, sum, a[MAX]={0}; for(i=1; i<MAX; i++) { b = sum = i; while(b) { sum +=

2012-06-25 16:34:59 504

原创 poj 3117 水题 World Cup

#include using namespace std;int main(){int m, n, score, sum;char a[11];while(cin >> m >> n && m){ sum = 3*n; for(int i=0; i<m; i++){ cin >> a >> score; sum -= score; } co

2012-06-25 15:26:14 548

原创 poj 2141 水题 Message Decoding

#include #include #include #include using namespace std; char keys[30]; int main(void){ int i, j; char tmp; while (scanf("%s", keys) != EOF){ getchar();

2012-06-25 15:17:30 837

原创 poj 3030 水题 Nasty Hacks

#include #include using namespace std;int main(){ int n,h,m,c; cin>>n; while(n--){ scanf("%d%d%d",&h,&m,&c); int t=m-c; if(t==h) cout<<"does not matter"<<end

2012-06-25 15:04:55 936

原创 poj 2840 水题 钟声(与新概念英语3其中课文有关)

#include #include using namespace std;int main(){ int n,h,m; cin>>n; while(n--){ scanf("%d:%d",&h,&m); if(m==0){ if(h==12) cout<<"24"<<endl;

2012-06-25 14:56:50 618

原创 poj 3062 水军之首

#includeint main(){ char a[100]; while(gets(a)!=NULL) { puts(a); } return 0;}

2012-06-25 14:48:32 486

原创 poj 2013 水军一族

#include #include using namespace std;int main(){ int n; int k=1; char a[16][26]; while(cin>>n){ if(n==0) break; for(int i=0;i<n;i++) cin>>a[i];

2012-06-25 14:42:02 545

原创 poj 2603 注意理解题意 数论

数论算法如下:若正整数n可分解为(p1^a1)*(p2^a2)*…*(pk^ak)其中pi为两两不同的素数,ai为对应指数n的约数个数为(1+a1)*(1+a2)*….*(1+ak)。最后,要求的是,约数个数的最后一位#include #include using namespace std;int main(){ int n,a[10001];

2012-06-25 11:40:15 821

原创 poj 2635 大数模运算(内有打素数表的模板,大树求余分解公式)

题意:求正整数K(4 思路:大数模运算,让比L小的所有素数去除K,如果余数为0则表示存在。先预处理打一张素数表,然后对K按10000进制进行分解,(按1000~1000000000进制都是可行的,其中1000跑了800多MS,100进制就TLE了),然后按照公式(A+B)%C = ((A%C)+(B%C))%C进行模运算。#include #include using name

2012-06-25 10:37:29 2215

原创 poj 2226 最大流二分匹配

不能一次消除一行或一列,只能一次消除相邻的,怎么办?实质上只是需要一步预处理。扫描一遍输入的矩阵,把每行和每列中相邻的障碍物看成一个点,记录一下,然后加边。这样就转化成了poj3041:                 http://blog.csdn.net/challenchenzhipeng/article/details/7687918#include#include

2012-06-24 19:38:31 530

原创 poj 3041 二分匹配 基础题(整理版:基础知识)匈牙利算法

通俗易懂的:http://ekumen.iteye.com/blog/265336 模板:http://chhaj5236.blog.163.com/blog/static/1128810812009910102617216/Ford-Fulkerson求解最大流 Edmonds-Karp算法:http://chhaj5236.blog.163.com/blog/static/112881

2012-06-24 18:53:07 541

转载 poj 3436 最大流,需要仔细消化(题意好久都没看懂)

转自:http://hi.baidu.com/you289065406/blog/item/78acc3476f460359500ffe12.html#includeusing namespace std;const int inf=10001;int s; //超级源int t; //超级汇int n; //总结点数(包括超级源、超级汇)int p; //每台机器的部分数

2012-06-24 14:25:44 636

原创 poj 1459 最大流问题

详细见1273其分析:http://blog.csdn.net/challenchenzhipeng/article/details/7686648刚开始,MAX=101,数组大小为101,应该可以了,题目说 0 #include #include #include #include using namespace std;const int INF=0x7fffffff;

2012-06-24 10:13:16 548

原创 poj 1273 最大流 基础题 (内有最详细的最大流分析,很好入门)

详细的最大流基础:http://course.cug.edu.cn/cugFirst/operational_research/main/charpter7/p4.htm# http://www.cppblog.com/mythit/archive/2009/04/19/80470.aspx(里边有点小错误,很明显,但解释的通俗易懂)#include

2012-06-23 21:28:42 990

原创 1258 prim

#include #include using namespace std;int n,dist[500][500];int ma;int prime(){ int v,min; int d[500]; int flag[500]; memset(flag,0,sizeof(flag)); for(int i=0;i<n;i++)

2012-06-22 19:31:10 437

原创 poj 2485 Prim

#include #include using namespace std;int m,n,dist[500][500];int ma;int prime(){ int v,min; int d[500]; int flag[500]; memset(flag,0,sizeof(flag)); for(int i=0;i<n;i++)

2012-06-22 19:21:52 459

原创 poj 1789 Prim最小生成树

#include #include using namespace std;int n,dist[2002][2002];char ch[2002][7];int sum;int distance(char a[],char b[]){ int dc=0; for(int i=0;i<7;i++) {if(a[i]!=b[i]) dc++; }

2012-06-22 18:49:47 457

原创 poj2240 水题 熟悉map用法及string用法 Frolyd算法

#include #include #include #include using namespace std;int main(){ int n,m,caseNum; string s,t; double r; double array[30][30]; map mp; while(cin>>n&&n){ caseNum++; int cnt=0;//币

2012-06-22 16:48:19 457

原创 poj 1573 模拟

#include #include #include using namespace std;const int N = 1010;char map[N][N];int visit[N][N], step[N][N];//step记录步数int n, m, x, y, flag;void BFS(int k){ int i, j, p; i = 1; j

2012-06-21 20:17:10 406

原创 poj 2632 模拟

#include #include struct pos{ int x, y;} p[101];int map[101][101], flag;char dir[101];int a, b;void crash(int rob, char op){ switch (op) { case 'L': switch (dir[rob]

2012-06-21 10:14:22 377

转载 poj 1068 括号搭配

模拟的题型,基本难度不大,关键读懂题意:对于给出的原括号串,存在两种数字密码串:1.p序列:当出现匹配括号对时,从该括号对的右括号开始往左数,直到最前面的左括号数,就是pi的值。2.w序列:当出现匹配括号对时,包含在该括号对中的所有右括号数(包括该括号对),就是wi的值。题目的要求:对给出的p数字串,求出对应的s串。串长限制均为20 提示:在

2012-06-20 22:16:31 565

原创 poj 3295

大意是给定一个前缀布尔表达式,最多有5个变量,判断其是否恒为真。 这个确实不难,0到31地枚举5个变量的所有取值,计算表达式的值即可。从右到左扫描前缀表达式,遇操作数则入栈,遇n元操作符则弹出n个操作数进行运算并将运算结果入栈。最终在栈中的唯一操作数即为值。#include#include#includeusing namespace std;int p,q,r,s,

2012-06-20 15:25:54 480

原创 poj 2856 水题 题意难理解

有一个公司由于某个病毒使公司赢亏数据丢失,但该公司每月的 赢亏是一个定数,要么一个月赢利s,要么一月亏d。现在ACM只知道该公司每五个月有一个赢亏报表,而且每次报表赢利情况都为亏。在一年中这样的报表总共有8次(1到5,2到6,…,8到12),现在要编一个程序确定当赢s和亏d给出,并满足每张报表为亏的情况下,全年公司最高可赢利多少,若存在,则输出多多额,若不存在,输出"Deficit"。分析:

2012-06-20 14:53:43 896

转载 poj 2299 归并排序求逆序数

转自http://www.slyar.com/blog/poj-2299-c.html题目本质就是求逆序对了,简单介绍一下。逆序对是指在序列{a0,a1,a2...an}中,若aij),则(ai,aj)上一对逆序对。而逆序数顾名思义就是序列中逆序对的个数。例如: 1 2 3是顺序,则逆序数是0;1 3 2中(2,3)满足逆序对的条件,所以逆序数只有1; 3 2 1中(1,2)(1,3)(2,3

2012-06-20 09:42:10 578

原创 poj 2388 vector 水水水 sort

sort用法:http://www.cppblog.com/mzty/archive/2005/12/15/1770.html#include#include#includeusing namespace std;int main(){int i, N;cin>>N;vectorarr(N);for(i=0;i>arr[i];sort(arr.begin(),arr.e

2012-06-19 20:11:00 648

原创 poj 1321 dfs

#include #include #include #define MAX 9 int n, k, sum, sumk;char map[MAX][MAX];int visit[100] = {0}; void dfs(int a, int b){ int i, j; if (sumk == k) { sum++;

2012-06-19 19:48:27 421

原创 poj 2503 bsearch

C语言中 bsearch 包含在头文件中,此函数可以根据你给的条件实现二分查找,如果找到元素则返回指向该元素的指针,否则返回NULL;对于有多个元素匹配成功的情况,bsearch()未定义返回哪一个。使用 bsearch 函数也要自己定义比较子函数。函数原型void *bsearch(const void *key, const void *base, size_t num, si

2012-06-19 19:40:16 471

原创 POJ 2109 水题 加各种数据类型范围

开始的想法是高精度,但并不是Int16 值类型表示值介于 -32768 到 +32767 之间的有符号整数。Int32 值类型表示值介于 -2,147,483,648 到 +2,147,483,647 之间的有符号整数。Int64 /long 值类型表示值介于 -9,223,372,036,854,775,808 到 +9,223,372,036,854,775,807 之间的整

2012-06-19 17:17:21 394

原创 Poj 1328 贪心

假设有一条无限长的海岸线,海岸线以上部分有n个岛屿。在海岸线上有雷达,每个雷达能够探测的范围为半径为d的圆,当且仅当一个岛屿与雷达的距离小于等于d时,岛屿能被雷达探测到。给出所有岛屿的坐标和雷达的半径。求最少需要用多少个雷达,使得所有的岛屿都被探测到。使用贪心+快排,求出每个岛屿对应圆心在x轴上的范围,对左坐标排序后贪心选择。类似于:数轴上有N个点,要用几个单位长度区间才能将它们全部覆盖?

2012-06-19 17:05:29 506

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除