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

  • 相关阅读:
    关于软件测试的浅谈
    软件测试中的压力测试和性能测试
    白盒测试一些方法
    浅谈黑盒测试
    关于判断是否为闰年以及异常处理问题
    软件测试用例
    等价类划分
    关于白盒测试
    【软件测试】软件测试方法划分
    【软件测试】灰盒测试
  • 原文地址:https://www.cnblogs.com/forgot93/p/3763947.html
Copyright © 2011-2022 走看看