限速比赛(有误)

This commit is contained in:
James 2020-03-29 08:40:02 +08:00
parent c477df0fb0
commit 5016ebf497
11 changed files with 83 additions and 0 deletions

3
4063_race/Readme.md Normal file
View File

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

3
4063_race/doc/Readme.md Normal file
View File

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

Binary file not shown.

6
4063_race/main.cpp Normal file
View File

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

BIN
4063_race/main.exe Normal file

Binary file not shown.

36
4063_race/race.cpp Normal file
View File

@ -0,0 +1,36 @@
#include <iostream>
using namespace std;
int main()
{
int k, n, a[1001] = { 0 };
cin >> k >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
int now, ans = 0, k1 = k, hou = 0;
for (int j = 1;; j++) {
int u=0;
if (j - 1 >= a[i]) {
hou += j - 2;
}
if (j > a[i]) {
u = hou;
}
if (k1 - u - j <= 0) {
break;
}
ans += 1;
k1 = k1 - j;
}
//cout << ans << " " << k1 << " " << hou << " ";
//now=(ans+1)/2*a[i];
for (int j = ans; j >= a[i]; j--) {
int u = (k1 - hou) / j;
ans += u;
hou = hou - j + 1;
k1 = k1 - u * j;
}
cout << ans << endl;
}
}

BIN
4063_race/race.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
45602031 1
1

View File

@ -0,0 +1,2 @@
787954771 1
1

6
4063_race/test/in.txt Normal file
View File

@ -0,0 +1,6 @@
10 5
1
2
3
4
5

25
4063_race/test/out.txt Normal file
View File

@ -0,0 +1,25 @@
## z:\Chao\src\4063_race\test\in.txt
2020/03/28 ÖÜÁù 13:41:48.22
6
4
3
3
3
-----------------------------------------------
Process exited after 190 ms with return value 0
## z:\Chao\src\4063_race\test\In1 (10).txt
2020/03/28 ÖÜÁù 13:41:48.22
13505
-----------------------------------------------
Process exited after 100 ms with return value 0
## z:\Chao\src\4063_race\test\In2 (2).txt
2020/03/28 ÖÜÁù 13:41:48.22
56141
-----------------------------------------------
Process exited after 80 ms with return value 0