zoukankan      html  css  js  c++  java
  • 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<<"
    ";
    31     }
    32     return 0;
    33 }
    View Code

    加油啊= =

  • 相关阅读:
    JAVA面试——设计模式
    CSS清除浮动
    CSS外边距
    baidu-ife
    笔记一则
    Atom
    校园网认证
    四月甘九-省
    Python sys.argv[]用法
    Python模块导入的方法
  • 原文地址:https://www.cnblogs.com/wuyuewoniu/p/4417092.html
Copyright © 2011-2022 走看看