UVa 12325 Zombie's Treasure Chest【暴力】

题意:和上次的cf的ZeptoLab的C一样,是紫书的例题7-11

不过在uva上交的时候,用%I64d交的话是wa,直接cout就好了

 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> 
10 #include<algorithm>  
11 #define mod=1e9+7;
12 using namespace std;
13 
14 typedef long long LL;
15 const int INF = 0x7fffffff;
16 
17 int main(){
18     int n,s1,s2,v1,v2,ncase,kase;
19     scanf("%d",&ncase);
20     for(kase=1;kase<=ncase;kase++){
21         cin>>n>>s1>>v1>>s2>>v2;
22         LL ans=0;
23         for(LL i=0;i<100000;i++){
24             if(i*s1<=n)
25             ans=max(ans,(n-i*s1)/s2*v2+i*v1);
26             if(i*s2<=n)
27             ans=max(ans,(n-i*s2)/s1*v1+i*v2);
28         }
29         printf("Case #%d: ",kase);
30         cout<<ans<<"\n";
31     }
32     return 0;
33 }
View Code

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

加油啊= =

转载于:https://www.cnblogs.com/wuyuewoniu/p/4417092.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值