A. A Serial Killer time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his power…
Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim. The killer starts with two potentia…
题目链接:http://codeforces.com/contest/776/problem/D D. The Door Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Moriarty has trapped n people in n distinct rooms in a hotel. Some room…
处理出前缀和,枚举k的幂,然后从前往后枚举,把前面的前缀和都塞进map,可以方便的查询对于某个右端点,有多少个左端点满足该段区间的和为待查询的值. #include<cstdio> #include<map> using namespace std; typedef long long ll; map<ll,int>cnts; int n,m,e; ll a[100010],ans; ll b[1001]; int main() { // freopen("c…
Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m switches. E…
Molly Hooper has n different kinds of chemicals arranged in a line. Each of the chemicals has an affection value, The i-th of them has affection value ai. Molly wants Sherlock to fall in love with her. She intends to do this by mixing a contiguous se…
Sherlock has a new girlfriend (so unlike him!). Valentine's day is coming and he wants to gift her some jewelry. He bought n pieces of jewelry. The i-th piece has price equal to i + 1, that is, the prices of the jewelry are 2, 3, 4, ... n + 1. Watson…