ZOJ
yzl_rex
这个作者很懒,什么都没留下…
展开
-
ZOJ 1049 I Think I Need a Houseboat
#include "iostream"#include "cmath"using namespace std;const double ip = 3.1415926;const int square = 50;int main(){ int TestCase, casecount = 0; cin >> TestCase; while (TestCase原创 2011-12-16 23:47:32 · 512 阅读 · 0 评论 -
ZOJ 1048 Financial Management
#include "iostream"using namespace std;const int month = 12;int main(){ double money[12], sum = 0.0, average = 0.0; for (int i = 0; i < 12; i++) { cin >> money[i]; sum += money[i];原创 2011-12-16 22:30:09 · 476 阅读 · 0 评论 -
zoj 2727 List the Book
//虽然是一道水题,但是需要考虑的方面也挺多的,最开始没有考虑到需要进行三级排序:名字>年份>价格//考虑到三级排序之后又没有考虑到格式,哎,编程真的很需要细腻的心思!所以WA了几次!下次需要注意了!#include "iostream"#include "vector"#include "string"#include "algorithm"using namespace原创 2011-12-21 00:20:01 · 835 阅读 · 1 评论 -
zoj 1240 IBM Minus One
#include "iostream"#include "string"using namespace std;int main(){ int TestCase, casecount = 0; cin >> TestCase; while (TestCase--) { string str; cin >> str; casecount++;原创 2011-12-21 12:43:53 · 645 阅读 · 0 评论 -
zoj 2812 Quicksum
#include "iostream"#include "map"#include "string"using namespace std;int main(){ string line; while (getline(cin, line) && line[0] != '#') { map m; char ch = 'A'; for (int原创 2011-12-21 12:45:24 · 584 阅读 · 0 评论 -
ZOJ 2478 Encoding
#include "iostream"#include "string"using namespace std;int main(){ int TestCase; cin >> TestCase; while (TestCase--) { string str, first; int length, count = 0; cin >> str;原创 2011-12-22 22:41:28 · 695 阅读 · 0 评论 -
zoj 1383 Binary Numbers
#include "iostream"using namespace std;int main(){ int TestCase; while (cin >> TestCase) { while (TestCase--) { int Num, i = 0, temp, flag = 0; cin >> Num; while (1) {原创 2011-12-22 12:33:31 · 1001 阅读 · 0 评论 -
zoj 1763 A Simple Question of Chemistry
#include "iostream"#include "vector"using namespace std;int main(){ double num; int length; double ans; vector v; while ( 1) { cin >> num; if (num == 999) break; v.push_ba原创 2011-12-23 21:51:21 · 430 阅读 · 0 评论 -
zoj 2001 Adding Reversed Numbers
#include "iostream"#include "string"#include "sstream"#include "stdio.h"#include "algorithm"using namespace std;int main(){ int TestCase; cin >> TestCase; while (TestCase--) {原创 2011-12-23 12:43:27 · 505 阅读 · 0 评论 -
zoj 2886 Look and Say
//这一题和2478差不多,只不过是字符串变长了,如果用cout频繁输出的情况下就会超时!所以用printf!#include "iostream"#include "string"#include "stdio.h"using namespace std;int main(){ int TestCase; cin >> TestCase; while (T原创 2011-12-23 12:02:00 · 716 阅读 · 0 评论 -
zoj 1151 Word Reversal
#include "iostream"#include "string"#include "algorithm"using namespace std;int main(){ int TestCase; while (cin >> TestCase) { while (TestCase--) { int num; cin >> num原创 2011-12-23 21:53:25 · 856 阅读 · 0 评论 -
zoj 2807 Electrical Outlets
#include "iostream"using namespace std;int main(){ int TestCase; cin >> TestCase; while (TestCase--) { int num, sum = 0, temp, ans; cin >> num; for (int i = 0; i < num; i++)原创 2011-12-24 22:56:55 · 449 阅读 · 0 评论 -
zoj 2417 Lowest Bit
#include "iostream"using namespace std;int main(){ int num; while (cin >> num && num != 0) { int count = 0, ans = 1; while (num % 2 != 1) { count++; num /= 2; } fo原创 2011-12-24 23:20:19 · 359 阅读 · 0 评论 -
zoj 2488 Rotten Ropes
//这一题先将绳的最大承受力从大到小排序,然后再逐个逐个判断找出最大的重量就可以!//分析一下题目就很容易理解题目所要求的意思了,就开始我以为要用动态规划来完成的!仔细分析之后才知道原来很简单的一题!#include "iostream"#include "vector"#include "algorithm"using namespace std;bool mycom原创 2011-12-25 18:24:51 · 467 阅读 · 0 评论 -
zoj 2388 Beat the Spread!
#include "iostream"#include "math.h"#includeusing namespace std;int main(){ int TestCase; cin >> TestCase; while (TestCase--) { int s1, s2, ans1, ans2; cin >> s1 >> s2; i原创 2011-12-26 11:52:27 · 425 阅读 · 0 评论 -
zoj 1205 Martian Addition
//这一题主要用到map映射器!要注意进位的处理就可以了!到相加到最后,还需要注意是否有进位!#include "iostream"#include "map"#include "string"#include "algorithm"using namespace std;int main(){ map m; map mm; char ch1 = '0'原创 2011-12-24 13:29:03 · 372 阅读 · 0 评论 -
zoj 2201 No Brainer
#include "iostream"using namespace std;int main(){ int TestCase; cin >> TestCase; while (TestCase--) { int num1, num2; cin >> num1 >> num2; if (num1 >= num2) cout << "MMM原创 2011-12-24 23:06:34 · 379 阅读 · 0 评论 -
zoj 2857 Image Transformation
#include "iostream"#include "vector"using namespace std;int main(){ int N, M, casecount = 0; while (cin >> N >> M && N != 0 && M != 0) { vectorr; vectorg; vectorb; int red,原创 2011-12-23 23:24:46 · 456 阅读 · 0 评论 -
zoj 2109 FatMouse' Trade
#include "iostream"#include "vector"#include "algorithm"using namespace std;struct Info//存储输入食物的信息{ double JavaBean; double CatFood; double rate;};bool mycomp (Info a, Info b)/原创 2011-12-25 23:51:47 · 530 阅读 · 0 评论 -
zoj 2736 Daffodil number
#include "iostream"using namespace std;int main(){ int num; while (cin >> num) { int a, b, c, temp; temp = num; c = num % 10; num = num / 10; b = num % 10; a = num / 10原创 2011-12-24 00:06:21 · 605 阅读 · 0 评论 -
zoj 1037 gridland
//这一题比较简单,主要是想得明白其中的走法就容易解决了!分两种情况!#include "iostream"#include "cmath"using namespace std;const double a = sqrt(double (2));int main(){ int TestCase, casecount = 0; cin >> TestCase原创 2011-12-16 12:37:16 · 847 阅读 · 0 评论 -
ZOJ 题目分类
ZOJ题目分类初学者题:1001 1037 1048 1049 1051 1067 1115 1151 1201 1205 1216 1240 1241 1242 1251 1292 1331 1334 1337 1338 1350 1365 1382 1383 1394 1402 1405 1414 1494 1514 1622 1715 1730 1755 1760 1763 17转载 2011-12-16 11:52:24 · 3526 阅读 · 0 评论 -
zoj 2772 Quick Change
#include "iostream"using namespace std;int main(){ int TestCase, casecount = 0; cin >> TestCase; while (TestCase--) { int money, Q, D, N, P; casecount++; cin >> money; Q原创 2011-12-27 21:37:31 · 565 阅读 · 1 评论 -
zoj 2829 Beautiful Number
#include "iostream"#include "map"using namespace std;int main(){ map m; int count = 0, N, num = 1; while (1)//先将这些数建立在map容器中,然后再查找! { if (num % 3 == 0 || num % 5 == 0) { co原创 2011-12-27 22:27:10 · 460 阅读 · 0 评论 -
zoj 1392 The Hardest Problem Ever
#include "iostream"#include "map"#include "string"#include "ctype.h"using namespace std;int main(){ string input; map m; char ch = 'A'; for (int i = 0; i < 21; i++) m.insert(p原创 2011-12-27 12:36:39 · 479 阅读 · 0 评论 -
zoj 1109 Language of FatMouse
#include "iostream"#include "string"#include "map"using namespace std;int main(){ map m; string str1, str2; while (getline(cin, str1) && str1 != "")//从行输入中分隔两个字符串出来! { int leng原创 2011-12-27 18:31:05 · 381 阅读 · 0 评论 -
zoj 2818 Root of the Problem
#include "iostream"#include "cmath"using namespace std;int main(){ double B, N; while (cin >> B >> N && B && N) { int A = 0; A = pow(double (B), double (1/N)); if (B - pow(dou原创 2011-12-27 22:00:02 · 661 阅读 · 0 评论 -
zoj 2176 Speed Limit
#include "iostream"using namespace std;int main(){ int TestCase; while (cin >> TestCase && TestCase != -1) { int s, t, temp = 0, ans = 0; for (int i = 0; i < TestCase; i++) {原创 2011-12-27 23:20:27 · 474 阅读 · 0 评论 -
zoj 1760 Doubles
#include "iostream"#include "set"using namespace std;int main(){ set s; set::iterator it; int temp; while (cin >> temp && temp != -1) { if (temp != 0) s.insert(temp);//放进容器中原创 2011-12-28 12:49:13 · 361 阅读 · 0 评论 -
zoj 1045 HangOver
#include "iostream"using namespace std;int main(){ double num; while (cin >> num && num) { double sum = 0; double count = 0, n = 2; while (1) { if (sum > num) break;原创 2011-12-28 18:14:51 · 428 阅读 · 0 评论 -
zoj 1078 Palindrom Numbers
#include "iostream"#include "string"#include "vector"using namespace std;int main(){ int num, i; vector v; while (cin >> num && num) { v.clear(); for (i = 2; i < 17; i++)//从2原创 2011-12-28 22:33:28 · 571 阅读 · 0 评论 -
zoj 2830 Champion of the Swordsmanship
#include "iostream"using namespace std;int main(){ int players; while (cin >> players && players) { int count = 0, a, b; while (players) { if (players == 1) { cout原创 2011-12-28 12:31:50 · 627 阅读 · 0 评论 -
zoj 2722 Head-to-Head Match
#include "iostream"using namespace std;int main(){ int num; while (cin >> num && num) { int count = 0, temp = 0; while (num != 1) { temp = num % 2; num /= 2; num +=原创 2011-12-28 13:06:53 · 408 阅读 · 0 评论 -
zoj 1070 Bode Plot
//一题物理题,公式是:VR = VS * R * C * W / sqrt(double (R * R * C * C * W * W + 1))#include "iostream"#include "cmath"using namespace std;int main(){ double VS, R, C, W; int TestCase; while (原创 2011-12-28 18:36:14 · 530 阅读 · 0 评论 -
zoj 2420 Calendar
#include "iostream"#include "vector"#include "string"using namespace std;struct Info//注意这里的类型要为short,如果是int的情况下会超内存!{ short int year; short int day; short int month;};bool IsLe原创 2012-01-07 12:33:06 · 398 阅读 · 0 评论 -
zoj 1073 Round and Round We Go
#include "iostream"#include "string"#include "algorithm"using namespace std;int main(int argc, char* argv[]){ string str; while (cin >> str) { string ss = str; int length = s原创 2012-01-07 19:24:12 · 530 阅读 · 0 评论 -
zoj 2876 Phone List
//这题需要先将给出的数字当字符串输入,然后再进行字符串的排序,最后在字符串中进行字串的查找!#include "iostream"#include "string"#include "vector"#include "algorithm"using namespace std;int main(){ int TestCase; cin >> TestCas原创 2011-12-30 22:12:31 · 526 阅读 · 0 评论 -
zoj 2022 Factorial
//这题我以为是大数相乘的问题,以为会好复杂,原来一百度,是数论的内容,//看来我想得还不是很深入!隔了一段时间没有做题,完全没有状态!#include "iostream"using namespace std;int main(){ int num1; cin >> num1; while (num1--) { int N, num2 = 0; cin >> N;原创 2012-02-28 22:22:37 · 482 阅读 · 0 评论 -
zoj 1414 Number Steps
#include "iostream"using namespace std;int main(){ int TestNum, i, x, y, dot = 0; cin >> TestNum; for (i = 1; i <= TestNum; i++) { cin >> x >> y; if (x != y && y != x - 2) cout << "No N原创 2012-03-07 00:05:12 · 2701 阅读 · 0 评论 -
zoj 1201 Inversion
//发觉自己很久没有做过题了,这题思考了很久都没有思考出来,最后只有百度一下!哎!#include "iostream"#include "string.h"using namespace std;int main(){ int i, j, num; int a[55]; char ch; while (cin >> num && num) { cin >> ch;原创 2012-03-05 20:54:51 · 430 阅读 · 0 评论