3人聚集

This commit is contained in:
James 2020-04-06 09:37:59 +08:00
parent 133256e900
commit 7abbe7cd66
12 changed files with 81 additions and 0 deletions

3
4078_3people/Readme.md Normal file
View File

@ -0,0 +1,3 @@
# 标题
* 内容

Binary file not shown.

View File

@ -0,0 +1,3 @@
# 标题
* 内容

6
4078_3people/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
int main()
{
std::cout << "Hello Easy C++ project!" << std::endl;
}

BIN
4078_3people/main.exe Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
7 8 9

View File

@ -0,0 +1 @@
5 6 10

1
4078_3people/test/in.txt Normal file
View File

@ -0,0 +1 @@
4 7 9

View File

@ -0,0 +1 @@
4 6 9

28
4078_3people/test/out.txt Normal file
View File

@ -0,0 +1,28 @@
## z:\Chao\src\4078_3people\test\in.txt
2020/04/06 ÖÜÒ» 9:14:16.40
1
2
-----------------------------------------------
Process exited after 150 ms with return value 0
## z:\Chao\src\4078_3people\test\In1 (16).txt
2020/04/06 ÖÜÒ» 9:14:16.40
0
0
-----------------------------------------------
Process exited after 100 ms with return value 0
## z:\Chao\src\4078_3people\test\In2 (8).txt
2020/04/06 ÖÜÒ» 9:14:16.40
2
3
-----------------------------------------------
Process exited after 80 ms with return value 0
## z:\Chao\src\4078_3people\test\in2.txt
2020/04/06 ÖÜÒ» 9:14:16.40
1
2
-----------------------------------------------
Process exited after 90 ms with return value 0

View File

@ -0,0 +1,37 @@
#include <iostream>
using namespace std;
int pan(int a, int b)
{
return a > b ? a : b;
}
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (a > b) {
int u = a;
a = b;
b = u;
}
if (a > c) {
int u = a;
a = c;
c = u;
}
if (b > c) {
int u = c;
c = b;
b = u;
}
if (a + 1 == b && b + 1 == c) {
cout << "0" << endl
<< "0";
return 0;
}
if (a + 2 == b || b + 2 == c) {
cout << "1" << endl;
} else {
cout << "2" << endl;
}
cout << pan(b - a, c - b)-1;
}

Binary file not shown.