1. 程式人生 > >ZOJ 3948: Marjar Cola

ZOJ 3948: Marjar Cola

cout nbsp else -- spa consola col ica enter

Marjar Cola

[email protected] Sycamore, ZJNU
[email protected] 4/9/2017
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <set> #include <list> #include <stack> #include <queue> #include <map> #include <algorithm> #include <cctype> #include<fstream> #include<cstdio> //#define cin fin //#define cout fout //ifstream fin("in.txt"); //ofstream fout("out.txt"); using namespace
std; typedef vector<int> VI; typedef pair<int, int> PII; int main() { int T; cin >> T; while (T--) { int x, y, a, b; cin >> x >> y >> a >> b; int c = 0, d = 0; while (a >= x || b >= y) { if (a >= x) { a = a - x + 1; b++;
c++; } if (b >= y) { b = b - y + 1; a++; c++; } d++; if (d == 100000) { break; } } if (d == 100000)cout << "INF" << endl; else cout << c << endl; } return 0; }

ZOJ 3948: Marjar Cola