(School Competition) Ural 1991 the battle near the swamp

Source: Internet
Author: User

In the battle with the Trade Federation, Queen Amidala decided to ask Gungans for help. jar Binks escorted the queen and her people to the holy place where they had an agreement. the Gungans agreed to provide their army in order to get the droids of the Federation out from the capital. the Gungan ruler Boss Nass was so grateful for uniting the nations that he appointed jar a general. and here they are: two armies lined up along the bank of the swamp. the droids of the Federation are well-disciplined soldiers. they stand in neat formation, divided N Blocks K Droids each. The Gungans have a foolproof weapon against droids, which is small energy bils called Boom booms. One such ball can disable each one droid. Jar Binks also decided to split his army N Parts and give each part a task to destroy the corresponding block of droids. each part received ed a truck with boom booms. now help General Binks calculate the number of boom booms that will be left unused and the number of droids that will keep ve the attack. you can assume that when a boom is fired at a droid by a gungan, it always hits the target. inputthe first line of the input contains numbers N And K (1 ≤ N , K ≤ 10 000). The second line contains N Numbers A I (0 ≤ A I ≤ 100 000)-the number of boom-booms in I -Th truck. outputprint two integers-the number of unused boom booms and the number of specified ved droids. Sample

Input Output
4 52 7 5 0
2 8


Difficult to understand

Star Wars has n regions and each region has K targets.

Attacks are also divided into N groups, with each group containing AI bombs. Each bomb has one target.

Ask the remaining number of targets and bombs.

 
# Include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <limits. h> using namespace STD; int n, m; int main () {While (~ Scanf ("% d", & N, & M) {int S = 0, sum = 0, x; For (INT I = 0; I <N; I ++) {scanf ("% d", & X); If (x <m) S + = (m-x ); // number of record targets if (x> m) sum + = (X-m); // number of record bombs} printf ("% d \ n", sum, s);} return 0 ;}


Contact Us

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.