自定义博客皮肤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

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

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

原创 poj 2739 Sum of Consecutive Prime Numbers

//题目给出一个数,让你求连续的素数相加的和等于这个数的字串个数!(要求是连续的)//例如 41 41 = 2 + 3 + 5 + 7 + 11 + 13 41 = 11 + 13 + 17 41 = 41 这样的素数字串有3个 #include "iostream"#include "cmath"#include "memory.h"using namespace std;i

2012-05-02 19:50:49 354

原创 poj 2159 Ancient Cipher

/*完全没有看懂题意,题目需要求的是:(粘贴别人的题意)这道题如果没看懂题意,绝对不是水题,能愁死你,而如果看懂了的话,的确稍微有点小水。关键是对代替加密和置换加密的理解,题目中给出的例子容易误导你进入误区: 代替加密是按照一定规律来的。所以你会很容易的想到先排序,找两个字符串的差距,如果一样就YES了。。其实,代替加密没有“规律”!A可以对应任意的26个字母。不知道说明白了没有所以 是否

2012-05-01 23:49:05 411

原创 poj 3299 Humidex

//题目很简单:给出两个数,求第三个数! //ln函数在c++中的函数原型是log(),exp()函数是以e为底,x为幂的函数!谨记! #include "iostream"#include "string"#include "cmath"#include "stdio.h"using namespace std;int main(){ string str1, str2

2012-05-01 21:31:35 414

原创 poj1676 What time is it?

//这一题真是耗尽了脑汁也找不出WA在哪!?(好打击人的一题) //我的思路是:将输入的LED时钟还原为数字,然后再一一进行匹配,过程可以进行一些剪枝操作(例如第一个数字不可以大于2,第三个数字不可以大于6)//得出了第一个时钟的正确时间,然后再减去15分钟,得出第二个时钟的时间,再在第二个时钟的字符串中寻找是否存在着这些数字,如果存在,匹配数就加1//到最后如果匹配数大于1又或者为0,就输

2012-05-01 17:12:50 1163

原创 poj 1835 宇航员

//这一模拟题,我之前有接触过,我记得刚开始不会做,然后看了别人的代码,然后再自己写一遍出来,现在再来做的时候,发现自己原来还不会做,所以这次我没有看别人的代码,完全靠自己//的思考解决了这一题!事实证明:没有经过自己思考的东西是记不住和学不会的,以后需要勤动动脑才可以!谨记!//最开始我思考这一模拟题的时候,卡住我思路的是:一直想将宇航员的状态在数组中一一表示出来,然后就可以轻松的求出他的坐

2012-04-30 12:23:40 1386 1

原创 poj 2524 Ubiquitous Religions

//这题是我接触并查集的第二题,好顺利AC了!//题目给出几个数据对,在同一个数据对中的人的信仰是相同的,需要你求出在给定的人数中,有几种信仰!//将有相同信仰的人组成一颗树,然后统计数的棵树,再加上还有统计的人数,就可以得出了答案!#include "iostream"#include "memory.h"#include "set"using namespace std;con

2012-04-27 19:17:04 513

原创 poj 1611 The Suspects

//首次接触并查集,虽然是最基本的题目,但是不是很会做,//所以就看明白了并查集(看算法导论)和别人的代码之后,再自己写出来的!#include "iostream"using namespace std;const int maxsize = 30010;int pa[maxsize];//每一个集合中元素的父节点int ranks[maxsize];//每一个集合中元素的秩in

2012-04-27 10:59:14 362

原创 poj 1003 Hangover

#include "iostream"using namespace std;int main(){ double len, sum; int i; while (cin >> len && len != 0.00) { sum = 0; for (i = 2; ; i++) { sum += 1 * 1.0/i; if (sum > len) br

2012-04-27 10:57:52 444 1

原创 zoj 1090 The Circumference of the Circle

//利用余弦和正弦公式就可以很容易求出半径了!#include "iostream"#include "cmath"#include "cstdio"using namespace std;const double pi = 3.141592653589793;int main(){ double x1, y1, x2, y2, x3, y3; double a2, b2,

2012-04-27 10:00:58 523

原创 poj 1004 Financial Management

#include "iostream"//输入12个数,然后求其平均数!#include "cstdio"using namespace std;int main(){ double num, ans, sum = 0; for (int i = 0; i < 12; i++) { cin >> num; sum += num; } ans = sum / 12;

2012-04-26 23:14:34 474

原创 zoj 1089 Lotto

#include "iostream"#include "cstdio"using namespace std;int main(){ int num[14], n, i, a, b, c, d, e, f, flag = 0; while (cin >> n && n) { if (flag != 0) cout << endl; for (i = 0; i < n

2012-04-25 23:11:48 512

原创 zoj 1086 Octal Fractions

//小数的高精度计算!利用辗转相除就可以!#include "iostream"#include "cstdio"#include "string.h"using namespace std;const int maxsize = 100;int main(){ char input[maxsize], ans[maxsize];//输入和结果的储存! int len, i,

2012-04-24 23:09:05 737

原创 zoj 3202 Second-price Auction

//找出第二大的数和第一大的数的位置!#include "iostream"#include "memory.h"using namespace std;int p[110];int main(){ int tc, n, i, max, smax, pos; cin >> tc; while (tc--) { cin >> n; memset(p, 0, sizeo

2012-04-19 09:53:30 616

原创 zoj 3607 Lazier Salesgirl

#include "iostream"#include "memory.h"#include "iomanip"#include "limits.h"using namespace std;int p[1010], t[1010];int main(){ int i, num; double w, avg, testcase, sum, time; cin >> testc

2012-04-16 20:50:04 1614

原创 zoj 3603 Draw Something Cheat

//本来就是一道简单题,但是没有很好的理解题目,将重复的字符给去掉,所以一直都是WA!//下面参考了别人的代码写出了的!囧!#include "iostream"#include "string"using namespace std;string str[25];int main(){ int testcase, i, j, k, time; cin >> testcase

2012-04-16 12:27:07 1610

原创 zoj 3600 Taxi Fare

#include "iostream"using namespace std;int main(){ int testcase; double s1, s2, ans, d, t; cin >> testcase; while (testcase--) { cin >> d >> t; s1 = s2 = ans = 0; if (d <= 3) { s1

2012-04-15 10:09:04 1452

原创 zoj 3610 Yet Another Story of Rock-paper-scissors

#include "iostream"#include "string"using namespace std;int main(){ int testcase; string str1, str2, str3; cin >> testcase; while (testcase--) { cin >> str1 >> str2 >> str3; cout << str2

2012-04-15 09:53:12 1313

原创 zoj 3609 Modular Inverse

//这题的意思就是:求一个最小的正整数x,使a乘以x对m的取余等于1对m的取余!#include "iostream"using namespace std;int main(){ int testcase, i, a, m; bool flag; cin >> testcase; while (testcase--) { cin >> a >> m; flag = f

2012-04-15 09:48:39 2237

原创 zoj 3191 Strange Clock

//直接就可以写出来了,很简单的一题!#include "iostream"using namespace std;int main(){ int a; while (cin >> a && a != -1) { if (a == 0) cout << "Exactly 3 o'clock" << endl; else if (a > 0 && a < 30)

2012-04-13 13:17:45 643

原创 zoj 3519 Who is the Smartest Man

//简单的贪心题!主要是先对输入的数组进行排序!#include "iostream"#include "algorithm"#include "memory.h"using namespace std;int points[510];int main(){ int N, IP, i, count; while (cin >> N >> IP) { memset(poi

2012-04-13 09:41:52 559

原创 zoj 3492 Kagome Kagome

//这题需要注意就是:它给出的名字的排序是逆序来的!#include "iostream"#include "string"using namespace std;int main(){ int testcase, num, i, ans; string name, str[110]; cin >> testcase; while (testcase--) { cin >

2012-04-12 19:43:44 907 1

原创 zoj 3498 Javabeans

//一开始思考这题的时候,以为是用动态规划来做的,但是再仔细分析,//找不出动态规划的式子,到最后只有百度了!/*题目大意 有n个盒子,编号1到n,第i个盒子里面装有i个javabeans,每次选择一个数字, 有javabeans的个数大于此数字的盒子可以每次拿出那个数字的javabeans, 要拿走左右的javabeans,需要多少次 题目分析 二分法,每次将不小于n/2个ja

2012-04-12 18:49:39 906

原创 zoj 3124 Celebrity jeopardy

//好简单的一题!#include "iostream"#include "string"using namespace std;int main(){ string str; while (getline(cin, str)) { cout << str << endl; }}

2012-04-11 18:57:29 768

原创 zoj 3100 ICPC Score Totalizer Software

//题意:求平均数,去掉一个最高分和一个最低分,再计算平均数!#include "iostream"#include "memory.h"#include "algorithm"using namespace std;int scores[110];int main(){ int num, i, sum, average; while (cin >> num && num)

2012-04-05 10:59:25 517

原创 zoj 2988 Conversions

//单位之间的转换,用一个map映射器就很容易解决!#include "iostream"#include "string"#include "map"#include "iomanip"using namespace std;int main(){ int testcase, count = 0; double n, ans; string measurement; ma

2012-04-05 10:31:56 613

原创 zoj 2897 Misspelling

#include "iostream"#include "string"using namespace std;int main(){ int testcase, count = 0 , pos; string input; cin >> testcase; while (testcase--) { cin >> pos >> input; count++; inp

2012-04-04 16:44:32 529

原创 zoj 2965 Accurately Say "CocaCola"!

//这题作一个简单的分析就可以看出其中的规律了,很简单的规律!#include "iostream"using namespace std;int main(){ int testcase, p; cin >> testcase; while (testcase--) { cin >> p; switch(p) { case 1: cout << "7" << e

2012-04-04 16:28:57 1026

原创 zoj 2947 Abbreviation

#include "iostream"#include "string"using namespace std;string input[5];int main(){ int testcase, i, num1, num2; string temp1, temp2; cin >> testcase; while (testcase--) { for (i = 0; i

2012-04-04 15:43:23 549

原创 zoj 2932 The Seven Percent Solution

#include "iostream"#include "string"#include "map"using namespace std;int main(){ int i, len; string input, ans; mapm; m[' '] = "%20", m['!'] = "%21", m['$'] = "%24", m['%'] = "%25", m['(']

2012-04-04 12:30:48 591

原创 zoj 2850 Beautiful Meadow

//简单题,就是对给出的两个条件进行判断即可!#include "iostream"using namespace std;int meadow[15][15];int main(){ int i, j, N, M; bool flag1, flag2; while (cin >> N >> M && N && M) { flag1 = flag2 = false;

2012-04-04 11:06:49 514

原创 zoj 2744 Palindromes

//这题主要是找回文字符串的个数,可以用DP来做(贴一下别人的代码,学习学习),也可以用分治方法做!//下面是参照别人的代码再自己实现的,因为之前接触的比较少,所以还不是很熟悉这些题的做法!//希望可以学到东西!#include "iostream"#include "string"using namespace std;string s;int len, count;void

2012-04-04 09:44:45 919

原创 zoj 2795 Ambiguous permutations

//这题的大意为:给出一个数组,需要你验证这个数组是否与自己的逆置换数组相等!//逆置换:例如给出数组1,4,3,2,而原来的数组顺序为1, 2, 3, 4,就根据给出的数组作为原来数组排序的下标,//得出的逆置换为1, 4, 3, 2,与给出的数组相等,所以就为模糊排序!#include "iostream"#include "memory.h"using namespace std;

2012-04-04 09:15:18 523

原创 zoj 2781 Rounders

//这题的大意就是对输出的数字进行判断,对于每一位数字,凡是满5就进1!#include "iostream"#include "string"#include "cmath"using namespace std;int main(){ int testcase, i, len, temp1, temp2, ans; string num; cin >> testcase;

2012-04-03 23:46:15 430

原创 zoj 2773 Triangular Sums

//很简单,求和,求加权和!#include "iostream"using namespace std;int sum(int num)//{ int temp, i; temp = 0; for (i = 1; i <= num + 1; i++) temp += i; return temp;}int main(){ int i, testcase, n, c

2012-04-03 22:51:27 408

原创 zoj 2679 Old Bill

//这题的大意是:给定你一个五位数,但头和尾的数缺失,需要你找出头和尾的两个数(注意:头的数不为0)//如果有多种情况的,就输出其最大的那个数!#include "iostream"#include "algorithm"using namespace std;struct Info{ int firstnum; int endnum; int price;}info[100

2012-04-03 16:28:05 544

原创 zoj 2659 Box

/*判断六个矩形能否组成长方体,我们只要找到一组充要条件去判断即可这里用的就是把边排序,然后根据对面必相等,相邻面有边重合判断 *///看了别人代码,再自己写出来的,无什么心情写这一题!囧!#include "iostream"#include "stdio.h"#include "algorithm"using namespace std;struct Rect{ int

