Test instructions: The same as the last CF ZeptoLab C, is the example of purple book 7-11
But when UVA turned in, it was WA with%i64d, and cout directly.
1#include <iostream>2#include <cstdio>3#include <cstring>4#include <cmath>5#include <stack>6#include <vector>7#include <map>8#include <Set>9#include <queue>Ten#include <algorithm> One #definemod=1e9+7; A using namespacestd; - -typedefLong LongLL; the Const intINF =0x7fffffff; - - intMain () { - intn,s1,s2,v1,v2,ncase,kase; +scanf"%d",&ncase); - for(kase=1; kase<=ncase;kase++){ +Cin>>n>>s1>>v1>>s2>>v2; ALL ans=0; at for(LL i=0;i<100000; i++){ - if(i*s1<=N) -Ans=max (ans, (N-I*S1)/s2*v2+i*v1); - if(i*s2<=N) -Ans=max (ans, (N-I*S2)/s1*v1+i*v2); - } inprintf"Case #%d:", Kase); -cout<<ans<<"\ n"; to } + return 0; -}View Code
Come on. = =
UVa 12325 Zombie ' s treasure Chest "Violence"