Codeforces Round #586 (Div. 1 + Div. 2)D(二分图构建,思维,结论需数论证明)
#include<bits/stdc++.h>
using namespace std;
long long a[200007];
vector<int>v[77];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
for(int i=1;i<=n;++i){
cin>>a[i];
long long tmp=a[i];
int cnt=0;
while(!(tmp&1)){
tmp/=2;
++cnt;//二进制上最后一位1的位置
}
v[cnt].push_back(i);
}
int mx=v[0].size();
int pos=0;
for(int i=1;i<=64;++i)
if(v[i].size()>mx){
mx=v[i].size();
pos=i;
}
cout<<n-mx<<"\n";
for(int i=0;i<=64;++i){
if(i==pos)
continue;
for(int j=0;j<v[i].size();++j)
cout<<a[v[i][j]]<<" ";
}
return 0;
}
Codeforces Round #586 (Div. 1 + Div. 2)D(二分图构建,思维,结论需数论证明)的更多相关文章
- Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...
- Educational Codeforces Round 63 (Rated for Div. 2) 题解
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...
- Educational Codeforces Round 39 (Rated for Div. 2) G
Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...
- Educational Codeforces Round 48 (Rated for Div. 2) CD题解
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...
随机推荐
- Centos6.10-FastDFS-Storage-Nginx配置
nginx+fastdfs-nginx-module 安装此处省略. 1.进入工作目录 cd /usr/local/nginx/conf 2.创建子目录 mkdir configs 3.创建stora ...
- 专题一 Java基础语法
小辨析: println 输出字符后,下一个输出的字符会换行展示 print 输出字符后,下一个输出字符不会会换展示 system.out.println() 空格 分支结构:if-else使用说明 ...
- HGAME 2020 week1 web
1.Cosmos 的博客 知识点:git source code leak 2.接 头 霸 王 Description HGAME Re:Dive 开服啦~ 打开题目,提示了"头" ...
- Java 枚举(enum)的学习
Java 枚举(enum)的学习 本文转自:https://blog.csdn.net/javazejian/article/details/71333103 枚举的定义 在定义枚举类型时我们使用的关 ...
- LVS、Tomcat、Nginx、PHP优化项
一.LVS 性能调优的方法最佳实践1.最小化安装编译系统内核2.优化持久服务超时时间: 1)显示超时时间 #ipvsadm -Ln --timeout #Timeout (tcp t ...
- 算法复习 : 插入排序原理,记忆,时间复杂度 (7行java实现)
最近啃了一遍吴伟民老师的<数据结构>,记录一些心得. 一种简洁的插入排序 : 1.重要概念 : 哨兵 1.在我们要排序的数组中,哨兵做为一个辅助的位置,一般是0下标的槽位做为哨兵 2.哨兵 ...
- Linux - Shebang(#!)
1. Shebang这个符号通常在Unix系统的脚本中第一行开头中写到,它指明了执行这个脚本文件的解释程序.
- Bugku-CTF社工篇之简单的社工尝试
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 高级索引
import numpy as np x = np.array([[1, 2], [3, 4], [5, 6]]) y = x[[0,1,2], [0,1,0]] print (y) import n ...
- vue项目中vant tab改变标签颜色
找了几种方法,只有下面这个方法是生效的: <van-tabs v-model="active" sticky title-active-color="#144a9e ...