Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib>
- #include<vector>
- #define long long long
- #define nln '\n'
- using namespace std;
- int main()
- {
- //freopen("coinflip.inp", "r", stdin);
- long T;
- cin >> T;
- for (long t = 1; t <= T; ++t)
- {
- long G;
- cin >> G;
- for (long g = 1; g <= G; ++g)
- {
- long i, n, q;
- cin >> i >> n >> q;
- if (n == 0)
- {
- cout << '0' << nln;
- continue;
- }
- if (n % 2 == 0)
- {
- cout << n/2 << nln;
- }
- else
- {
- if (i == 1)
- {
- if (q == 1)
- cout << n/2 << nln;
- else
- cout << n/2+1 << nln;
- }
- else
- {
- if (q == 2)
- cout << n/2 << nln;
- else
- cout << n/2+1 << nln;
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment