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[];
int b[];
int m,n;
int main()
{
cin>>n>>m;
int t=;
for (int i=m;i>=;i--)
{
if ((i&(-i))<=n)//满满的泪。。。。呜呜之前的版本是if (i&(-i)<=n)
{
t++;
a[t]=i;
n-=(i&-i);
}
}
//cout<<n<<endl;
if (n) cout<<-;
else
{
cout<<t<<endl;
for (int i=;i<=t;i++) cout<<a[i]<<" ";
}
return ;
} 原来&的优先级很低的,晕死!
简要证明,不知道对不对
I从limits 一直减小,每次加到SUM-lowbit(i);这样可以保证set的元素不同,然后,因为sum不断减小,当sum==0是既有满足答案。
C:最水,难怪出题人说DIV2很好玩!
Codeforces Round #250 (Div. 2)的更多相关文章
- Codeforces Round #250 (Div. 2)A(英语学习)
链接:http://codeforces.com/contest/437/problem/A A. The Child and Homework time limit per test 1 secon ...
- Codeforces Round #250 (Div. 1) D. The Child and Sequence (线段树)
题目链接:http://codeforces.com/problemset/problem/438/D 给你n个数,m个操作,1操作是查询l到r之间的和,2操作是将l到r之间大于等于x的数xor于x, ...
- Codeforces Round #250 (Div. 1) D. The Child and Sequence 线段树 区间取摸
D. The Child and Sequence Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...
- Codeforces Round #250 (Div. 1) B. The Child and Zoo 并查集
B. The Child and Zoo Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/438/ ...
- Codeforces Round #250 (Div. 1) A. The Child and Toy 水题
A. The Child and Toy Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/438/ ...
- Codeforces Round #250 (Div. 2) A. The Child and Homework
注意题目长度不能考虑前缀,而且如果即存在一个选项的长度的两倍小于其他所有选项的长度,也存在一个选项的长度大于其他选项长度的两倍,则答案不是一个好的选择,只能选择C. #include <iost ...
- Codeforces Round #250 (Div. 2) C、The Child and Toy
注意此题,每一个部分都有一个能量值v[i],他移除第i部分所需的能量是v[f[1]]+v[f[2]]+...+v[f[k]],其中f[1],f[2],...,f[k]是与i直接相连(且还未被移除)的部 ...
- Codeforces Round #250 (Div. 2)——The Child and Set
题目链接 题意: 给定goal和limit,求1-limit中的若干个数,每一个数最多出现一次,且这些数的lowbit()值之和等于goal,假设存在这种一些数,输出个数和每一个数:否则-1 分析: ...
- Codeforces Round #250 (Div. 2)—A. The Child and Homework
好题啊,被HACK了.曾经做题都是人数越来越多.这次比赛 PASS人数 从2000直掉 1000人 被HACK 1000多人! ! ! ! 没见过的科技啊 1 2 4 8 这组数 被黑的 ...
随机推荐
- 9 本免费的 Python 语言编程书籍(转载)
9 本免费的 Python 语言编程书籍 原文地址:http://linuxtoy.org/archives/9-free-python-books.html 2010-03-03 Toy Poste ...
- Python脚本控制的WebDriver 常用操作 <七>浏览器前进和后退操作
下面将使用WebDriver来控制浏览器的前进和后退操作 测试用例场景 此操作和get.url()方法功能相同 Python脚本 # coding=gbk ''' Created on 2013年12 ...
- Python学习教程(learning Python)--2.3.1 Python传参函数设计
本节主要讨论设计传递多个参数子函数的设计方法. 在2.3节里我们讨论了如何自己设计一个带参数的子函数的设计方法,现在我们研究一下如何传递两个及以上参数的设计方法. 函数为何要带参数呢?其实原因很简单, ...
- java遍历Map的几种方式
1.遍历map的几种方式:private Hashtable<String, String> emails = new Hashtable<String, String>(); ...
- oracle 表迁移方法 (二) 约束不失效
DB:11.2.0.3.0 在oracle 表迁移方法 (一)中,只是move了一张普通的表,如果表的字段带有主键约束呢 ? [oracle@db01 ~]$ sqlplus / as sysdba ...
- poj 3580 SuperMemo
题目连接 http://poj.org/problem?id=3580 SuperMemo Description Your friend, Jackson is invited to a TV sh ...
- 关于android WebViewClient的方法解释
1.public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true ...
- iOS-添加测试设备Identifier
第一步:确认你的设备已经连接 第二步:点击xcode上"Windows"标签,选择"Devices" 第三步:在弹出的左框选择你要添加的设备.在右边框里可以找到 ...
- 服务器 IIS 发布网站 支持下载 apk 和 ipa
方法/步骤 1 打开IIS服务管理器,找到服务器,右键-属性,打开IIS服务属性: 2 单击MIME类型下的"MIME类型"按钮,打开MIME类型设置窗口: 3 单击" ...
- 57.DDR3的系统时钟编译错误
错误:Xst:2033 - Port I of Input buffer ddr3_mig/memc3_infrastructure_inst/se_input_clk.u_ibufg_sys_clk ...