AcWing 1934. 贝茜放慢脚步
更多...
#include <acwing.h>
|
static int | main (istream &cin, ostream &cout) |
|
AcWing 1934. 贝茜放慢脚步
在文件 acwing.h 第 519 行定义.
◆ main()
int acwing::acwing1934::main |
( |
istream & |
cin, |
|
|
ostream & |
cout |
|
) |
| |
|
static |
在文件 acwing.cpp 第 1481 行定义.
1484 auto t = vector<int>();
1485 auto d = vector<int>();
1486 for(
int i = 0; i < n; i++) {
1496 sort(t.begin(), t.end());
1497 sort(d.begin(), d.end());
1498 double current_d = 0;
1499 double current_t = 0;
1500 double decelerations = 1;
1501 auto it_d = d.begin();
1502 auto it_t = t.begin();
1505 if(it_d != d.end()) {
1508 const auto t_for_next_d = (next_d - current_d) * decelerations;
1509 bool next_is_d =
true;
1510 if(it_t != t.end()) {
1511 next_is_d = t_for_next_d < *it_t - current_t;
1517 current_t += t_for_next_d;
1518 }
else if(it_t != t.end()) {
1520 current_d += (*it_t - current_t) * (1.0 / decelerations);
1525 if(it_d == d.end() && it_t == t.end()) {
1526 current_t += (1000 - current_d) * decelerations;
1530 cout << lround(current_t);
被这些函数引用 acwing::TEST().
该类的文档由以下文件生成: