zoukankan      html  css  js  c++  java
  • hdu 2116水题

    水题,K为64的时候单独处理,其余情况就很easy了。

    /*
     * hdu2116/win.cpp
     * Created on: 2012-11-2
     * Author    : ben
     */
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <queue>
    #include <set>
    #include <map>
    #include <stack>
    #include <string>
    #include <vector>
    #include <deque>
    #include <list>
    #include <functional>
    #include <numeric>
    #include <cctype>
    using namespace std;
    typedef long long LL;
    typedef unsigned long long UU;
    inline bool judge(LL sum, int K) {
        LL temp = 1, low, high;
        high = temp << (K - 1);
        low = -high;
        return (sum >= low) && (sum < high);
    }
    inline bool judge2(LL a, LL b) {
        LL high = 0x7fffffffffffffffLL, low = -high-1;
        if(a > 0 && b > 0) {
            UU c = (UU)a + (UU)b;
            return c <= (UU)high;
        }else if(a < 0 && b < 0) {
            return a >= low - b;
        }
        return true;
    }
    int main() {
    #ifndef ONLINE_JUDGE
        freopen("data.in", "r", stdin);
    #endif
        int K;
        LL a, b;
        bool ret;
        while(scanf("%d", &K) == 1) {
            scanf("%I64d%I64d", &a, &b);
            if(K == 64) {
                ret = judge2(a, b);
            }else {
                ret = judge(a + b, K);
            }
            if(ret) {
                puts("WaHaHa");
            }else {
                puts("Yes");
            }
        }
        return 0;
    }
  • 相关阅读:
    积累
    AnkhSVN使用记录
    时间戳
    Nhibernate
    Css的sb问题
    ajax
    WAS资料收集
    CryStal资料收集
    Decorator模式
    MSDN WebCast网络广播全部下载列表
  • 原文地址:https://www.cnblogs.com/moonbay/p/2751405.html
Copyright © 2011-2022 走看看