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

  • 相关阅读:
    SDN第二次作业
    SDN第一次上机作业
    SDN第一次作业
    期末作业验收
    SDN第五次上机作业
    SDN第四次上机作业
    SDN第三次作业
    SDN第三次上机作业
    SDN第二次上机作业
    SDN第二次作业
  • 原文地址:https://www.cnblogs.com/forgot93/p/3763947.html
Copyright © 2020-2023  润新知