- 博客(60)
- 资源 (4)
- 收藏
- 关注
原创 zoj 2345 Gold Coins
//这题主要是找一下规律就可以了:1^2 + 2^2 + 3^2 + ..... + n^2#include "iostream"#include "memory.h"using namespace std;int main(){ int testcase, i, days, coins, temp, remain; cin >> testcase; while (testcas
2012-03-31 12:40:42 753
原创 zoj 2321 Filling Out the Team
//没有仔细的阅读题目,以致在比较的时候漏掉了等于的情况!#include "iostream"#include "string"#include "vector"using namespace std;struct Info{ string pos; double speed; int weight; int strength;};int main(){ int
2012-03-31 12:39:58 445
原创 zoj 2208 To and Fro
#include "iostream"#include "string"#include "algorithm"using namespace std;string str[25];int main(){ int num, i, j, len; string input, ans; while (cin >> num && num) { cin >> input;
2012-03-31 12:38:59 415
原创 zoj 2172 Symmetric Order
#include "iostream"#include "string"#include "vector"using namespace std;int main(){ int num, i, count = 0; string temp1, temp2; vector v; vector v1; vector v2; vector::iterator it; while
2012-03-31 12:38:09 343
原创 zoj 2108 Elevator
#include "iostream"#include "memory.h"#include "cmath"using namespace std;int num[110];int main(){ int N, i, times; while (cin >> N && N) { memset(num, 0, sizeof(num)); times = 0; for
2012-03-31 12:37:17 473
原创 zoj 2104 Let the Balloon Rise
#include "iostream"#include "string"#include "vector"using namespace std;struct ballons{ string color; int count;};int main(){ int N, i; vector v; vector::iterator it; ballons temp; b
2012-03-31 12:36:38 400
原创 zoj 1949 Error Correction
#include "iostream"#include "memory.h"using namespace std;int matrix[110][110], rowsum[110], columnsum[110], rowans[110], columnans[110];int main(){ int n, i, j, rowcount, columncount; while
2012-03-31 12:35:38 318
原创 zoj 1915 Above Average
#include "iostream"#include "algorithm"#include "memory.h"#include "iomanip"using namespace std;int main(){ int num[1010]; int testcase, n, i, sum, average, count; double ans; cin >> testca
2012-03-31 12:34:44 418
原创 zoj 1904 Beavergnaw
#include "iostream"#include "cmath"#include "iomanip"using namespace std;const double pi = 3.1415927;int main(){ double D, V, d, temp; while (cin >> D >> V && D && V) { temp = D * D * D - 6
2012-03-31 12:33:40 513
原创 zoj 1879 Jolly Jumpers
#include "iostream"#include "memory.h"#include "cmath"using namespace std;int num[3010], ans[3010];int main(){ int n, i; bool tag; while (cin >> n) { tag = false; if (n == 1) { for
2012-03-31 12:32:49 462
原创 zoj 1813 Biker's Trip Odometer
#include "stdio.h"#define pi 3.1415927 int main(){ float dia,r,t,dis,mph; int count=0; while(scanf("%f%f%f",&dia,&r,&t)&&r!=0) { dis=dia*pi*r/12/5280;
2012-03-31 12:31:29 676
原创 zoj 1796 Euchre Results
//解一元二次方程组就可以!#include "iostream"using namespace std;int main(){ int w1, l1, w2, l2, w3, l3, sum, gamenum, dif, win, loss; while (cin >> w1 >> l1 >> w2 >> l2 >> w3 >> l3) { sum = w1 + l1 + w
2012-03-31 12:25:15 526
原创 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_back(num); }
2012-03-31 12:24:28 402
原创 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);//放进容器中进行自动排序! el
2012-03-31 12:23:30 397
原创 zoj 1088 System Overload
#include "iostream"#include "stdio.h"#include "memory.h"using namespace std;int citys[160];int temp[160];bool solve(int n, int m){ int r = 1; int i, j; citys[1] = 0; for (i = 2, j = 1; r
2012-03-31 12:22:07 445
原创 zoj 2186 Keep on Truckin'
//超级水题,就是输入三个数,然后与168进行比较!#include "iostream"using namespace std;int main(){ int num[3], i, flag = 0; int temp = 168; for (i = 0; i < 3; i++) { cin >> num[i]; if (num[i] < temp) { co
2012-03-31 12:21:18 304
原创 zoj 2207 Team Rankings
//由字符串“ABCDE”的所有排序(可以通过stl中的next_permutation直接得出)与input中//的字符串进行比较,找出差距值最小的字符串!#include "iostream"#include "map"#include "algorithm"#include "string"#include "limits.h"using namespace std;str
2012-03-31 12:20:27 470
原创 zoj 2358 Sum of Factorials
//刚开始就搞错了,以为是要连续数的阶乘和,原来只是阶乘相加和相等就可以了!#include "iostream"using namespace std;int main(){ int i, n; double ans[11]; ans[0] = 1; for (i = 1; i < 11; i++) ans[i] = ans[i-1] * i; while (cin >>
2012-03-31 12:19:14 447
原创 zoj 2476 Total Amount
//这题主要是大数相加!不过要注意,有小数点!输出的格式也非常严格!WA了很多次,因为没有考虑到全是0.00相加的情况! #include "iostream"#include "string"#include "memory.h"#include "cctype"#include "algorithm"using namespace std;int temp[20
2012-03-31 10:41:37 681
原创 zoj 2481 Unique Ascending Array
//这题主要是在给出的数组中找出不重复的数,并按升序的顺序排序起来!很简单! #include "iostream"#include "algorithm"#include "memory.h"using namespace std;int num[110], ans[110];int main(){ int N, i, j; while (ci
2012-03-31 10:36:21 521
原创 zoj 1730 Crazy Tea Party
//水题不水啊!/*类似冒泡程序 如果所有人是线性排列,那我们的工作就是类似冒泡程序做的工作:1,2,3,4,5变为5,4,3,2,1 ,耗时n(n-1)/2 但是出现了环,也就是说1,2,3,4,5变为3,2,1,5,4也可满足条件 我们可以把这个环等分成两个部分 ,每个部分看成是线性的,再把它们花的时间加起来. 当n是偶数时, 每份人数n/2 ,即 2*(n/2 )*(n/2 -1
2012-03-25 08:50:07 1460
原创 zoj 1751 When Can We Meet?
#include "iostream"#include "memory.h"#include "algorithm"using namespace std;int num[100];int ans[100];int main(){ int committe, quorum, M, i, j, temp1, temp2; bool tag; while (cin >> com
2012-03-24 20:47:52 475
原创 zoj 1494 Climbing Worm
#include "iostream"using namespace std;int main(){ int n, u, d, times, temp; while (cin >> n >> u >> d && n) { times = temp = 0; while (1) { temp += u; times++; if (temp >= n)
2012-03-24 19:32:59 451
原创 zoj 1405 Tanning Salon
#include "iostream"#include "string"using namespace std;int main(){ int beds, i, len, size, count, pos; string ans, customers, temp; while (cin >> beds && beds) { cin >> customers; len =
2012-03-24 13:17:08 537
原创 zoj 1402 Magnificent Meatballs
#include "iostream"#include "memory.h"using namespace std;int meatballs[40];int main(){ int guestnum, i, j, sum1, sum2; while (cin >> guestnum && guestnum) { memset(meatballs, 0, sizeof(me
2012-03-23 23:51:46 351
原创 zoj 1394 Polar Explorer
//WA了很多次,百度了一下,才知道原来是小数与整数之间的错误,还不够细心!#include "iostream"#include "string"using namespace std;const int pi = 3.14159;int main(){ string tag1, tag2; double X, Y, Z, distance, abledistance, re
2012-03-23 22:48:32 742
原创 zoj 1382 A Simple Task
#include "iostream"#include "cmath"using namespace std;int main(){ int testcase, i, num, o, p, temp; cin >> testcase; for (i = 0; i < testcase; i++) { bool tag = false; cin >> num; for
2012-03-23 10:28:25 612
原创 zoj 1365 Mileage Bank
//这一题简单题WA了两次,原因就是在于使用了while(1)这个循环输入条件而没有及时的退出循环,//所以超时了!要特别注意这一些细微之处!#include "iostream"#include "string"using namespace std;int main(){ string str1, str2; int mileage, sum = 0; char class
2012-03-23 09:41:01 712
原创 zoj 1338 Up and Down Sequences
#include "iostream"#include "stdio.h"#include "iomanip"using namespace std;int main(){ int num[30], len, i, uptimes, downtimes, midtimes, sum1, sum2; bool up, down; while (cin >> num[0] && nu
2012-03-23 09:03:11 490
原创 zoj 1712 Skew Binary
#include "iostream"#include "stdio.h"#include "string.h"using namespace std;int main(){ char input[50]; int num[50], len, i, ans, temp, tag; while (scanf("%s", input)) { memset(num, 0, siz
2012-03-21 12:04:47 417
原创 zoj 1874 Primary Arithmetic
#include "stdio.h"#include "iostream"#include "string.h"using namespace std;int main(){ char input1[20], input2[20];//对输入的字符的保存 int num1[20], num2[20];//由字符转换为数字的保存 int len1, len2, i, len, ca
2012-03-21 11:00:38 656
原创 zoj 1006 Do the Untwist
#include "iostream"#include "map"#include "string"#include "memory.h"using namespace std;int main(){ int num, i, len; string str, ans; int ciphercode[80], plaincode[80]; memset(ciphercode,
2012-03-20 20:47:20 361
原创 zoj 1259 Rails
//这题对输入输出格式有比较严格的要求,运用到二重循环来很好地解决了问题!#include "iostream"#include "stack"#include "memory.h"using namespace std;int train[1010];int main(){ stack s; int num, i, A, B, tag; while (cin >> num
2012-03-20 12:03:44 729
原创 zoj 1337 Pi
#include "iostream"#include "memory.h"#include "math.h"#include "stdio.h"using namespace std;int input[60];int main(){ memset(input, 0, sizeof(input)); int num, i, j, count, sumcount,
2012-03-19 19:28:01 367
原创 zoj 1331 Perfect Cubes
#include "iostream"using namespace std;int main(){ int a, b, c, d, temp; for (a = 2; a <= 200; a++) { temp = a * a * a; for (b = 2; ; b++) { if (temp < b * b * b) break; for (c
2012-03-18 23:51:13 501
原创 zoj 1334 Basically Speaking
#include "iostream"#include "map"#include "string"#include "cmath"#include "algorithm"#include "iomanip"using namespace std;int main(){ string str, ans; int b1, b2, i, j, len1, len2, num;
2012-03-18 23:49:24 321
原创 zoj 1334 Basically Speaking
#include "iostream"#include "map"#include "string"#include "cmath"#include "algorithm"#include "iomanip"using namespace std;int main(){ string str, ans; int b1, b2, i, j, len1, len2, num;
2012-03-18 23:49:00 534
原创 zoj 1251 Box of Bricks
#include "iostream"using namespace std;int bricks[60];int main(){ int num, i, sum, average, count, n = 0; while (cin >> num && num) { sum = average = count = 0;
2012-03-17 16:28:08 449
转载 zoj 1242 Carbon Dating
//读了很久都找不出这题的公式,最后只有百度了!哎,笨啊!#include #include using namespace std;double d, w, age, temp;int main(){ int num=1; while (scanf("%lf %lf", &w, &d), w&&d) { printf("Sample #%d
2012-03-16 20:34:47 836
原创 zoj 1115 Digital Roots
//刚开始做这题的时候,以为是一题好简单好简单的题,但是我却无考虑到当输入的数为非常大的时候这种情况!//思考还是不够周密!要加强锻炼才可以!#include "iostream"#include "string"using namespace std;int root (int n){ if (n < 10) return n; else { int temp = n
2012-03-16 20:01:48 725
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人