没有合适的资源?快使用搜索试试~ 我知道了~
总共拥有100多道经典ACM题目,有测试过程序源代码,全部能运行通过,是学习C和C++的有难度的题!
资源推荐
资源详情
资源评论
第一次 ACM
ACM
ACM
ACM 总结( 7
7
7
7
th
th
th
th
ACM
ACM
ACM
ACM )
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1001
1001
1001
1001 A
A
A
A +
+
+
+ B
B
B
B Problem
Problem
Problem
Problem
.....................................................................................
.....................................................................................
.....................................................................................
.....................................................................................
1
1
1
1
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1037
1037
1037
1037 Gridland
Gridland
Gridland
Gridland
...................................................................................................
...................................................................................................
...................................................................................................
...................................................................................................
2
2
2
2
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1045
1045
1045
1045 HangOver
HangOver
HangOver
HangOver
...............................................................................................
...............................................................................................
...............................................................................................
...............................................................................................
4
4
4
4
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1048
1048
1048
1048 Financial
Financial
Financial
Financial Management
Management
Management
Management
....................................................................
....................................................................
....................................................................
....................................................................
6
6
6
6
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1049
1049
1049
1049 I
I
I
I Think
Think
Think
Think I
I
I
I Need
Need
Need
Need a
a
a
a Houseboat
Houseboat
Houseboat
Houseboat
........................................................
........................................................
........................................................
........................................................
8
8
8
8
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1067
1067
1067
1067 Color
Color
Color
Color Me
Me
Me
Me Less
Less
Less
Less 有问题
....................................................................
....................................................................
....................................................................
....................................................................
11
11
11
11
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1073
1073
1073
1073 Round
Round
Round
Round and
and
and
and Round
Round
Round
Round We
We
We
We Go
Go
Go
Go
............................................................
............................................................
............................................................
............................................................
14
14
14
14
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1113
1113
1113
1113 u
u
u
u Calculate
Calculate
Calculate
Calculate e
e
e
e
......................................................................................
......................................................................................
......................................................................................
......................................................................................
17
17
17
17
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1115
1115
1115
1115 Digital
Digital
Digital
Digital Roots
Roots
Roots
Roots
......................................................................................
......................................................................................
......................................................................................
......................................................................................
19
19
19
19
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1151
1151
1151
1151 Word
Word
Word
Word Reversal
Reversal
Reversal
Reversal
..................................................................................
..................................................................................
..................................................................................
..................................................................................
21
21
21
21
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1216
1216
1216
1216 Deck
Deck
Deck
Deck
........................................................................................................
........................................................................................................
........................................................................................................
........................................................................................................
23
23
23
23
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1240
1240
1240
1240 IBM
IBM
IBM
IBM Minus
Minus
Minus
Minus One
One
One
One
..................................................................................
..................................................................................
..................................................................................
..................................................................................
25
25
25
25
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1241
1241
1241
1241 Geometry
Geometry
Geometry
Geometry Made
Made
Made
Made Simple
Simple
Simple
Simple
................................................................
................................................................
................................................................
................................................................
27
27
27
27
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1251
1251
1251
1251 Box
Box
Box
Box of
of
of
of Bricks
Bricks
Bricks
Bricks
......................................................................................
......................................................................................
......................................................................................
......................................................................................
30
30
30
30
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1292
1292
1292
1292 Integer
Integer
Integer
Integer Inquiry
Inquiry
Inquiry
Inquiry
.................................................................................
.................................................................................
.................................................................................
.................................................................................
32
32
32
32
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1331
1331
1331
1331 Perfect
Perfect
Perfect
Perfect Cubes
Cubes
Cubes
Cubes
.....................................................................................
.....................................................................................
.....................................................................................
.....................................................................................
34
34
34
34
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1337
1337
1337
1337 Pi
Pi
Pi
Pi
...............................................................................................................
...............................................................................................................
...............................................................................................................
...............................................................................................................
36
36
36
36
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1350
1350
1350
1350 The
The
The
The Drunk
Drunk
Drunk
Drunk Jailer
Jailer
Jailer
Jailer
...............................................................................
...............................................................................
...............................................................................
...............................................................................
39
39
39
39
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1382
1382
1382
1382 A
A
A
A Simple
Simple
Simple
Simple Task
Task
Task
Task
....................................................................................
....................................................................................
....................................................................................
....................................................................................
41
41
41
41
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1712
1712
1712
1712 Skew
Skew
Skew
Skew Binary
Binary
Binary
Binary
........................................................................................
........................................................................................
........................................................................................
........................................................................................
43
43
43
43
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1730
1730
1730
1730 Crazy
Crazy
Crazy
Crazy Tea
Tea
Tea
Tea Party
Party
Party
Party
.................................................................................
.................................................................................
.................................................................................
.................................................................................
45
45
45
45
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1760
1760
1760
1760 Doubles
Doubles
Doubles
Doubles
..................................................................................................
..................................................................................................
..................................................................................................
..................................................................................................
47
47
47
47
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1763
1763
1763
1763 A
A
A
A Simple
Simple
Simple
Simple Question
Question
Question
Question of
of
of
of Chemistry
Chemistry
Chemistry
Chemistry
.............................................
.............................................
.............................................
.............................................
49
49
49
49
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1797
1797
1797
1797 Least
Least
Least
Least Common
Common
Common
Common Multiple
Multiple
Multiple
Multiple
................................................................
................................................................
................................................................
................................................................
52
52
52
52
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1871
1871
1871
1871 Steps
Steps
Steps
Steps //
//
//
// 既然没有代码记录 ! ! !
....................................
....................................
....................................
....................................
54
54
54
54
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1879
1879
1879
1879 Jolly
Jolly
Jolly
Jolly Jumpers
Jumpers
Jumpers
Jumpers //
//
//
// 又是没有代码
................................
................................
................................
................................
55
55
55
55
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 1915
1915
1915
1915 Above
Above
Above
Above Average
Average
Average
Average
..................................................................................
..................................................................................
..................................................................................
..................................................................................
56
56
56
56
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2001
2001
2001
2001 Adding
Adding
Adding
Adding Reversed
Reversed
Reversed
Reversed Numbers
Numbers
Numbers
Numbers
.........................................................
.........................................................
.........................................................
.........................................................
58
58
58
58
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2201
2201
2201
2201 No
No
No
No Brainer
Brainer
Brainer
Brainer
............................................................................................
............................................................................................
............................................................................................
............................................................................................
61
61
61
61
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2388
2388
2388
2388 Beat
Beat
Beat
Beat the
the
the
the Spread!
Spread!
Spread!
Spread!
..............................................................................
..............................................................................
..............................................................................
..............................................................................
63
63
63
63
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2947
2947
2947
2947 Abbreviation
Abbreviation
Abbreviation
Abbreviation
.......................................................................................
.......................................................................................
.......................................................................................
.......................................................................................
65
65
65
65
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2965
2965
2965
2965 Accurately
Accurately
Accurately
Accurately Say
Say
Say
Say "CocaCola"!
"CocaCola"!
"CocaCola"!
"CocaCola"!
.......................................................
.......................................................
.......................................................
.......................................................
68
68
68
68
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2969
2969
2969
2969 Easy
Easy
Easy
Easy Task
Task
Task
Task
..............................................................................................
..............................................................................................
..............................................................................................
..............................................................................................
70
70
70
70
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2970
2970
2970
2970 Faster,
Faster,
Faster,
Faster, Higher,
Higher,
Higher,
Higher, Stronger
Stronger
Stronger
Stronger
..............................................................
..............................................................
..............................................................
..............................................................
72
72
72
72
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2987
2987
2987
2987 Misspelling
Misspelling
Misspelling
Misspelling
...........................................................................................
...........................................................................................
...........................................................................................
...........................................................................................
75
75
75
75
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 2988
2988
2988
2988 Conversions
Conversions
Conversions
Conversions
........................................................................................
........................................................................................
........................................................................................
........................................................................................
77
77
77
77
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 3313
3313
3313
3313 Clock//
Clock//
Clock//
Clock// 没有代码 ……
...........................................................................
...........................................................................
...........................................................................
...........................................................................
80
80
80
80
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 3322
3322
3322
3322 Who
Who
Who
Who is
is
is
is Older?
Older?
Older?
Older?
....................................................................................
....................................................................................
....................................................................................
....................................................................................
81
81
81
81
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 3323
3323
3323
3323 Somali
Somali
Somali
Somali Pirates
Pirates
Pirates
Pirates
...................................................................................
...................................................................................
...................................................................................
...................................................................................
83
83
83
83
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 3328
3328
3328
3328 Wu
Wu
Wu
Wu Xing
Xing
Xing
Xing
.................................................................................................
.................................................................................................
.................................................................................................
.................................................................................................
85
85
85
85
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set -
-
-
- 3333
3333
3333
3333 Guess
Guess
Guess
Guess the
the
the
the Price
Price
Price
Price
.................................................................................
.................................................................................
.................................................................................
.................................................................................
88
88
88
88
浙江科技学院 ACM 习题第一次总结 ( 蓝燕 ) 2010-4-19
1
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1001
1001
1001
1001 A
A
A
A +
+
+
+ B
B
B
B Problem
Problem
Problem
Problem
Time Limit: 1 Second Memory Limit: 32768 KB
Calculate [ 计算 ] a + b
Input
Input
Input
Input
The input will consist of a series of pairs of integers a and b,separated by a space, one pair of
integers per line.
Output
Output
Output
Output
For each pair of input integers a and b you should output the sum of a and b in one line,and
with one line of output for each line in input.
Sample
Sample
Sample
Sample Input
Input
Input
Input
1 5
Sample
Sample
Sample
Sample Output
Output
Output
Output
6
思路:
略
代码呈现:
#include<stdio.h>
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)!=EOF) // 无限输入直到遇见 shift+F6 停止
printf("%d\n",a+b);
return 0;
}
代码效果:
浙江科技学院 ACM 习题第一次总结 ( 蓝燕 ) 2010-4-19
2
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1037
1037
1037
1037 Gridland
Gridland
Gridland
Gridland
Time Limit: 1 Second Memory Limit: 32768 KB
Background
Background
Background
Background
For years, computer scientists have been trying to find efficient solutions to different
computing [ 计算 ] problems. For some of them efficient algorithms [ 算法 ] are already available,
these are the "easy" problems like sorting [ 整理;排序;分类拣选 ] , evaluating a polynomial [ 多
项式 ] or finding the shortest path in a graph. For the "hard" ones only exponential-time
algorithms [ 指数时间算法 ] are known. The traveling-salesman problem belongs to this latter
group. Given a set of N towns and roads between these towns, the problem is to compute the
shortest path allowing a salesman to visit each of the towns once and only once and return to
the starting point.
Problem
Problem
Problem
Problem
The president of Gridland has hired you to design a program that calculates the length of the
shortest traveling-salesman tour for the towns in the country. In Gridland, there is one town
at each of the points of a rectangular grid [ 直角坐标网 ] . Roads run from every town in the
directions North, Northwest, West, Southwest, South, Southeast, East, and Northeast,
provided that there is a neighboring town in that direction. The distance between neighboring
towns in directions North-South or East-West is 1 unit. The length of the roads is measured by
the Euclidean distance [ 欧几里得距离 ] . For example, Figure 7 shows 2 * 3-Gridland, i.e., a
rectangular grid of dimensions [ 规模,大小 ] 2 by 3. In 2 * 3-Gridland, the shortest tour has
length 6.
Figure 7: A traveling-salesman tour in 2 * 3-Gridland.
Input
Input
Input
Input
The first line contains the number of scenarios [ 剧情 ( 情况 ) ] .
For each scenario, the grid dimensions m and n will be given as two integer numbers in a
single line, separated by a single blank, satisfying 1 < m < 50 and 1 < n < 50.
Output
Output
Output
Output
The output for each scenario begins with a line containing "Scenario #i:", where i is the
number of the scenario starting at 1. In the next line, print the length of the shortest
traveling-salesman tour rounded to two decimal digits. The output for every scenario ends
with a blank line.
Sample
Sample
Sample
Sample Input
Input
Input
Input
2
2 2
浙江科技学院 ACM 习题第一次总结 ( 蓝燕 ) 2010-4-19
3
2 3
Sample
Sample
Sample
Sample Output
Output
Output
Output
Scenario #1:
4.00
Scenario #2:
6.00
思路:
如果城镇数是偶数,即分布的行和列至少有一个是偶数的时候,我们可以一个个走,正好最后一次回到起
始城镇,即 m*n; 如果是奇数,就是说分布的行和列都是奇数,那么我们倒数第二次到的城镇和起点城镇
之间相距斜线,即 m*n-1+ 根号 2 。
代码呈现:
#include <stdio.h>
#include <math.h>
int main(void)
{
int k,i=1;
float m,n;
scanf("%d",&k); // 循环执行的次数
while(k -- )
{
scanf("%f%f",&m,&n);
if((int)m%2!=0&&(int)n%2!=0)
printf("Scenario #%d:\n%.2f\n\n",i,m*n-1+sqrt(2));
else
printf("Scenario #%d:\n%.2f\n\n",i,n*m);
}
return 0;
}
代码效果:
浙江科技学院 ACM 习题第一次总结 ( 蓝燕 ) 2010-4-19
4
ZOJ
ZOJ
ZOJ
ZOJ Problem
Problem
Problem
Problem Set
Set
Set
Set –
–
–
– 1045
1045
1045
1045 HangOver
HangOver
HangOver
HangOver
Time Limit: 1 Second Memory Limit: 32768 KB
How far can you make a stack of cards overhang a table? If you have one card, you can create
a maximum overhang of half a card length. (We're assuming [ 假设 ] that the cards must be
perpendicular to the table.) With two cards you can make the top card overhang the bottom
one by half a card length, and the bottom one overhang the table by a third of a card length,
for a total maximum overhang of 1/2 + 1/3 = 5/6 card lengths. In general you can make n
cards overhang by 1/2 + 1/3 + 1/4 + ... + 1/(n + 1) card lengths, where the top card
overhangs the second by 1/2, the second overhangs the third by 1/3, the third overhangs the
fourth by 1/4, etc., and the bottom card overhangs the table by 1/(n + 1). This is illustrated
[ 有插图的 ] in the figure below.
The input consists of one or more test cases, followed by a line containing the number 0.00
that signals the end of the input. Each test case is a single line containing a positive
floating-point number c whose value is at least 0.01 and at most 5.20; c will contain exactly
three digits.
For each test case, output the minimum number of cards necessary to achieve an overhang
of at least c card lengths. Use the exact output format shown in the examples.
Example
Example
Example
Example input:
input:
input:
input:
1.00
3.71
0.04
5.19
0.00
Example
Example
Example
Example output:
output:
output:
output:
3 card(s)
61 card(s)
1 card(s)
273 card(s)
思路:
题意:
输入的小数在 0.01-5.20 之间,输出满足 1/2+1/3+ …… +1/ ( n+1 )稍大于小数的 n 的值
1. 无限输入小数
2. 判断该小数是否在 0.01-5.20 之间
3. 对 1/2+1/3+ …… +1/ ( n+1 ) 进行累加 , 同时判断该式子是否大于小数 , 是则输出 n 。 不是则继续循
环直至是
剩余89页未读,继续阅读
资源评论
dengjianqiang2011
- 粉丝: 59
- 资源: 26
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功