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

    加油啊= =

  • 相关阅读:
    mongodb 配置单实例与双实例
    redis 集群 搭建
    memcached 搭建
    公网yum 源地址
    jdk 安装
    activemq 搭建--集群
    zookeeper 安装
    activemq 安装-单点
    rabbitmq 集群
    python——网络编程
  • 原文地址:https://www.cnblogs.com/wuyuewoniu/p/4417092.html
Copyright © 2011-2022 走看看