- 博客(55)
- 资源 (4)
- 收藏
- 关注
原创 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 519
原创 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 557
原创 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 520
原创 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 421
原创 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 398
原创 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 350
原创 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 622
原创 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 467
原创 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 449
原创 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 653
原创 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 543 1
原创 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 376
原创 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 474
原创 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 415
原创 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 519
原创 zoj 2488 Rotten Ropes
//这一题先将绳的最大承受力从大到小排序,然后再逐个逐个判断找出最大的重量就可以!//分析一下题目就很容易理解题目所要求的意思了,就开始我以为要用动态规划来完成的!仔细分析之后才知道原来很简单的一题!#include "iostream"#include "vector"#include "algorithm"using namespace std;bool mycom
2011-12-25 18:24:51 456
原创 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 353
原创 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 375
原创 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 442
原创 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 364
原创 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 597
原创 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 450
原创 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 847
原创 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 424
原创 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 501
原创 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 706
原创 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 688
原创 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 991
原创 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 575
原创 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 631
原创 zoj 2727 List the Book
//虽然是一道水题,但是需要考虑的方面也挺多的,最开始没有考虑到需要进行三级排序:名字>年份>价格//考虑到三级排序之后又没有考虑到格式,哎,编程真的很需要细腻的心思!所以WA了几次!下次需要注意了!#include "iostream"#include "vector"#include "string"#include "algorithm"using namespace
2011-12-21 00:20:01 827 1
原创 zjut 1027 大数的乘法
#include "iostream"#include "string"using namespace std;int main(){ string str; int a, size, temp1; while (cin >> str >> a) { string ans = ""; if (a == 0) cout << "0" << en
2011-12-19 22:31:22 638 1
原创 zjut 1046 绩点计算
//我觉得这题出得不是很好,因为输入的数目有很大的分歧,没有给出一个具体的数!//下面的代码是我参照别人的代码之后,再自己写出的!感觉这题除了输入有点难搞之后,其他的还是比较简单的!#include "iostream"#include "string"#include "vector"#include "algorithm"using namespace std;
2011-12-19 12:47:14 625
原创 zjut 1072 百钱买百鸡问题
#include "iostream"using namespace std;int main(){ int a, b, c; for (a = 0; a < 100/3+1; a++) for (b = 0; b < 100/2+1; b++) { c = 100 - a - b; if (((a * 3 + b *2 + c/3) == 10
2011-12-19 12:04:08 725
原创 zjut 1280 小明A+B
//好郁闷,做这题的时候完全没有想到会溢出,哎,做的题目还是不够多,经验不足啊!#include "iostream"using namespace std;int main(){ int TestCase; cin >> TestCase; while (TestCase--) { int A, B, ans; cin >> A >> B;
2011-12-19 00:15:36 630
原创 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 502
原创 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 468
原创 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 834
转载 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 3512
原创 sicily 1134
#include #include #include using namespace std;struct Info{ int a; int b;};bool comp (const Info &temp1, const Info &temp2){ return temp1.b < temp2.b;}int main(){ i
2011-12-09 00:06:15 739
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人