-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
169 changed files
with
5,025 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ pout | |
gout | ||
OpenJudge/rawoj | ||
ProblemSet/sdutacm | ||
OpenJudge/sdutpro.py | ||
OpenJudge/sdutpro.py | ||
venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
153 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 1!+2!+…+k!=? | ||
Time Limit: 1 Sec Memory Limit: 2 MB | ||
|
||
|
||
## Description | ||
求1!+2!+…+k!=?,并判断是否溢出。 | ||
|
||
## Input | ||
输入为一个正整数k。 | ||
|
||
## Output | ||
若1!+2!+…+k!的值溢出unsigned(无符号整型)的范围输出“overflow”,否则输出1!+2!+…+k!的结果。 | ||
|
||
## Sample Input | ||
``` | ||
5 | ||
``` | ||
## Sample Output | ||
``` | ||
153 | ||
``` | ||
|
||
## HINT | ||
如果一个值溢出某个变量的数据类型存储范围,但仍然存入该变量,那么存入该变量中的值实际上是什么? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
12 57 | ||
9 -3 | ||
-12 4 | ||
3 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
57 12 | ||
-3 9 | ||
4 -12 | ||
5 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# 编写函数:Swap (I) (Append Code) | ||
Time Limit: 1 Sec Memory Limit: 16 MB | ||
|
||
|
||
## Description | ||
|
||
编写用来交换两个数的函数,使得“Append Code”中的main()函数能正确运行。 | ||
|
||
----------------------------------------------------------------------------- | ||
用C实现三个函数int_swap()、dbl_swap()、SWAP(),其中SWAP()是个带参宏。 | ||
用C++实现两个函数,都以swap()命名。 | ||
以上函数的调用格式见“Append Code”。这里不给出函数原型,它们的参数请通过main()函数自行确定。 | ||
|
||
|
||
## Input | ||
输入为4行,每行2个数。 | ||
|
||
## Output | ||
输出为4行,每行2个数。每行输出的两数为每行输入的逆序。 | ||
|
||
## Sample Input | ||
``` | ||
12 57 | ||
9 -3 | ||
-12 4 | ||
3 5 | ||
``` | ||
## Sample Output | ||
``` | ||
57 12 | ||
-3 9 | ||
4 -12 | ||
5 3 | ||
``` | ||
|
||
## HINT | ||
“Append Code”中用到的头文件、全局变量或宏的定义应自行补充。 | ||
|
||
## Append Code | ||
### append.c | ||
```c | ||
int main() | ||
{ | ||
int x1, y1, t1; | ||
double x2, y2, t2; | ||
|
||
scanf("%d %d", &x1, &y1); | ||
int_swap(&x1, &y1); | ||
printf("%d %d\n", x1, y1); | ||
|
||
scanf("%d %d", &x1, &y1); | ||
SWAP(t1, x1, y1); | ||
printf("%d %d\n", x1, y1); | ||
|
||
scanf("%lf %lf", &x2, &y2); | ||
dbl_swap(&x2, &y2); | ||
printf("%lg %lg\n", x2, y2); | ||
|
||
scanf("%lf %lf", &x2, &y2); | ||
SWAP(t2, x2, y2); | ||
printf("%lg %lg\n", x2, y2); | ||
} | ||
|
||
``` | ||
### append.cc | ||
```cppint main() | ||
{ | ||
int x1, y1; | ||
cin>>x1>>y1; | ||
swap(&x1, &y1); | ||
cout<<x1<<" "<<y1<<endl; | ||
cin>>x1>>y1; | ||
swap(x1, y1); | ||
cout<<x1<<" "<<y1<<endl; | ||
double x2, y2; | ||
cin>>x2>>y2; | ||
swap(&x2, &y2); | ||
cout<<x2<<" "<<y2<<endl; | ||
cin>>x2>>y2; | ||
swap(x2, y2); | ||
cout<<x2<<" "<<y2<<endl; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
10 | ||
1 2 3 4 5 6 7 8 9 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 多少个正整数? | ||
Time Limit: 1 Sec Memory Limit: 2 MB | ||
|
||
|
||
## Description | ||
给出不超过100个整数,输出其中有多少个正数。 | ||
|
||
|
||
|
||
|
||
## Input | ||
输入分为2行。第一行是一个0<N<=100,表示下一行有N个整数。 | ||
第2行是N个整数,均在int类型的表示范围内。 | ||
|
||
## Output | ||
一个数字,表示输入中正数的个数。 | ||
|
||
|
||
## Sample Input | ||
``` | ||
10 | ||
1 2 3 4 5 6 7 8 9 10 | ||
``` | ||
## Sample Output | ||
``` | ||
10 | ||
``` | ||
|
||
## HINT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1 2 3 1 | ||
2 2 3 1 | ||
3 1 2 3 | ||
4 3 1 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
case 1 : | ||
plate 1 : from 2 to 1 | ||
|
||
case 2 : | ||
plate 1 : from 2 to 3 | ||
plate 2 : from 2 to 1 | ||
plate 1 : from 3 to 1 | ||
|
||
case 3 : | ||
plate 1 : from 1 to 3 | ||
plate 2 : from 1 to 2 | ||
plate 1 : from 3 to 2 | ||
plate 3 : from 1 to 3 | ||
plate 1 : from 2 to 1 | ||
plate 2 : from 2 to 3 | ||
plate 1 : from 1 to 3 | ||
|
||
case 4 : | ||
plate 1 : from 3 to 1 | ||
plate 2 : from 3 to 2 | ||
plate 1 : from 1 to 2 | ||
plate 3 : from 3 to 1 | ||
plate 1 : from 2 to 3 | ||
plate 2 : from 2 to 1 | ||
plate 1 : from 3 to 1 | ||
plate 4 : from 3 to 2 | ||
plate 1 : from 1 to 2 | ||
plate 2 : from 1 to 3 | ||
plate 1 : from 2 to 3 | ||
plate 3 : from 1 to 2 | ||
plate 1 : from 3 to 1 | ||
plate 2 : from 3 to 2 | ||
plate 1 : from 1 to 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# The Hanoi Tower | ||
Time Limit: 1 Sec Memory Limit: 16 MB | ||
|
||
|
||
## Description | ||
“Hanoi Tower”问题的背景和搬移规则大家是否都很熟悉了?为了突出重点,我把问题描述放在下面的HINT部分,不了解的同学可以参考。 | ||
|
||
|
||
首先我们Hanoi塔上的盘子按从上到下编号,假设Hanoi塔上有n个盘子,那么最小的那个盘子就是1号盘子,然后是2号、3号……最大的盘子是n号。 | ||
|
||
Hanoi塔的3根针我们也进行编号,最左边的是1号,中间的是2号,最右边的是3号。 | ||
|
||
如果我们想把n=2个盘子从1号针搬到2号针,那么3号针作为暂存使用。整个搬移过程是这样的: | ||
|
||
1号盘子:从1号针搬到3号针 | ||
2号盘子:从1号针搬到2号针 | ||
1号盘子:从3号针搬到2号针 | ||
|
||
|
||
你的任务是编个程序把上面的搬移过程输出来,程序需要输入盘子的个数n,并且这n个盘子一开始在哪根针,要搬到哪根针都是从输入得到的。 | ||
|
||
|
||
## Input | ||
|
||
输入为多行,至EOF结束。 | ||
|
||
每行输入四个整数,第一个整数为盘子数n(1<=n<=10),后面的三个整数是三根针的编号,它们排列的顺序是有不同含义的:第二个整数是n个盘子一开始的位置,第四个整数是盘子最终要放置的位置,第三个整数是搬移过程中用来暂存盘子的。 | ||
|
||
如: | ||
输入“1 2 3 1”表示只有一个盘子,从第2根针搬到第1跟针上。 | ||
|
||
|
||
## Output | ||
每一行输入都对应一个搬移过程,首先输出一个“case i”,表示对应的第i个输入。然后再它后面输出搬移的步骤。如: | ||
|
||
输入“1 2 3 1”表示只有一个盘子,从第2根针搬到第1跟针上。那么它的搬移步骤只有一步:把1号盘子从第2跟针搬到第1跟针,即输出: | ||
plate 1 : from 2 to 1 | ||
|
||
|
||
|
||
## Sample Input | ||
``` | ||
1 2 3 1 | ||
2 2 3 1 | ||
3 1 2 3 | ||
4 3 1 2 | ||
``` | ||
## Sample Output | ||
``` | ||
case 1 : | ||
plate 1 : from 2 to 1 | ||
case 2 : | ||
plate 1 : from 2 to 3 | ||
plate 2 : from 2 to 1 | ||
plate 1 : from 3 to 1 | ||
case 3 : | ||
plate 1 : from 1 to 3 | ||
plate 2 : from 1 to 2 | ||
plate 1 : from 3 to 2 | ||
plate 3 : from 1 to 3 | ||
plate 1 : from 2 to 1 | ||
plate 2 : from 2 to 3 | ||
plate 1 : from 1 to 3 | ||
case 4 : | ||
plate 1 : from 3 to 1 | ||
plate 2 : from 3 to 2 | ||
plate 1 : from 1 to 2 | ||
plate 3 : from 3 to 1 | ||
plate 1 : from 2 to 3 | ||
plate 2 : from 2 to 1 | ||
plate 1 : from 3 to 1 | ||
plate 4 : from 3 to 2 | ||
plate 1 : from 1 to 2 | ||
plate 2 : from 1 to 3 | ||
plate 1 : from 2 to 3 | ||
plate 3 : from 1 to 2 | ||
plate 1 : from 3 to 1 | ||
plate 2 : from 3 to 2 | ||
plate 1 : from 1 to 2 | ||
``` | ||
|
||
## HINT | ||
梵塔问题出自古印度的数学故事。历史学家鲍尔在《数学拾零》一书中是这样讲述这段故事的:在世界中心贝拿勒斯的圣庙里,安放着一个黄铜板,板上插着三根宝石针。每根针高约20英寸。梵天在创造世界的时候,在其中一根针上从下到上放了由大到小的64块金片,这就是梵塔(见图1.1)。不论白天黑夜,都有一个值班的僧侣按照梵天不渝的法则,把这些金片在三根针上移来移去:一次只能移一片,金片只能放在三根针上,并且要求在每根针上,都不能出现大片在上小片在下的情况。当所有64片都从梵天创造世界时所放的那根针移到另外一根针上时,世界就将在一声霹雳中消灭,梵塔、庙宇和众生都将同归于尽。 | ||
这个故事听起来很可怕。只要那些值班的僧侣按照“梵天不渝”的法则把64块金片从一根针移到另一根针上,世界末日就会到来。那么,僧侣们完成梵塔的移动工作需要多少时间呢? | ||
|
||
梵塔中共有64块金片,要把它们从一根针按“梵天不渝”的法则移到另一根针,即使僧侣们一次错误也不犯,也需移动264-1 = 18,446,744,073,709,511,615次。如果移动一块金片需要一秒钟,也要近58万亿年才能完成,根据宇宙进化论的推算,整个太阳系的寿命大约200亿年。可见,我们大可不必为梵塔故事的寓言而恐慌。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
10 | ||
Tom 46 | ||
Jerry 88 | ||
Zhang3 99 | ||
Li4 100 | ||
Wang5 95 | ||
Zhao6 60 | ||
Liu7 1 | ||
Wang8 0 | ||
Song9 5 | ||
Ma10 45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Tom |============================================== | ||
Jerry |======================================================================================== | ||
Zhang3 |=================================================================================================== | ||
Li4 |==================================================================================================== | ||
Wang5 |=============================================================================================== | ||
Zhao6 |============================================================ | ||
Liu7 |= | ||
Wang8 | | ||
Song9 |===== | ||
Ma10 |============================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# 成绩的柱状图 | ||
Time Limit: 1 Sec Memory Limit: 2 MB | ||
|
||
|
||
## Description | ||
柱状图(Histogram),也称条图(英文:bar graph)、长条图(英文:bar chart)、条状图,是一种以长方形的长度为变量的表达图形的统计报告图,由一系列高度不等的纵向条纹表示数据分布的情况,用来比较两个或以上的价值(不同时间或者不同条件),只有一个变量,通常利用于较小的数据集分析。柱状图图亦可横向排列,或用多维方式表达。 | ||
你的任务是把学生成绩转换成直观的柱状图表示。 | ||
|
||
|
||
## Input | ||
第一行为一个整数N(N<=200),表示有N个学生。后面有N行输入。每行有两部分,第一部分是学生姓名(不超过8个字符,且不含空白符);第二部分是学生的成绩,均为0~100之间的整数。 | ||
|
||
|
||
## Output | ||
输出有N行,顺序与输入对应,每行包括以下内容: | ||
1. 学生的姓名,占8个字符、右对齐; | ||
2. 一个空格; | ||
3. 一条竖线,用“|”表示; | ||
4. 一个表示分数的长条:由“=”组成。学生成绩为x,就输出一个长度为x个长条。长条是左对齐的; | ||
5. 一个回车(用来换行!)。 | ||
|
||
|
||
|
||
## Sample Input | ||
``` | ||
10 | ||
Tom 46 | ||
Jerry 88 | ||
Zhang3 99 | ||
Li4 100 | ||
Wang5 95 | ||
Zhao6 60 | ||
Liu7 1 | ||
Wang8 0 | ||
Song9 5 | ||
Ma10 45 | ||
``` | ||
## Sample Output | ||
``` | ||
Tom |============================================== | ||
Jerry |======================================================================================== | ||
Zhang3 |=================================================================================================== | ||
Li4 |==================================================================================================== | ||
Wang5 |=============================================================================================== | ||
Zhao6 |============================================================ | ||
Liu7 |= | ||
Wang8 | | ||
Song9 |===== | ||
Ma10 |============================================= | ||
``` | ||
|
||
## HINT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
abc 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a |
Oops, something went wrong.