-
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
hachi
committed
Jun 7, 2020
1 parent
291687c
commit 11bdc7d
Showing
507 changed files
with
20,110 additions
and
57 deletions.
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
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,3 @@ | ||
1,2 | ||
3,3 | ||
2,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,4 @@ | ||
Point : (1, 2) | ||
Point : (3, 3) | ||
Point : (2, 1) | ||
Point : (0, 0) |
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,49 @@ | ||
# 平面上的点——Point类 (I) | ||
Time Limit: 1 Sec Memory Limit: 4 MB | ||
|
||
|
||
## Description | ||
在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定。现在我们封装一个“Point类”来实现平面上的点的操作。 | ||
根据“append.cc”,完成Point类的构造方法和show()方法。 | ||
接口描述: | ||
Point::show()方法:按输出格式输出Point对象。 | ||
|
||
## Input | ||
输入多行,每行为一组坐标“x,y”,表示点的x坐标和y坐标,x和y的值都在double数据范围内。 | ||
|
||
## Output | ||
输出为多行,每行为一个点,X坐标在前,Y坐标在后,Y坐标前面多输出一个空格。每个坐标的输出精度为最长16位。输出格式见sample。 | ||
C语言的输入输出被禁用。 | ||
|
||
## Sample Input | ||
``` | ||
1,2 | ||
3,3 | ||
2,1 | ||
``` | ||
## Sample Output | ||
``` | ||
Point : (1, 2) | ||
Point : (3, 3) | ||
Point : (2, 1) | ||
Point : (0, 0) | ||
``` | ||
|
||
## HINT | ||
注意精度控制,C语言的输入输出被禁用。 | ||
|
||
## Append Code | ||
### append.cc | ||
```cppint main() | ||
{ | ||
char c; | ||
double a, b; | ||
Point q; | ||
while(std::cin>>a>>c>>b) | ||
{ | ||
Point p(a, b); | ||
p.show(); | ||
} | ||
q.show(); | ||
} | ||
``` |
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,3 @@ | ||
1,2 | ||
3,3 | ||
2,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,18 @@ | ||
Point : (0, 0) is created. | ||
Point : (1, 2) is created. | ||
Point : (1, 2) | ||
Point : (1, 2) is erased. | ||
Point : (3, 3) is created. | ||
Point : (3, 3) | ||
Point : (3, 3) is erased. | ||
Point : (2, 1) is created. | ||
Point : (2, 1) | ||
Point : (2, 1) is erased. | ||
Point : (0, 0) is copied. | ||
Point : (1, 1) is created. | ||
Point : (0, 0) | ||
Point : (1, 1) | ||
Point : (0, 0) | ||
Point : (1, 1) is erased. | ||
Point : (0, 0) is erased. | ||
Point : (0, 0) is erased. |
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,66 @@ | ||
# 平面上的点——Point类 (II) | ||
Time Limit: 1 Sec Memory Limit: 4 MB | ||
|
||
|
||
## Description | ||
在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定。现在我们封装一个“Point类”来实现平面上的点的操作。 | ||
根据“append.cc”,完成Point类的构造方法和show()方法,输出各Point对象的构造和析构次序。 | ||
接口描述: | ||
Point::show()方法:按输出格式输出Point对象。 | ||
|
||
## Input | ||
输入多行,每行为一组坐标“x,y”,表示点的x坐标和y坐标,x和y的值都在double数据范围内。 | ||
|
||
## Output | ||
输出每个Point对象的构造和析构行为。对每个Point对象,调用show()方法输出其值:X坐标在前,Y坐标在后,Y坐标前面多输出一个空格。每个坐标的输出精度为最长16位。输出格式见sample。 | ||
C语言的输入输出被禁用。 | ||
|
||
## Sample Input | ||
``` | ||
1,2 | ||
3,3 | ||
2,1 | ||
``` | ||
## Sample Output | ||
``` | ||
Point : (0, 0) is created. | ||
Point : (1, 2) is created. | ||
Point : (1, 2) | ||
Point : (1, 2) is erased. | ||
Point : (3, 3) is created. | ||
Point : (3, 3) | ||
Point : (3, 3) is erased. | ||
Point : (2, 1) is created. | ||
Point : (2, 1) | ||
Point : (2, 1) is erased. | ||
Point : (0, 0) is copied. | ||
Point : (1, 1) is created. | ||
Point : (0, 0) | ||
Point : (1, 1) | ||
Point : (0, 0) | ||
Point : (1, 1) is erased. | ||
Point : (0, 0) is erased. | ||
Point : (0, 0) is erased. | ||
``` | ||
|
||
## HINT | ||
思考构造函数、拷贝构造函数、析构函数的调用时机。 | ||
|
||
## Append Code | ||
### append.cc | ||
```cppint main() | ||
{ | ||
char c; | ||
double a, b; | ||
Point q; | ||
while(std::cin>>a>>c>>b) | ||
{ | ||
Point p(a, b); | ||
p.show(); | ||
} | ||
Point q1(q), q2(1); | ||
q1.show(); | ||
q2.show(); | ||
q.show(); | ||
} | ||
``` |
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,3 @@ | ||
1,2 | ||
3,3 | ||
2,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,12 @@ | ||
Point : (1, 2) | ||
Current : 2 points. | ||
Point : (3, 3) | ||
Current : 2 points. | ||
Point : (2, 1) | ||
Current : 2 points. | ||
In total : 4 points. | ||
Current : 3 points. | ||
Point : (0, 0) | ||
Point : (1, 1) | ||
Point : (0, 0) | ||
In total : 6 points. |
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,68 @@ | ||
# 平面上的点——Point类 (IV) | ||
Time Limit: 1 Sec Memory Limit: 4 MB | ||
|
||
|
||
## Description | ||
在数学上,平面直角坐标系上的点用X轴和Y轴上的两个坐标值唯一确定。现在我们封装一个“Point类”来实现平面上的点的操作。 | ||
|
||
根据“append.cc”,完成Point类的构造方法和show()、showCounter()、showSumOfPoint()方法;实现showPoint()函数。 | ||
|
||
接口描述: | ||
showPoint()函数:按输出格式输出Point对象,调用Point::show()方法实现。 | ||
Point::show()方法:按输出格式输出Point对象。 | ||
Point::showCounter()方法:按格式输出当前程序中Point对象的计数。 | ||
Point::showSumOfPoint()方法:按格式输出程序运行至当前存在过的Point对象总数。 | ||
|
||
## Input | ||
输入多行,每行为一组坐标“x,y”,表示点的x坐标和y坐标,x和y的值都在double数据范围内。 | ||
|
||
## Output | ||
对每个Point对象,调用show()方法输出其值,或者用showPoint()函数来输出(通过参数传入的)Point对象的值:X坐标在前,Y坐标在后,Y坐标前面多输出一个空格。每个坐标的输出精度为最长16位。调用用showCounter()方法和showSumOfPoint()输出Point对象的计数统计,输出格式见sample。 | ||
|
||
C语言的输入输出被禁用。 | ||
|
||
## Sample Input | ||
``` | ||
1,2 | ||
3,3 | ||
2,1 | ||
``` | ||
## Sample Output | ||
``` | ||
Point : (1, 2) | ||
Current : 2 points. | ||
Point : (3, 3) | ||
Current : 2 points. | ||
Point : (2, 1) | ||
Current : 2 points. | ||
In total : 4 points. | ||
Current : 3 points. | ||
Point : (0, 0) | ||
Point : (1, 1) | ||
Point : (0, 0) | ||
In total : 6 points. | ||
``` | ||
|
||
## HINT | ||
对象计数通过静态成员来实现 | ||
|
||
## Append Code | ||
### append.cc | ||
```cppint main() | ||
{ | ||
char c; | ||
double a, b; | ||
Point q; | ||
while(std::cin>>a>>c>>b) | ||
{ | ||
Point p(a, b); | ||
p.show(); | ||
p.showCounter(); | ||
} | ||
q.showSumOfPoint(); | ||
Point q1(q), q2(1); | ||
Point::showCounter(); | ||
showPoint(q1, q2, q); | ||
Point::showSumOfPoint(); | ||
} | ||
``` |
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 @@ | ||
1 2 | ||
1.4 1.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,2 @@ | ||
2 | ||
1.4 |
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,47 @@ | ||
# 重载函数:max | ||
Time Limit: 1 Sec Memory Limit: 128 MB | ||
|
||
|
||
## Description | ||
编写两个名为max的函数,它们是重载函数 ,用于求两个整数或实数的最大值。它们的原型分别是: | ||
int max(int a,int b); | ||
double max(double a,double b); | ||
返回值是a和b的最大值。 | ||
|
||
|
||
|
||
## Input | ||
输入4个数,前两个数是int类型的整数,后2个数是double类型的实数。 | ||
|
||
|
||
## Output | ||
输出2个数,每个数占一行。第一个数对应于输入的两个整数的最大值,第二个数对应于输入的两个实数的最大值。 | ||
|
||
|
||
## Sample Input | ||
``` | ||
1 2 | ||
1.4 1.3 | ||
``` | ||
## Sample Output | ||
``` | ||
2 | ||
1.4 | ||
``` | ||
|
||
## HINT | ||
|
||
|
||
## Append Code | ||
### append.cc | ||
```cppint main() | ||
{ | ||
int a,b; | ||
double c,d; | ||
cin>>a>>b; | ||
cout<<max(a,b)<<endl; | ||
cin>>c>>d; | ||
cout<<max(c,d)<<endl; | ||
return 0; | ||
} | ||
``` |
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 @@ | ||
19 |
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 @@ | ||
1133.54 | ||
3.14 |
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,43 @@ | ||
# 默认参数:求圆面积 | ||
Time Limit: 1 Sec Memory Limit: 128 MB | ||
|
||
|
||
## Description | ||
编写一个带默认值的函数,用于求圆面积。其原型为: | ||
double area(double r=1.0); | ||
当调用函数时指定参数r,则求半径为r的圆的面积;否则求半径为1的圆面积。 | ||
其中,PI取值3.14。 | ||
|
||
|
||
## Input | ||
一个实数,是圆的半径。 | ||
|
||
|
||
## Output | ||
输出有2行。第一行是以输入数值为半径的圆面积,第二行是半径为1的圆面积。 | ||
|
||
|
||
## Sample Input | ||
``` | ||
19 | ||
``` | ||
## Sample Output | ||
``` | ||
1133.54 | ||
3.14 | ||
``` | ||
|
||
## HINT | ||
|
||
|
||
## Append Code | ||
### append.cc | ||
```cppint main() | ||
{ | ||
double r; | ||
cin>>r; | ||
cout<<area(r)<<endl; | ||
cout<<area()<<endl; | ||
return 0; | ||
} | ||
``` |
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 @@ | ||
2013 4 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,4 @@ | ||
Hello, today is 2013-4-3. | ||
Hello, today is 2013-4-1. | ||
Hello, today is 2013-1-1. | ||
Hello, today is 2000-1-1. |
Oops, something went wrong.