2012-04-03 12:10:56 522

原创 zoj 2554 Brownie Points

//刚开始,读了很久题目,也不是很明白题目的要求是什么!经过再三阅读,才明白!//题目要求是:在给出的这么多个坐标中,取中间的坐标为原点,然后分别统计落在第一和第三象限,//第二和第四象限的坐标点个数!#include "iostream"using namespace std;struct Info{ int x; int y;};Info info[200010];i

2012-04-03 09:51:11 392

原创 zoj 2548 Prerequisites?

//这题属于简单题,只要你有耐心读懂题目就很简单了!#include "iostream"#include "string"#include "memory.h"using namespace std;string chosencourses[110];//已选课程string categorycourses[110];//分类中的课程bool flag[110];int ma

2012-04-02 12:16:14 482

原创 zoj 2514 Generate Passwords

//题目比较简单,就按题目的要求,如果密码有得修改的就修改,如果没有就输出!#include "iostream"#include "string"#include "map"#include "vector"using namespace std;struct Info{ string name; string password;};int main(){ int

2012-04-02 10:25:52 524

原创 zoj 2482 IP Address

//这题主要是将IP地址转换为十进制表示!#include "iostream"#include "string"#include "cmath"using namespace std;int main(){ int N, i, j, k, sum, output[4]; string input, temp[4]; cin >> N; for (i = 0; i < N;

2012-04-01 10:46:38 398

masm.exe link.exe

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

2011-12-08

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

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

2011-08-21

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

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

2011-08-19

空空如也

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

TA关注的人

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