自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

yzl_rex

对于算法,我只是一个草民!

  • 博客(74)
  • 资源 (4)
  • 收藏
  • 关注

原创 poj 2301 Beat the Spread!

//这一题实在太坑爹了,没有说明分数是多少的! #include #include using namespace std; int main() { int tc, i, s, d, sum, f1, f2; cin >> tc; while (tc--){ cin >> s >> d; if (s < d || (s-d)

2012-06-26 01:39:41 666

原创 poj 2498 StuPId

//Multiply the digits from back to front (!) with repeating factors 9, 3, 7 //一定要注意上面这句话的意思,要不在进行求和的时候就会出错! #include #include #include using namespace std; char id[10]; int main() { int tc,

2012-06-25 01:37:07 613

原创 poj 2470 Ambiguous permutations

//第一次用了cin竟然超时了,我晕! #include #include using namespace std; int p[100010], ans[100010]; int main() { int num, i; bool flag; while (scanf("%d", &num)){ if (num == 0) break;

2012-06-23 01:23:33 481

原创 poj 2538 WERTYU

#include #include using namespace std; string str = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"; int main() { string s; int i, len, j; while (getline(cin, s)){ len = s

2012-06-20 01:10:57 690

原创 poj 2562 Primary Arithmetic

//求进位的次数:注意两个加数的位数有可能不相等! #include #include #include using namespace std; int main() { string str1, str2; int len1, len2, len, i, ans, tmp; while (cin >> str1 >> str2){ if

2012-06-19 20:49:02 577

原创 poj 2575 Jolly Jumpers

//没有认真读题,WA了两次,因为他们的差值的顺序不一定需要按升序或者降序排列的!具体可以用下面的数据进行测试! #include #include #include using namespace std; int dif[3000]; int main(){ int n; while(cin >> n){ memset(dif,0,sizeof(dif)); int pre,

2012-06-19 20:13:06 658

原创 poj 2578 Keep on Truckin'

#include using namespace std; int main() { int i, n = 3, tmp, ans = 0; for (i = 0; i < n; i++){ cin >> tmp; if (tmp <= 168){ ans = tmp; break;

2012-06-19 16:34:30 411

原创 poj 2608 soundx

//注意重复的或者其soundx值相等的字符应该先去掉! #include #include #include using namespace std; map m; int main() { m['B'] = 1, m['F'] = 1, m['P'] = 1, m['V'] = 1; m['C'] = 2, m['G'] = 2, m['J'] = 2, m['K'

2012-06-19 10:57:52 580

原创 poj 2636 Electrical Outlets

#include using namespace std; int PowerStrip[15]; int main() { int tc, k, i, sum, ans; cin >> tc; while (tc--){ cin >> k; sum = 0; for (i = 0; i < k; i++){

2012-06-19 09:51:57 456

原创 poj 2656 Unhappy Jinjin

#include using namespace std; int main() { int n, i, max, ans, t1, t2, tmp; while (cin >> n){ if (n == 0) break; max = -1; ans = 0; for (i = 0; i <

2012-06-19 00:49:46 641

原创 poj 2664 Prerequisites?

//给出选择的科目和分类,看选课是否达标! #include #include using namespace std; int course[110]; bool flag[110]; int main() { int k, m, c, r, i, j, l, tmp, ct; bool ff; while (cin >> k){ if (k

2012-06-19 00:36:44 780

原创 poj 2665 Trees

//给出一段距离,即是树木的总数,然后再给出几个树木需要砍伐或者移走的区域,求剩下的树木数!注意: //That's to say that there used to be 301 trees on the road. Now the section from 100m to 200m //is assigned for subway station, so 101 trees need to

2012-06-18 01:32:02 991

原创 poj 2840 Big Clock

//通过读钟表上面的点数,计算出需要strike的次数,很简单,将字符串转换为数字就OK! #include #include using namespace std; int main() { int tc, len, i, j, h, m; string time; cin >> tc; while (tc--){ cin >> ti

2012-06-18 01:15:19 726

原创 poj 2864 Pascal Library

//这题就相当于统计二维矩阵的列中出现1的个数,如果个数等于列数,就输出yes,否则输出no! #include using namespace std; int grid[510][110]; int main() { int n, d, i, j, ans, tmp; bool flag; while (cin >> n >> d){ if

2012-06-17 16:49:10 792

原创 poj 2871 A Simple Question of Chemistry

//注意输入的格式即可! #include #include using namespace std; int main() { double num1, num2, ans; bool flag = false; while (1){ if (!flag){ cin >> num1; fl

