Skip to content

Commit

Permalink
add weilinfox's code
Browse files Browse the repository at this point in the history
  • Loading branch information
hachi committed Jun 7, 2020
1 parent 291687c commit 11bdc7d
Show file tree
Hide file tree
Showing 507 changed files with 20,110 additions and 57 deletions.
20 changes: 10 additions & 10 deletions ProblemSet/1107/problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Time Limit: 1 Sec  Memory Limit: 16 MB

-----------------------------------------------------------------------------
用C实现三个函数int_swap()、dbl_swap()、SWAP(),其中SWAP()是个带参宏。
用C++实现两个函数,都以swap()命名。
用C++实现两个函数,都以Swap()命名。
以上函数的调用格式见“Append Code”。这里不给出函数原型,它们的参数请通过main()函数自行确定。


Expand Down Expand Up @@ -67,23 +67,23 @@ int main()
```cppint main()
{
int x1, y1;
cin>>x1>>y1;
swap(&x1, &y1);
Swap(&x1, &y1);
cout<<x1<<" "<<y1<<endl;
cin>>x1>>y1;
swap(x1, y1);
Swap(x1, y1);
cout<<x1<<" "<<y1<<endl;
double x2, y2;
cin>>x2>>y2;
swap(&x2, &y2);
Swap(&x2, &y2);
cout<<x2<<" "<<y2<<endl;
cin>>x2>>y2;
swap(x2, y2);
Swap(x2, y2);
cout<<x2<<" "<<y2<<endl;
}
```
3 changes: 3 additions & 0 deletions ProblemSet/1121/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1,2
3,3
2,1
4 changes: 4 additions & 0 deletions ProblemSet/1121/output
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)
49 changes: 49 additions & 0 deletions ProblemSet/1121/problem.md
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();
}
```
3 changes: 3 additions & 0 deletions ProblemSet/1122/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1,2
3,3
2,1
18 changes: 18 additions & 0 deletions ProblemSet/1122/output
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.
66 changes: 66 additions & 0 deletions ProblemSet/1122/problem.md
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();
}
```
3 changes: 3 additions & 0 deletions ProblemSet/1124/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1,2
3,3
2,1
12 changes: 12 additions & 0 deletions ProblemSet/1124/output
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.
68 changes: 68 additions & 0 deletions ProblemSet/1124/problem.md
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();
}
```
2 changes: 2 additions & 0 deletions ProblemSet/1279/input
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 2
1.4 1.3
2 changes: 2 additions & 0 deletions ProblemSet/1279/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2
1.4
47 changes: 47 additions & 0 deletions ProblemSet/1279/problem.md
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;
}
```
1 change: 1 addition & 0 deletions ProblemSet/1280/input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19
2 changes: 2 additions & 0 deletions ProblemSet/1280/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1133.54
3.14
43 changes: 43 additions & 0 deletions ProblemSet/1280/problem.md
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;
}
```
1 change: 1 addition & 0 deletions ProblemSet/1282/input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2013 4 3
4 changes: 4 additions & 0 deletions ProblemSet/1282/output
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.
Loading

0 comments on commit 11bdc7d

Please sign in to comment.