A. Distance and Axis 题目:http://codeforces.com/contest/1401/problem/A 题解:对于n来说分两种情况,一是奇数,二则是偶数 ①奇数:对于k来说如果是奇数且小于等于他,ans=0:若k是奇数并且大于n,则ans=k-n:若k是偶数并且k<n,那么ans=1:若k为偶数并且k>n,则ans=k-n ②偶数:若k为偶数并且k<=n,则ans=0:若k为偶数并且k>n,则ans=k-n:若k为奇数并且k<n,则ans=1…
A. Ahahahahahahahaha 题目:http://codeforces.com/contest/1407/problem/A 题解:最多进行n/2的操作次数,我们统计这n个数中1的个数,是否过半,如果没有代表0过半,因此输出剩余的0的个数即可 如果1的个数过半,则考虑1的个数是奇数还是偶数,若为奇数,则再减去一个输出:若为偶数个,则直接输出. 代码: #include<bits/stdc++.h> using namespace std; typedef long long ll;…
Codeforces Round #431 (Div. 2) A. Odds and Ends time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Where do odds begin, and where do they end? Where does hope emerge, and will they ever break…