2012-06-17 16:21:42 714

原创 poj 2909 Goldbach's Conjecture

//给出一个偶数,要求在这个偶数的范围内,有几对素数和是等于这个偶数的,注意素数对的不重复性! #include #include using namespace std; bool is_primer(int n) { if (n == 1) return 0; int i, m; m = sqrt(float(n)); for (i = 2;

2012-06-17 13:33:50 659

原创 poj 2924 Gauß in Elementary School

#include #include #include using namespace std; int main() { int tc, c = 0; long long sum, tmp1, tmp2, n , m; cin >> tc; while (tc--){ c++; cin >> n >> m;

2012-06-15 22:47:14 859

原创 poj 3030 Nasty Hacks

#include using namespace std; int main() { int tc, r, e, c; cin >> tc; while (tc--){ cin >> r >> e >> c; if (e-c > r) cout << "advertise" << endl;

2012-06-15 20:34:04 401

原创 poj 3062 Celebrity jeopardy

//超级大水题,就是对一个字符串的输入和输出! #include #include using namespace std; int main() { string str; while (getline(cin, str)){ cout << str << endl; } system("pause"); }

2012-06-15 20:18:18 554

原创 poj 3077 Rounders

#include #include #include using namespace std; int main() { int tc, len, i, ans, tmp; string num; cin >> tc; while (tc--){ cin >> num; len = num.length();

2012-06-15 20:10:37 396

原创 poj 3086 Triangular Sums

#include using namespace std; int w(int n) { int sum = 0, i; for (i = 1; i <= n+1; i++) sum += i; return sum; } int main() { int tc, n, i, c = 0, ans; cin >> tc; whi

2012-06-15 19:40:19 396

原创 poj 3386 Halloween Holidays

#include using namespace std; int main() { int A, a, B, b, P; cin >> A >> a >> B >> b >> P; if ((a >= B && A = A && B B的情况! cout << "Yes" << endl; else cout << "No" <<

2012-06-14 16:24:41 589

原创 poj 3364 Black and white painting

#include using namespace std; int main() { int n, m, c, ans; while (cin >> n >> m >> c){ if (n == 0 && m == 0 && c == 0) break; if (c == 1 && (n-7) % 2 == 1 && (m-7) % 2

2012-06-13 08:50:56 465

原创 poj 3325 ICPC Score Totalizer Software

#include #include using namespace std; int scores[110]; int main() { int num, i, sum, ans; while (cin >> num){ if (num == 0) break; sum = 0; for (i = 0; i <

2012-06-13 00:14:46 549

原创 poj 3300 Tour de France

/*题意:自行车用链条将两个齿轮,前面的齿轮由2或3根齿条组成,后面的齿轮由5……10根齿条组成, 这齿轮转动的角速度d是由前后两个齿轮所包含的齿条数决定的,假设前面的齿轮的齿条数为m,后 面齿轮的齿条数为n,那么角速度为n/m,求出所有d后将其按升序排序,然后再计算d[i+1]/d[i]的最大值. */ #include #include #include #include using

2012-06-12 19:36:06 614

原创 poj 3224 Go for Lab Cup!

//题意比较难懂:题目要求的是赢得的场数为3最多的同学的编号!如果是相同场数的,则输出编号小的那个! #include #include using namespace std; int matrix[110][110]; int ans[110]; int main() { int n, i, j, max = 0, cur; cin >> n; memset(

2012-06-12 16:18:36 668

原创 poj 3183 Stump Removal

//这题需要注意边界的处理!就开始我以为需要用动态规划做的,谁知道这题只是需要从头到尾进行 //一次扫描即可,找出每一个高峰点就OK!哎,将简单的问题复杂化了,归根是没有真正读懂题意! #include using namespace std; int h[50050]; int main() { int n, i; cin >> n; for (i = 1; i

2012-06-12 12:57:54 663

原创 poj 3158 Kickdown

