QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#667925 | #9296. Golden Spirit | 4eyebird# | RE | 0ms | 0kb | C++17 | 796b | 2024-10-23 09:48:08 | 2024-10-23 09:48:16 |
answer
#include <iostream>
using namespace std;
#define Buff ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define int long long
void solve()
{
int n, x, t;
cin >> n >> x >> t;
int ans = 0;
ans += n * t * 2;
if (ans - 2 * t >= x)
ans += n * t * 2;
else
{
int ans2 = ans;
ans += n * t * 2 + (x - (ans - 2 * t));
ans2 += t;
if (ans2 >= x)
ans2 += n * t * 2;
else
ans2 += n * t * 2 + (x - ans2);
ans = min(ans, ans2);
}
cout << ans << '\n';
}
signed main()
{
freopen("in.txt","r",stdin);
freopen("out.txt", "w", stdout);
Buff;
int _T_ = 1;
cin >> _T_;
while (_T_--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Dangerous Syscalls
input:
3 2 2 2 3 1 10 11 45 14