zoukankan      html  css  js  c++  java
  • bzoj 刷水

    bzoj 3856: Monster

    虽然是sb题,,但是要注意h可能<=a,,,开始忘记判了WA得很开心。

     1 #include <iostream>
     2 #include <cstdio>
     3 #include <cstring>
     4 #include <cmath>
     5 #include <algorithm>
     6 using namespace std;
     7 long long h, a, b, k;
     8 int main(){
     9     int tt = 0;
    10     while(scanf("%lld%lld%lld%lld", &h, &a, &b, &k) && h){
    11         printf("Case #%d: ", ++ tt);
    12         if(a >= h || h+b*(k-1)-a*k < 1){puts("YES"); continue;}
    13         if(b*(k+1)-a*k < 0){puts("YES"); continue;}
    14         puts("NO");
    15     }
    16     return  0;
    17 }
    View Code

    bzoj 3850: ZCC Loves Codefires

    签到水题,,按斜率排下序然后扫一遍就好了

     1 #include <iostream>
     2 #include <algorithm>
     3 #include <cstdio>
     4 #define MAXN 100005
     5 using namespace std;
     6 int n, a[MAXN], E[MAXN], K[MAXN];
     7 bool cmp(int a, int b){return (E[a]*K[b]) <= (E[b]*K[a]);}
     8 long long ans, tt;
     9 int main(){
    10     scanf("%d", &n);
    11     for(int i = 1; i <= n; i ++) scanf("%d", &E[i]);
    12     for(int i = 1; i <= n; i ++) scanf("%d", &K[i]), a[i] = i;
    13     sort(a + 1, a + n + 1, cmp);
    14     for(int i = 1; i <= n; i ++){
    15         tt += E[a[i]]; ans += K[a[i]] * tt;
    16     }
    17     cout << ans << endl;
    18     return 0;
    19 }
    View Code

    bzoj  3851: 2048

    预处理出组合数然后暴力dp就好啦,注意这道题卡常数>_<

    bzoj 3852: Area of Mushroom

    很显然只有速度最大的可以有无穷面积,而即使是速度最大的点也有可能因为被其他点围住而没有无穷面积,所以对速度最大的点求一个凸包就好啦。

    注意最大速度可能是0!!!!!!!!!!!! QAQ

  • 相关阅读:
    <cf>Square
    运算符重载
    HDU 1231 最大连续子序列
    Biorhythms(poj1006)
    友元和友元函数
    <poj 1046>Color Me Less
    <cf> Funky Numbers
    VC++中窗口的最大化问题
    励志文章,没事看一下(网上摘录)
    VC多线程编程(转)
  • 原文地址:https://www.cnblogs.com/lixintong911/p/4980847.html
Copyright © 2011-2022 走看看