/*说说题意吧,我用另一种方式来说,情节可能和原题不同: 你可以理解为,生产了两种齿轮,2表示凸齿、1表示凹槽,凸齿处高度为2h,凹槽处高度为1h,现在有一个高度为3h的盒子,要去装这两个齿轮,问至少要多长才可以装得下,要求两个齿轮不可以横向翻转。 分析题意: 如果两个齿轮刚刚好严丝合缝的可以拼凑在一起,那么他们的总高度就是3h,如输入样例#2: 12121212 21212121 则,这两个齿

2012-06-11 10:24:56 1369

原创 poj 1047 Round and Round We Go

//大数相乘!注意最后一位是否有进位! #include #include #include #include using namespace std; int ans[100]; int main() { string str; int input[70], tmp[70]; int i, j, k, len; bool flag1; whi

2012-06-10 18:43:21 325

原创 poj 1657 Distance on Chessboard

//简单的模拟题,需要对每一个走子的规则有一个全面而准确的模拟,很容易漏掉情况! #include #include #include using namespace std; int main() { int tc, x, y; string pos1, pos2; cin >> tc; while (tc--) { cin

2012-06-10 15:55:33 401

原创 poj 3117 World Cup

//仔细分析题意之后,就会觉得这是一道好简单的题:赢球得3分,输球得0分,平局得1分!现在假设有3场球赛: //如果没有输球的球队,则总的分数为9分,如果有一场是平局的情况下,则总的分数为:平局的2分加上赢球的3*2,总共为8分; //如果有二场是平局的情况下,则总的分数为:平局的2*2加上赢球的3*1,总共为7分,按照这样的规律分析下去,结果就出来了! #include #include

2012-06-09 10:28:09 567

原创 poj 3096 Surprising Strings

//这题的测试数据很水,以为下面的做法会超时的!呵呵! 题意:在一个字符串中,给出一些字符间的距离,然后 //让你根据这距离再重新组成字符串,检查是否有相同的字符串存在! #include #include #include using namespace std; vector v; int main() { string str, tmp; int i, len,

2012-06-09 09:36:00 276

原创 poj 3096 Surprising Strings

//这题的测试数据很水,以为下面的做法会超时的!呵呵! 题意:在一个字符串中,给出一些字符间的距离,然后 //让你根据这距离再重新组成字符串,检查是否有相同的字符串存在! #include #include #include using namespace std; vector v; int main() { string str, tmp; int i, len,

2012-06-09 09:36:00 808

原创 poj 3100 Root of the Problem

#include #include using namespace std; int main() { int b, n, i, tmp, tmp1, tmp2, ans; while (cin >> b >> n) { if (b == 0 && n == 0) break; for (i = 1; ; i++)

2012-06-09 01:47:12 591

原创 poj 3589 Number-guessing Game

#include #include using namespace std; int main() { string num1, num2; int a, b, tc, i, j; cin >> tc; while (tc--) { cin >> num1 >> num2; a = b = 0;

2012-06-09 01:30:48 478

原创 poj 3536 Beer Refrigerator

#include #include #include using namespace std; int main() { int num, i, j, k, ans, min, a, b, c; cin >> num; ans = INT_MAX; for (i = 1; i <= sqrt(float (num))+1; i++)

2012-06-09 00:40:47 672

原创 poj 3518 Prime Gap

#include #include using namespace std; bool is_primer(int n) { int i, m; if (n == 1) return 1; m = sqrt(float(n)); for (i = 2; i <= m; i++) if (n%i == 0)

2012-06-08 22:26:51 429

原创 poj 3505 Tower Parking

#include //这题如果读不懂题意,就很难对数据进行处理!题意:塔式停车场,每一层都可以停车,当顾客需要取车的时候,升降机就会升降到停车的 //楼层,然后传输带就可以顺时针或者逆时针地进行转动,直到车的所在位置,然后升降机就降到出口处,完成取车的任务!不过过程需要注意 //升降机的升降位置就在上次的取车的位置开始! #include #include #include using

2012-06-08 20:09:38 1381

原创 poj 3507 Judging Olympia

#include #include using namespace std; int grades[6]; int main() { int i, sum; double avg; while (cin >> grades[0] >> grades[1] >> grades[2] >> grades[3] >> grades[4] >> grades[5])

2012-06-08 12:40:14 654

原创 poj 3632 Optimal Parking

#include #include using namespace std; int stores[25]; int main() { int tc, i, storesnum, ans; cin >> tc; while (tc--) { cin >> storesnum; ans = 0; fo

2012-06-08 10:36:51 493

masm.exe link.exe

是汇编语言中需要用到的编译文件masm.exe 和链接文件link.exe

2011-12-08

麻省理工大学的算法导论(英文版)

该书为麻省理工大学的“算法导论”,为英文版,希望可以带给你们方便!

2011-08-21

数据结构算法与应用-C++语言描述

这是一本用c++语言来描述关于数据结构算法与应用的基础书籍,对于刚刚接触算法的人来说,打好基础最重要!

2011-08-19

空空如也

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

TA关注的人

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