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 ;}