zoukankan      html  css  js  c++  java
  • Codeforces Round #250 (Div. 2)

    感觉不会再爱了,呜呜!

    A题原来HACK这么多!很多人跟我一样掉坑了!

    • If there is some choice whose description at least twice shorter than all other descriptions, or at least twice longer than all other descriptions, then the child thinks the choice is great.
    • If there is exactly one great choice then the child chooses it. Otherwise the child chooses C (the child think it is the luckiest choice).

    pasting注意条件只能满足一个

    B:我能说我40分钟的时候想到正解吗?WOCAO,运算符的优先级搞蒙了!

    坑爆了:

    我的代码:#include<stdio.h>

    #include<string>
    #include<algorithm>
    #include<math.h>
    #include<vector>
    #include<set>
    #include<map>
    #include<string.h>
    #include<iostream>

    using namespace std;
    int a[200000];
    int b[200000];
    int m,n;
    int main()
    {
        cin>>n>>m;
        int t=0;
        for (int i=m;i>=1;i--)
        {
            if ((i&(-i))<=n)//满满的泪。。。。呜呜之前的版本是if (i&(-i)<=n)
            {
                t++;
                a[t]=i;
                n-=(i&-i);
            }
        }
        //cout<<n<<endl;
        if (n) cout<<-1;
        else
        {
            cout<<t<<endl;
            for (int i=1;i<=t;i++) cout<<a[i]<<" ";
        }
        return 0;

    } 原来&的优先级很低的,晕死!

    简要证明,不知道对不对

    I从limits 一直减小,每次加到SUM-lowbit(i);这样可以保证set的元素不同,然后,因为sum不断减小,当sum==0是既有满足答案。

    C:最水,难怪出题人说DIV2很好玩! 

  • 相关阅读:
    在win2003中发布部署vs2010b2写的mvc2网站
    安装blender2.5Alpha0
    Win7下虚拟机个人使用小结:Virtual PC,VMware和VirtualBox
    ASP.NET AJAX Control Toolkit Beta 0911 发布[再增两控件]
    Camtasia 6录屏时鼠标闪烁问题解决
    为XNA制做安装程序(四)WIX Toolset 3.0 for Visual Studio 2008
    Oracle EM 12c
    无题
    从徐汇到虹口
    近况
  • 原文地址:https://www.cnblogs.com/forgot93/p/3763947.html
Copyright © 2011-2022 走看看