QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#511011#3403. Crossing RiversPetroTarnavskyi#AC ✓1ms3936kbC++20855b2024-08-09 15:09:282024-08-09 15:09:29

Judging History

你现在查看的是最新测评结果

  • [2024-08-09 15:09:29]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3936kb
  • [2024-08-09 15:09:28]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

int n, D;

void solve()
{
	db sumL = 0;
	db LnaV = 0;
	FOR (i, 0, n)
	{
		db p, l, v;
		cin >> p >> l >> v;
		sumL += l;
		LnaV += 2 * l / v;
	}
	cout << D - sumL + LnaV << '\n';
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(3);
	for (int tc = 1; ; tc++)
	{
		cin >> n >> D;
		if (D == 0)
			break;
		cout << "Case " << tc << ": ";
		solve();
		cout << "\n";
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3936kb

input:

0 811
8 860
37 20 15
73 29 22
124 42 2
169 86 25
289 18 9
325 176 28
551 68 13
717 24 16
4 573
203 64 8
272 35 19
386 37 30
457 115 18
6 609
70 37 30
110 96 16
229 79 9
329 126 16
468 76 26
575 27 23
2 717
172 89 19
690 15 17
9 993
0 40 11
71 1 22
144 7 17
198 45 9
260 46 27
324 139 12
652 25 16
765...

output:

Case 1: 811.000

Case 2: 481.216

Case 3: 356.929

Case 4: 223.966

Case 5: 624.133

Case 6: 669.527

Case 7: 501.908

Case 8: 272.857

Case 9: 584.470

Case 10: 460.553


result:

ok 19 lines