传送门:http://codeforces.com/contest/1108/problem/E2 E2. Array and Segments (Hard version) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The only difference between easy and hard versions i…
E2 - Median on Segments (General Case Edition) 题目大意:给你一个数组,求以m为中位数的区间个数. 思路:很巧秒的转换,我们把<= m 数记为1, >m的数 记为-1, 求其前缀, 我们将问题转变成求以<= m 的数作为中位数的区间个数, 答案就变为ans(m) - ans(m - 1),我们可以用上面求得的前缀用bit就能求出答案. #include<bits/stdc++.h> #define LL long long #d…
A. Chunga-Changa 题目链接:http://codeforces.com/contest/1181/problem/A 题目 Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik&quo…
B. Split a Number time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Dima worked all day and wrote down on a long paper strip his favorite number n consisting of l digits. Unfortunately, the stri…
原文链接:传送 #include"algorithm" #include"iostream" #include"cmath" using namespace std; long long x,y,z,ans; int main(){ while(cin>>x>>y>>z){ ans=; ,i=,j=; s=(x+y)/z; cout<<s<<" "; i=x%z; j…