Cod sursa(job #3360793)
| Utilizator | Data | 16 iulie 2026 14:48:56 | |
|---|---|---|---|
| Problema | Fructe | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fructe.in");
ofstream fout("fructe.out");
int main() {
int t, p, b;
fin >> t;
while (t--) {
fin >> p >> b;
while (p + b > 1) {
if (p > b)
p -= b;
else
p = 0;
if (!p) {
b %= 2;
p += b / 2;
}
}
if (!b)
fout << "0" << '\n';
else
fout << "1" << '\n';
}
return 0;
}
