自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

N

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

转载 POJ 题目分类

争取做完上面所有的题目。

2010-12-10 19:17:00 3405

原创 博弈 2010年11月6日

<br />这类题目,对数学的要求较高,打算去借相关的书研究下再做题目<br /> <br />待做题目:<br />POJ:<br />1067 取石子游戏<br />1082 Calendar Game<br />1740   A New Stone Game<br />2234 Matches Game<br />2348 Euclid's Game<br />HDU:<br />1847 1730 1079 3469 1061 1907<br />资料阅读:<br />1、http://hi.bai

2010-11-06 22:31:00 591

原创 poj 1548 (贪心 会场安排)

<br />//典型的活动会场安排问题//c中竟然不能用bool?#include <stdio.h>#include <stdlib.h>#define csMax 5001struct data{ int length; int weight; int flag;};struct data sticks[csMax]; //c中struct不能省,c++中可以!int cmp(const void *a, const void *b){ struc

2010-12-26 10:28:00 1304 1

原创 POJ 2726 + 1828

输入n个二元组(xi,yi),统计有多少个二元组(xk,yk)满足:对于任意xi yk;对于任意yi xk ( n

2010-12-11 20:01:00 941

原创 1604 Just the Facts (高精度) (?)

#include using namespace std;const int maxn = 2500;int nFactorial[maxn];int funcSolve(int n);int main(){ int num; while(1 == scanf("%d", &num)) { int result = funcSolve(num); printf("%5d -> %d/n", num, result); //输出要注意! }

2010-12-11 18:44:00 687

原创 POJ 1496 + 1850 (数论-排列组合) (?)

a -> 1<br /> b -> 2<br /> .<br /> .<br /> z -> 26<br /> ab -> 27<br /> ac -> 28<br /> .<br /> .<br /> az -> 51<br /> bc -> 52<br /> .<br /> .<br /> vwxyz -> 83681/*理解是关键,数论题*/#include <

2010-12-10 21:39:00 799

原创 POJ 1852 Ants

<br />2010-12-10 15:44:04<br /> <br /> <br /> <br />/*功能: 函数返回参数arg的绝对值。 1、fabs 语法: #include <math.h> double fabs( double arg ); 2、abs 语法: #include <stdlib.h> int abs( int num );*/#include <iostream>using namespace s

2010-12-10 15:43:00 921

原创 POJ 3981 字符串替换 (string的基础使用)

<br />1、c++中字符串的操作头文件 #include <string><br />2、getline<br />3、find<br /> <br />#include <iostream>#include <string> //c++中字符串操作的头文件!using namespace std;int main(){ string str; while(getline(cin, str)) //getlin 函数 { int start = str

2010-12-08 19:40:00 1359 1

原创 POJ 3543 iChess (水题,精度注意)

<br />/*题意理解+细节+精度*/#include <iostream>#include <cmath>using namespace std;int main(){ int b, w; int size; while(2 == scanf("%d %d", &b, &w)) { if(b == 0 && w == 0 ) { printf("Impossible/n"); } else { if(w ==

2010-12-06 20:45:00 763

原创 POJ 1781 In Danger (约瑟夫问题)

<br />思路:见代码注释。<br /> <br />#include <iostream>#include <cmath>using namespace std;int nPersons, suriverNum;int funcInput();void funcWorkout();void funcOutput();int main(){ while(funcInput()) { funcWorkout(); funcOutput(

2010-12-06 18:22:00 820

原创 poj 3372 (使用num & (num-1) 判断num是否为2的k次方)

<br />/*注意&的使用 num & (num-1) 判断num是否为2的k次方 证明看:http://hi.baidu.com/findthegateopen/blog/item/03e5802e19f1ea301e3089f9.html*/#include <iostream>using namespace std;int main(){ int num; while(1 == scanf("%d", &num)) { printf((num &

2010-12-05 10:23:00 2920

原创 printf()输出格式控制 (转)

<br />1.转换说明符<br />      %a(%A)     浮点数、十六进制数字和p-(P-)记数法(C99)<br />      %c             字符<br />      %d             有符号十进制整数<br />      %f              浮点数(包括float和doulbe)<br />      %e(%E)     浮点数指数输出[e-(E-)记数法]<br />      %g(%G)     浮点数不显无意义的零"0"<br /> 

2010-12-05 09:49:00 631

原创 poj 3507 (%g的使用)

<br />/* %g(%G) 浮点数不显无意义的零"0" */#include <iostream>#include <algorithm>using namespace std;void funcInput();void funcDealData();bool cmp(const int &a, const int &b);void funcOutput();int num[7];int judge, sum;int main(){

2010-12-05 09:47:00 1037

原创 poj 3518 Prime Gap

<br />#include <iostream>#include <math.h>using namespace std;const int csMax = 1299709;bool isPrim(int a);int main(){ int num, maxGap; while(1 == scanf("%d", &num), num) { if(isPrim(num)) { maxGap = 0;; } else

2010-12-04 23:35:00 633

原创 poj 3761 Panda's Birthday Present (数学公式推导~~推?)

<br />/*推导公式:(p+q+10)/7 */#include <iostream>using namespace std;int main(){ int nCase; int p, q; double result; scanf("%d", &nCase); while(nCase--) { scanf("%d %d", &p, &q); result= (p + q + 10) / 7.0; printf("%.3lf/n",

2010-12-04 16:43:00 954

原创 POJ 2014 Flow Layout 模拟

<br />/*POJ 2014 Flow Layout 模拟*/#include <iostream>using namespace std;int main(){ int maxGiven; int width_in, height_in; int width_curr, height_curr; int width_max, height_max; while(1 == scanf("%d", &maxGiven)) { if(maxGiven

2010-12-04 15:35:00 565

原创 C++学得再好,也无法凭这个找到好工作 (转) 注意基础知识的掌握!~

<br />做过无数笔试题,做过无数面试题,基本上没遇到过很重视语言细节的。语言本身方面,可能会问问虚函数和多态,重载,作用域,存储方式,字节对齐,一般问的不多,或者根本不问。相反,对待你不懂XX语言上,往往表现的相当宽容,我面试时坦言自己只会一点C,对方也表示没有关系, 而我目标职位没有一个跟C是有点关系的。 比较重要的是,基本数据结构和算法,大规模数据处理技巧,进程,线程,网络等系统问题,智力题,项目经验等。排序,链表操作,二叉树,也是经常会考到的东西,以笔试时居多,面试一般更重思路和随机应变 。has

2010-12-04 14:05:00 659

原创 POJ 1328 贪心

<br />#include <iostream>#include <algorithm>#include <math.h>#define csMax 1001using namespace std;struct LocationData{ double nFrom; double nTo;};LocationData dd[csMax];int nCaseNum, nIslandNum;double d;double nX[csMax], n

2010-12-01 20:49:00 610

原创 POJ 1350 Cabric Number Problem

<br />模拟得我吐血!<br />有空理理思路,重新做一遍!

2010-11-29 22:12:00 641

原创 POJ 1016

<br />//简单模拟,重点掌握string cin cout#include <iostream>#include <string>using namespace std;string calc(string str){ int i, j = 0; int num[10] = {0}; char inv[81]; for(i = 0; i < str.length(); i++) //c++ ! { num[str[i]-'0']++; }

2010-11-29 19:51:00 617

转载 文本操作快捷键,Visual C++ 6.0 默认快捷键选项+扩展阅读调试功能

<br />命令名<br />快捷键<br />说明<br />编辑.分行<br />Enter Shift + Enter<br />插入一个新行。<br />编辑.字符转置<br />Ctrl + T<br />交换插入点两边的字符。例如,AC|BD 将变为 AB|CD。仅在文本编辑器中可用。<br />编辑.清除书签<br />Ctrl + Shift + F2 Ctrl + K,Ctrl + L<br />移除当前文档中所有未命名的书签。<br />编辑.折叠到定义<br />Ctrl + M,Ct

2010-11-21 16:18:00 610

原创 POJ 1065 (贪心)

1、qsort函数的应用int cmp(const void *a, const void *b){ struct data *c = (struct data *)a; //注意struct不能省! struct data *d = (struct data *)b; //! if((c->length) == (d->length))  return c->weight - d->weight; else  return c->length - d->length;}//典型的活动会场安排问题//c

2010-11-21 16:14:00 525

原创 POJ 1323 简单贪心

<br />#include <stdio.h>#include <string.h>int main(){ int i; int n, m; int nCard, flag[1001]; int caseNum = 1; int count, res, temp; while (scanf("%d %d", &n, &m) != EOF, n, m) { memset(flag,0, sizeof(flag)); for(i = 0; i

2010-11-21 11:52:00 516

原创 POJ 2313

V = (|A(1) – B(1)| + |A(2) – B(2)| + ... + |A(N) – B(N)|) + (|B(1) – B(2)| + |B(2) – B(3)| + ... +|B(N-1) – B(N)|)<br />将公式简单变形就可以推出b[0]=a[0]和b[n-1]为区间[a[n-1],b[n-2](不知道a[n-1]与b[n-2]大小关系)内的任意一个数或者b[n-1]=a[n-1]和b[0]为区间[a[0],b[1]]区间内的任意一个数,而考虑b[i],即要使 |b[i]-

2010-11-20 19:34:00 993

原创 POJ 1799

<br />学习点 PI=acos(-1..0) sin(x), cos(x), x是弧度!<br />#include <stdio.h>#include <math.h>//#define PI 3.1415926535#define PI acos(-1.0) //PI的表示还是值得学习的 int main(){ int nCase, nCaseNum; double R, r; int n; nCaseNum=0; while (1==scanf("%d"

2010-11-17 18:04:00 545

原创 POJ 3664 (qsort 快排)

<br />//2010-11-15#include <stdio.h>#include <stdlib.h>struct vote{ int firstRound; int secondRound; int ID;};struct vote arr[50001]; int cmp(const void *a, const void *b){//必须这样写!用“->”错! 明白此处 “.” 和“ ->” 的区别!!!! return (*(s

2010-11-15 21:20:00 1235

原创 POJ 3650 (尚待研究) 2010-11-15

<br />考察基本功<br />1、getchar <br />语法: <br />  #include <stdio.h><br />  int getchar( void );<br />getchar()函数从STDIN(标准输入)获取并返回下一个字符,如果到达文件尾返回EOF.<br />2、gets <br />语法: <br />  #include <stdio.h><br />  char *gets( char *str );<br />gets()函数从STDIN(标准输入)读取字符并

2010-11-15 21:19:00 583

原创 POJ 1318

<br />//快排 充分利用qsort()函数!#include <stdio.h>#include <string.h>#include <stdlib.h>int cmp_w(const void *a, const void *b){ return strcmp((char *)a, (char *)b);}int cmp_str(const void *a,const void *b){ return *(char *)a-*(char *)b;

2010-11-15 17:16:00 702

原创 2010-11-15 (尚需总结 哈希)

<br />1、哈希查找法<br />2、更加清楚各数据类型

2010-11-15 17:15:00 433

原创 POJ 1840 (哈希)

<br />思路一、排序暴力<br />//a1x1 3+ a2x2 3+ a3x3 3+ a4x4 3+ a5x5 3=0 <br />//拆成a3x33+ a4x43+ a5x53 = -(a1x1 3+ a2x2 3)<br />#include <stdio.h><br />#include <stdlib.h><br /> <br />int cmp(const void *a, const void *b)<br />{<br />       return *(int *)a - *(int

2010-11-15 17:12:00 483

原创 11月12日

<br />关键词:排序 qsort<br />1、  Poj 2231 更像是数学归纳题, sum += 2*abs(a[i]-a[j])<br />2、  Poj 2388<br />对int类型数组排序<br />int num[100]; <br />int cmp ( const void *a , const void *b ) <br />{ <br />return *(int *)a - *(int *)b; <br />}<br />qsort(num,100,sizeof(num[0]

2010-11-13 09:04:00 390

原创 POJ 1007

/*T>G>C>ACCCGGGGGGA 9AACATGAAGG 3+5+2=10GATCAGATTT 4+4+2+1=11ATCGATGCAT 6+2+2+3+2+1=16TTTTGGCCAA 24+8+4=36TTTGGCCAAA 21+10+6=37*/#include #include #include struct sortNum{ char str[51]; int count;};struct sortNum t[1

2010-11-12 21:19:00 449

原创 POJ 1002

 qsort的运行,具体看MSDN    一个是二位数组的qsort用法:1intcompare( constvoid*arg1, constvoid*arg2 ) 2{ 3   returnstrcmp((char*)arg1, (char*)arg2 ); 4} 5intarr[n][11]; 6qsort(arr, n, sizeof(arr[0]), compare);#include #include #include #define csMax 100000+1char nN

2010-11-12 19:24:00 447

原创 POJ 1656 Counting Black

<br />//简单模拟#include <stdio.h>#define csMax 101int main(){ int i, j, k; int nCommands; int x[csMax], y[csMax], L[csMax]; int flag[csMax][csMax]={0}; char command[csMax][6]; int a1, b1, count, temp; while (1==scanf("%d", &nC

2010-11-07 12:00:00 457

原创 学习算法的计划(持续更新)

<br />C语言基础打好:谭浩强的c程序设计、《你必须知道的495个C语言问题》.pdf 还需看下。<br />等poj上做到200题,再换c++

2010-11-06 23:22:00 575

原创 POJ 2350 (注意字符%的输出)

<br />}//唯一要主义的是字符%的输出 printf("%%");#include <stdio.h>int main(){ int i; int nCase, nNum, nGrade[1001]; int temp, average; while (1==scanf("%d", &nCase)) { while(nCase--) { temp=0; scanf("%d", &nNum); for(i=0; i<nNum

2010-11-06 23:03:00 526

原创 迫切需要做的事情

<br />一。苹果平台的软件开发:苹果开发中文网:www.cocoachina.com   (盛大创新院 郝培强 [email protected])<br /> <br />二。大学要做的几件事情<br />     1、一本书籍《the c++ programing langue》<br />     3、体验不同的操作系统,坚持使用linux一个月<br />     4、learn how to google<br />     5、多研究一些开源代码 hadoop  lucene  memca

2010-11-06 20:15:00 535

原创 程序员每天要做的事情(转)

<br />1、总结自己一天任务的完成情况  <br /><br />最好的方式是写工作日志,把自己今天完成了什么事情,遇见了什么问题都记录下来,日后翻看好处多多    <br /><br />2、考虑自己明天应该做的主要工作  <br /><br />把明天要做的事情列出来,并按照优先级排列,第二天应该把自己效率最高的时间分配给最重要的工作  <br /><br />3、考虑自己一天工作中失误的地方,并想出避免下一次再犯的方法  <br /><br />出错不要紧,最重要的是不要重复犯相同的错误,那是愚蠢

2010-11-06 20:15:00 549

原创 必须马上要去做的事情

<br />一。苹果平台的软件开发:苹果开发中文网:www.cocoachina.com   (盛大创新院 郝培强 [email protected])<br /> <br />二。大学要做的几件事情<br />     1、一本书籍《the c++ programing langue》<br />     3、体验不同的操作系统,坚持使用linux一个月<br />     4、learn how to google<br />     5、多研究一些开源代码 hadoop  lucene  memca

2010-11-01 15:50:00 494

原创 循环移位(转)

<br />  题目描述:<br />  给你一个字符串"abcdefg",循环左移两位得到"cdefgab",<br />  循环右移两位得到"fgabcde"<br />  输入:<br />  多组测试数据,每组一行,第一个是int范围内的整数n,<br />  表示要右移的位数,如果n是负数则表示要左移。接着后面<br />  是一个串长小于10000000的字符串。<br />  最后遇到EOF标志的时候结束。<br />  输出:<br />  输出移位后的字符串<br />  样例输入:<br

2010-10-15 22:27:00 687

空空如也

空空如也

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

TA关注的人

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