A.Even Odds 给你n和k, 把从1到n先排奇数后排偶数排成一个新的序列,输出第k个位置的数. 比如 10 3  拍好后就是 1 3 5 7 9 2 4 6 8 10   第3个数是5. //cf 318 A //2013-06-18-20.30 #include <iostream> using namespace std; int main() { __int64 n, k; while (cin >> n >> k) { if (k <= (n+1)…
A. Sereja and Swaps time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As usual, Sereja has array a, its elements are integers: a[1], a[2], ..., a[n]. Let's introduce notation: A swap operatio…
B. Sereja and Suffixes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/368/B Description Sereja has an array a, consisting of n integers a1, a2, ..., an. The boy cannot sit and do nothing, he decided to study an…
B. Sereja ans Anagrams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/367/B Description Sereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, ..., an. Similarly, sequence b con…
题目链接:http://codeforces.com/contest/381/problem/E  E. Sereja and Brackets time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja has a bracket sequence s1, s2, ..., sn, or, in other words, a…
Sereja and Dima time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja and Dima play a game. The rules of the game are very simple. The players have n cards in a row. Each card contains a n…
http://codeforces.com/contest/368/problem/D 题意:有a.b两个数组,a数组有n个数,b数组有m个数,现在给出一个p,要你找出所有的位置q,使得位置q  q+p   q+2*p  .....q+(m-1)*p   经过一定的操作(不改变数据大小)全等于b数组. 思路:首先肯定对a数组离散,然后二分对a.b数组分配好离散后的值.其实我们只需要枚举0————p位置,哈希记录,然后从q----一直滚到q(m-1)*p>=n,对于一个数据,出来第一个数,进去最后…
由于n比较小,直接暴力解决 #include <iostream> #include <vector> #include <algorithm> #include <numeric> #include <functional> #include<iterator> using namespace std; int main(){ int n,k; cin >> n >> k; vector<int>…
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,m; cin >> n >> m; vector<vector<)); ; i < n; ++ i){ ; j < m ; ++ j){ cin >> a[i][j]; } } ) cout<<n<&…
#include <iostream> #include <vector> #include <algorithm> #include <numeric> using namespace std; int main(){ int n,s; cin >> n >> s; vector<int> a(n); ; i < n ; ++ i) cin >> a[i]; sort(a.begin(),a.end()…