# Codeforces 534C Polycarpus ' Dice construction

Source: Internet
Author: User

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

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.