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很好玩! 

  • 相关阅读:
    How to Automate IIS 7 Configuration with .NET
    windows phone 学习
    Redis VS. Memcached
    ROWNUM使用方法
    摘自----聊聊盛大的经验值
    理解Sql语句
    Odp.net 动态创建变量in
    ORACLE PLSQL DEVELOPER 中显示科学计数法
    http error 500.22 internal server error
    Resharper8 visual studio 中文版 快捷键无法使用
  • 原文地址:https://www.cnblogs.com/forgot93/p/3763947.html
Copyright © 2011-2022 走看看