zoukankan      html  css  js  c++  java
  • hdu4811 Ball

    题目略坑。

    因为细节问题wa了几次。

    acm.hdu.edu.cn/showproblem.php?pid=4811

     1 #include <cstdio>
     2 #include <cstring>
     3 #include <algorithm>
     4 
     5 using namespace std;
     6 typedef __int64 LL;
     7 
     8 
     9 LL ans, a[3];
    10 
    11 void solve(){
    12     sort(a, a + 3);
    13     LL sum = 0;
    14     for(int i = 0; i < 3; i++) sum += a[i];
    15     LL ans = 0;
    16     //discuss::
    17     //2+2+2+;1,2+,2+;1,1,2+;1,1,1;
    18     //0,2+,2+;0,1,2+;0,1,1;0,0,2+;0,0,1;0,0,0;
    19     if(a[0] > 1){
    20         ans = (sum - 6) * 6 + 15;
    21     }
    22     else if(a[0] > 0 && a[1] > 1){
    23         ans = (sum - 5) * 5 + 10;
    24     }
    25     else if(a[0] > 0 && a[2] > 1){
    26         ans = (sum - 4) * 4 + 6;
    27     }
    28     else if(a[0] > 0){
    29         ans = 3;
    30     }
    31     else if(a[1] > 1){
    32         ans = (sum - 4) * 4 + 6;
    33     }
    34     else if(a[1] > 0 && a[2] > 1){
    35         ans = (sum - 3) * 3 + 3;
    36     }
    37     else if(a[1] > 0){
    38         ans = 1;
    39     }
    40     else if(a[2] > 1){
    41         ans = (sum - 2) * 2 + 1;
    42     }
    43     else if(a[2] > 0){
    44         ans = 0;
    45     }
    46     else ans = 0;
    47     printf("%I64d
    ", ans);
    48 }
    49 
    50 int main(){
    51     while(~scanf("%I64d%I64d%I64d", &a[0], &a[1], &a[2])) solve();
    52     return 0;
    53 }
    View Code
  • 相关阅读:
    [已解决] Python logging 重复打印日志信息
    scrapy
    Python 元编程
    MySQL性能优化 分区
    SQL Mode
    Golang 接口
    Python partial
    栈、队列(链表实现)
    Golang 位向量
    Java50题——学习以及思考
  • 原文地址:https://www.cnblogs.com/astoninfer/p/4740810.html
Copyright © 2011-2022 走看看