- 博客(47)
- 资源 (4)
- 收藏
- 关注
原创 poj 2051 Argus
//这道题就是说,给你个id号,给你个周期,然后每个周期就会输出一次id,对于测试样例,200先输出一次2004,然后300输出2005,400的时候就是2004,600时候两个都要输出,那么按id的升序输出2004然后2005,输出了5个数据了,结束了···//前面说的全是废话,但是需要注意其周期为0的时候,就相当于优先级是最高的,所以总是输出其周期为0的且id号最小的那个! #includ
2012-05-31 08:22:45 1064
原创 poj 2302 Traditional BINGO
//就是按下面的数一个一个处理,如果是已有的牌则标记上,如果有任意横排,竖排,或斜排的数都被标记了则游戏结束#include using namespace std;int bingo[5][5];int num[75];int main(){ int tc, i, j, k, c; bool flag1, flag2, flag3, flag4; cin
2012-05-30 20:42:21 751
原创 poj 2304 Combination Lock
//这题读懂题意就可以:题目是所锁上面的红色的那个刻度走过了的度数是多少?! #include using namespace std;int main(){ int pos1, pos2, pos3, pos4, ans; while (cin >> pos1 >> pos2 >> pos3 >> pos4) { if (pos1 == 0
2012-05-30 19:56:40 684
原创 poj 1234 Ball Toss
//贡献了一次WA,原因是忽略了下面这句话:“Note that classmate number 1 initially has the ball and tosses it to classmate k. //Thus, number 1 has not yet been tossed the ball and so does not switch the direction he is t
2012-05-28 14:01:50 1602
原创 poj 1350 Cabric Number Problem
//这一题的陷阱多多,贡献了2次OLE,一次WA!哎!陷阱:需要保证输入的数必须为4位,不能大于或小于4位,要不就OLE! 输出的是No,Ok而不是no ,ok #include #include #include #include using namespace std;bool cmp(char a, char b){ return a > b;}int mai
2012-05-25 23:04:16 592
原创 poj 1323 Game Prediction
//这一题根本上就不用考虑有多少个人来玩,只是考虑有两手牌就可以了,一组是给出的牌,一组是除了给出的牌之外,剩下的牌就可以//将两手牌分别储存在两个数组中,然后从小排序,最后运用贪心就可以了! #include #include #include using namespace std;int card1[1010], card2[1010], card3[1010];int m
2012-05-25 19:53:39 599
原创 poj 2339 Rock, Scissors, Paper
//开始做这一题的时候,读题都读了很久,完全没有读懂,感觉这一题也出得太烂了,题意的疑点成千上万,让人无从下手!//最后只有看别人的解题报告才知道!题意:在一个二维方格中,有三种物种:P,S,R 他们会互相进行攻击,P可以打败R,S可//打败P,R可打败S,他们每天都会发生战争,别打败的物种的方格会别打胜的物种霸占,问经过n天之后,方格上的物种位置情况如何!//这一题需要注意的是: 他们战斗
2012-05-25 10:14:28 1110
原创 poj 2993 Emag eht htiw Em Pleh
//这一题就是2996的逆转输出!这题需要注意的地方是:输入的white和black的顺序可以捣乱!在第一次做这题的时候,我竟然因为代码太长而提交不了,哈哈哈,第一次出现这样的情况//第一次做的时候,主要是因为没有应用到map容器,所以我的代码就是一堆的if...else if...。在写的时候我都觉得不妥的了,//但是硬着头皮去试试啦,既然想到了,不可能不写出来的! #include #
2012-05-25 00:44:25 440
原创 poj 2996 Help Me with the Game
//做模拟题的代码总是令人恶心,或者是自己的思维还不够灵活吧,只可以一步一步地进行模拟,所以代码才会那么恶心,需要努力进行改进才可以! #include #include #include #include #include using namespace std;vector black;//黑色棋子的位置储存 vector white;//白色棋子的位置储存 vector:
2012-05-24 01:37:04 429
原创 poj 1573 Robot Motion
//就开始做这一题的时候(下面的代码),竟然WA了两次:内存超出! 主要是写代码的时候写的复杂了 //以下是用一个数组储存已经行走过的点和所需要的步数!这样就简化了不少! #include "iostream"#include "string"#include "cctype"using namespace std;char path[12][12];int havewalk[12
2012-05-23 19:54:26 448
原创 poj 2632 Crashing Robots
//又长又丑的代码,本来想先写代码出来,实现了,再作修改,但是再看起来的时候,自己都感觉到恶心了!所以在这里就不做修改了,加上注释就算了!懒啊!// 要注意这句:Only the first crash is to be reported,即是说先发生碰撞的先输出! 还有一个注意方面就是:一边进行instruction时就要一边进行判断,//如果有满足的就及时退出,不再进行判断了,要不肯定会W
2012-05-23 00:50:36 499
原创 poj 1218 THE DRUNK JAILER
#include "iostream"#include "memory.h"using namespace std;int cell[110];int main(){ int tc, num, i, j, ans; cin >> tc; while (tc--) { memset(cell, 0, sizeof(cell));
2012-05-22 13:02:05 340
原创 poj 2317 SHAKE
//矩形矩阵加密,有三种方法,要模拟这三种方法 ,第一,第二种加密方法比较容易实现,第三种方法比较麻烦,有点类似于//蛇形填数的方法一样,只要认真地模拟一次,也是很容易就出来了! #include "iostream"#include "string"#include "cctype"using namespace std;char matrix[110][110];void s
2012-05-22 10:12:52 636
原创 poj 1008 Maya Calendar
//注意日期总数的计算方法就可以了! #include "iostream"#include "string"#include "map"using namespace std;map m1;map m2;int main(){ m1["pop"] = 1, m1["no"] = 2, m1["zip"] = 3, m1["zotz"] = 4, m1["tzec"]
2012-05-21 12:03:40 437
原创 poj 1207 The 3n + 1 problem
//这题贡献了一次WA,原因是由于没有考虑到输入的两个数中,有可能后面的数大于前面的数 ! #include "iostream"using namespace std;int solve(int num){ int i, c = 1; if (num == 1) return c; else { while (num != 1)
2012-05-19 09:34:15 508
原创 poj 2015 Permutation Code
#include "iostream"#include "cmath"#include "cstdio"#include "string"using namespace std;int main(){ int n, x, d, spos[300], i, lens, lenc, t, a, b; string s, p, c; char m[200];
2012-05-19 08:49:02 790
原创 poj 2105 IP Address
#include "iostream"#include "string" #include "cmath"using namespace std;int main(){ int tc, i, j, k, ans[4], len; string input; cin >> tc; while (tc--) { memset(an
2012-05-18 09:48:04 356
原创 poj 2141 Message Decowding
#include "iostream"#include "map"#include "string"#include "cctype"using namespace std;map m;int main(){ string input, key; int len, i; cin >> key; cin.get(); len = key.le
2012-05-18 08:54:15 623
原创 poj 2070 Filling Out the Team
#include "iostream"#include "string"using namespace std;struct Info{ string pos; double speed; int weight; int strength;};int main(){ bool flag; double sp; int w, s, i
2012-05-16 20:30:43 551
原创 poj 2039 To and Fro
#include "iostream"#include "string"#include "algorithm"using namespace std;string str[200];int main(){ int num, len, i, j, r; string input; while (cin >> num && num) {
2012-05-16 20:07:37 594
原创 poj 2013 Symmetric Order
#include "iostream"#include "vector"#include "string"#include "algorithm"using namespace std;vector v1;vector v2;vector::iterator it1;vector::iterator it2;int main(){ int num, i, j, k, co
2012-05-16 19:09:36 1252
原创 poj 2081 Recaman's Sequence
//这样的题很容易超时,所以就开两个数组,一个保存结果,一个保存已经出现过的结果,这样就容易判断了,//如果再倒过来判断是否出现在字符串出现,就超时了! /*#include "iostream"#include "memory.h"using namespace std;int a[500005];bool flag[20000000];int main(){ int
2012-05-15 23:22:29 415
原创 poj 2017 Speed Limit
#include "iostream"using namespace std;int main(){ int num, i, s, t, temp, ans; while (cin >> num && num != -1) { temp = ans = 0; for (i = 0; i < num; i++)
2012-05-15 21:38:56 437
原创 poj 2000 Gold Coins
//简单的数学题! #include "iostream"using namespace std;int main(){ int days, i, ans, sum; while (cin >> days && days) { sum = 0; ans = 0; for (i = 1; ; i++)
2012-05-15 12:49:26 531
原创 poj 2503 Babelfish
//用一个映射器就很容易解决问题了! #include "iostream"#include "string"#include "map"using namespace std;map m;int main(){ string input, first, second; int pos, i, len; while (getline(cin, input)
2012-05-11 09:33:05 304
原创 poj 2027 No Brainer
#include "iostream"using namespace std;int main(){ int tc, eat, alive; cin >> tc; while (tc--) { cin >> eat >> alive; if (eat < alive) cout << "NO
2012-05-11 09:12:02 394
原创 poj 2551 Ones
#include "iostream"#include "cstdio"using namespace std;int main(){ int n, cnt, ans; while (scanf("%d", &n) != EOF) { ans = 1; cnt = 1; while (1) {
2012-05-11 09:02:46 479
原创 poj 1068 Parencodings
//比较简单的模拟题,只要还原出原来最初始的括号字符串就很容易得出第二种模式的表示! #include "iostream"using namespace std;int s[50], p[30], w[30];int main(){ int tc, n, i, j, k, count; cin >> tc; while (tc--) {
2012-05-10 01:24:25 632
原创 poj 1928 The Peanuts
//照着地图取花生,每次都是取最大的花生数,在限定的步数内,可以取到最多的花生数!用贪心就可以! #include "cstdio"#include "iostream"#include "math.h"using namespace std;int map[60][60];int main(){ int tc, m, n, k, i, j, totaltime, cur
2012-05-10 00:02:25 1586
原创 poj 1045 Bode Plot
/*下面需要推导一下求VR的公式:V2=iR=CR d/dt (VS*cos(wt)-VR*cos(wt+q))=VRcos(wt+q) = CR w (sin(wt+q)-sin(wt))=VRcos(wt+q)下面用到高中数学当中的计算方法,分别令 t=0 和 wt+q=0 ,得到 CRw tan b = 1 和 VR=CRw VS sin b ,然后利用三角函数中
2012-05-09 10:00:08 1206
原创 poj 1046 Color Me Less
//简单题,由于数组开小了,WA了一次,水啊! #include "iostream"#include "climits"#include "cstdio"using namespace std;struct Info{ int r; int g; int b;};int main(){ Info info[20], temp, ans;
2012-05-09 09:23:10 456
原创 poj 2271 HTML
#include "iostream"#include "string"using namespace std;int main(){ string input; int countnum = 0, i; while (cin >> input) { if (input == "") {
2012-05-09 08:42:42 635
原创 poj 1298 The Hardest Problem Ever
//第一次竟然因为map的映射中写错了一个而WA了一次,哎,粗心! #include "iostream"#include "string"#include "map"#include "cctype"using namespace std;map m;int main(){ m['A'] = 'V', m['B'] = 'W', m['C'] = 'X', m['
2012-05-09 00:26:08 371
原创 poj 1002 487-3279
//写了一个晚上,用c++的map和string等一系列的库函数,一直都超时,不得不看解题报告了,发觉其他人的处理真的很//奇妙,自己还需要再学习学习才可以!加油,努力! //G++环境下提交 #include "iostream"#include "cstdio"#include "algorithm"using namespace std;char str[100];int
2012-05-08 23:06:41 1673
原创 poj 1005 I Think I Need a Houseboat
//给出两点坐标, 求出半径,求面积就可以!简单题! #include "iostream"#include "cmath"using namespace std;const double pi = 4.0 * atan(1.0);const int d = 50;int main(){ int tc, count = 0, ans; double x, y, a
2012-05-08 10:23:56 397
原创 poj 1016 Numbers That Count
//由于使用了c++,所以超时了,改为c语言才可以! #include "iostream"#include "string"#include "memory.h"#include "vector"#include "sstream"using namespace std;int c[10];vector v;//储存15个字符串转换的结果 string countnum(s
2012-05-08 00:48:00 381
原创 poj 1007 DNA Sorting
#include "iostream"#include "string"#include "algorithm"using namespace std;struct Info{ string str; int count;}info[110];bool cmp(Info a, Info b){ return a.count < b.count;}
2012-05-07 13:18:23 394
原创 poj 1281 MANAGER
//这题属于简单的模拟题,主要是用两个容器来储存增加进来的cost和删除的cost即可!然后再根据给出的删除清单,在储存删除的容器中进行!//就开始的时候WA了一次,是因为输出格式的问题,值得注意! #include "iostream"#include "string"#include "set"#include "vector"using namespace std;multi
2012-05-07 01:35:24 840
原创 poj 3094 Quicksum
#include "iostream"#include "map"#include "string"using namespace std;map m;int main(){ string input; int i, len, sum; for (i = 0; i < 26; i++) m['A'+i] = i + 1; m[' ']
2012-05-06 18:13:26 376
原创 poj 1503 Integer Inquiry
#include "iostream"#include "string"using namespace std;int main(){ int i, j, lans, linput, temp, jin; string ans, input; cin >> ans; while (cin >> input && input != "0") {
2012-05-06 18:00:47 385
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人