Greedy, making the number of hamburgers with less time as much as possible.
# Include <cstdio> # include <iostream> # include <cstring> # include <cstdlib> # include <algorithm> # include <set> # include <vector> using namespace STD; int main () {// freopen ("in.txt", "r", stdin); int m, n, T; while (CIN> m> N> T) {If (M> N) {int temp; temp = m; M = N; n = temp;} If (T % m = 0) {cout <t/m <Endl; continue;} int A = T/m; if (a = 0) {cout <0 <"" <t <Endl; continue;} vector <int> st; int flag, temp = 0; For (INT I =; i> = 0; I --) {int rest = T-I * m; If (rest % N = 0) {temp = 1; cout <I + rest/n <Endl; break;} int A = rest % N; ST. push_back (a); sort (St. begin (), St. end (); If (A = sT [0] & St [0]! = ST [1]) Flag = I; A = (INT) ST. size (); int P = unique (St. begin (), St. end ()-St. begin (); if (! = P) {temp = 1; cout <flag + (t-flag * m)/n <"<st [0] <Endl; break ;}} if (! Temp) cout <flag + (t-flag * m)/n <"" <st [0] <Endl;} return 0 ;}