ITeye博客

Today is a Gift

ysshuai19 · 共 10 篇文章

POJ 1010 解题报告 STAMPS

考察多判。 遍历所有组合,取出最好组合。 上代码。 #include <iostream> #include <map> #include <cstring> #include <algorithm> using namespace std; int arrStampType[256]; int arrCustomer[256]; int arrAnswer[7]; // 0数据长度 1种类 6tie? void showInput(); void cal(); void calRequest(int iRequest); void judgeBetter(int i, int j, int…

2011-12-18T21:15:24Z · 编程语言 · 评论(0)

POJ 1009 解题报告 Edge Detection

1009是痛苦的一题啊。游程编码问题。 先说思路:只处理变化的点。产生变化的点会影响周围的8个点的编码。没有产生变化的点的编码值与前一天相同。当然,有几个特殊情况需要注意。 先上代码: #include <iostream> #include <algorithm> #include <vector> using namespace std; typedef class Point { public: int iFirst; int iSecond; Point(int iF, int iS): iFirst(iF), iSecond(iS){}; }Pix, Pair; vector<Pa…

2011-12-18T21:13:46Z · 编程语言 · 评论(0)

POJ 1008 解题报告 Maya Calendar

还是要细心啊,题目不难,历法转换。 AC吧,这么简单的题烧这么长时间。。。丢人了。。。。 #include <iostream> #include <string> #include <cstdlib> #include <cstdio> using namespace std; int getTotalDays(string&, string&, string&); string& turnHolly(int, string&); int main () { int iCount; cin >> iCount; cout << iCount << endl; string strDayHa…

2011-12-16T17:54:59Z · 编程语言 · 评论(0)

POJ 1007 解题报告 DNA Sorting

#include <iostream> #include <string> #include <map> using namespace std; class DNA{ public: string strDNA; DNA(string); }; DNA::DNA(string s) { strDNA = s; } int calculateInversionsNum(const string&); bool operator<(const DNA&, const DNA&); int main () { string str; int iNum; int iLength; cin >> i…

2011-12-15T17:43:37Z · 编程语言 · 评论(0)

POJ 1006 解题报告 Biorhythms

同理小学生计算题? 还是我没想到什么? #include <iostream> using namespace std; int getTriple(int, int, int, int); int main () { int iP; int iE; int iI; int iD; int iCount = 0; while (cin >> iP >> iE >> iI >> iD) { iCount ++; if (-1 == iP && -1 == iE && -1 == iI && -1 == iD) { break; } cout << "Case " << iCount << ":…

2011-12-15T17:39:06Z · 编程语言 · 评论(0)

POJ 1005 解题报告 I Think I Need a Houseboat

好吧,小朋友的数学题。 #include <iostream> #include <math.h> using namespace std; const double PI = atan(1.)*4.; int getYear(double, double); int main () { int iInput; double dX; double dY; cin >> iInput; int iCount = iInput; while (iInput --) { cin >> dX >> dY; cout << "Property " << iCount - iInput << ": Th…

2011-12-15T17:36:35Z · 编程语言 · 评论(0)

POJ 1004 解题报告 Financial Management

超水一题。 #include <iostream> using namespace std; int main () { int i = 12; double dSum = 0; double d; while (i--) { cin >> d; dSum += d; } cout << "{1}quot; << dSum/12 << endl; }

2011-12-15T17:34:23Z · 编程语言 · 评论(0)

POJ 1003 解题报告 Hangover

简单题。 注意不要重复计算。 使用二分查找的思想。 AC。 #include <iostream> #include <map> using namespace std; int getCards(map<int, double>&, double); int binaryChop(map<int, double>&, double, int, int); int main () { double dLength; map<int, double> mStdLength; mStdLength[0] = 0; while ( cin >> dLength ) { if (dLength ==…

2011-12-15T17:32:48Z · 编程语言 · 评论(0)

POJ 1002 解题报告 487-3279

典型的字符串处理问题。 刚开始用的vector,果断超时。题目本身没什么难度,只在选择容器上要考虑。 AC咯。 #include <iostream> #include <string> #include <iomanip> #include <map> using namespace std; int nicknameToNumber(string&); int main () { int iPhoneTotal; cin >> iPhoneTotal; map<int, int> mPhone; while (iPhoneTotal--) { string strTemp; cin >>…

2011-11-25T15:53:34Z · 编程语言 · 评论(0)

POJ 1001 解题报告 Exponentiation

高精度浮点数计算。 花了我整整一天时间才写好,POJ上给的测试数据都通过,0的1次方和1的0次方之类的输入和加入一些干扰0的输入测试也都通过,但是提交后AC不了,显示Anwser Wrong,不知道什么问题,也没找出来。崩溃了。 好好练练吧,鉴于道理已明了,先草草结贴,有时间再看。 #include <iostream> #include <vector> #include <string> using namespace std; void getResult(vector< vector<int> >&, string, int); void take0(string&); void t…

2011-11-25T15:15:04Z · 编程语言 · 评论(0)