Test instructions: give you n a sieve, the first sieve has a number that can represent the range 1-a[i], give you the last sieve and, ask you how many values each sieve cannot have.
Problem-solving ideas: Get the range of values for each sieve.
Problem Solving Code:
1 //File name:c.cpp2 //Author:darkdream3 //Created time:2015 April 13 Monday 00:38 58 seconds4 5#include <vector>6#include <list>7#include <map>8#include <Set>9#include <deque>Ten#include <stack> One#include <bitset> A#include <algorithm> -#include <functional> -#include <numeric> the#include <utility> -#include <sstream> -#include <iostream> -#include <iomanip> +#include <cstdio> -#include <cmath> +#include <cstdlib> A#include <cstring> at#include <ctime> - #defineLL Long Long - - using namespacestd; - LL N, m; -LL a[200005]; in intMain () { -scanf"%i64d%i64d",&n,&m); toLL sum =0 ; + for(inti =1; I <= N;i + +) - { thescanf"%i64d",&a[i]); *Sum + =A[i]; $ }Panax Notoginseng for(inti =1; I <= N;i + +) - { theLL tsum = Sum-A[i]; +LL mx = min (a[i],m-(n1)); ALL mi = (M-tsum); the if(Mi <=0) +Mi =1; -printf"%i64d", a[i]-(mx-mi+1)); $ } $ return 0; -}
View Code
Codeforces 534C Polycarpus ' Dice construction