Lab 1 - CEN 110
Lab 1 - CEN 110
Shqip
Read an integer number and then show the number of digits that the number has.
Input specification
There will be only one integer number in the input which is between 1 and 3 billion.
Output specification
Show the numbers of digits that the given number has.
Input Output
3344 4
You are given a series of numbers, show the number of numbers which are greater than the average.
Input specification
The first number is the number of numbers (n) in the series where 1 < n ≤ 100.000. Then you will be given n
integer numbers where each of the is between -10.000 and 10.000.
Output specification
Just give one number which shows the number of numbers which are greater than the average of the series.
Sample Input I:
5
12345
Sample Output I:
2
http://acm.epoka.edu.al:8888/en/problem-pid-c49b
Processing Cost
Assume that processing a list of items costs the sum of
differences between the item and the max value in that
series. For example if we are given the series: 5 3 2 7,
thus, the max of this series is 7. Then, the processing
cost of it is
Input specification
In the first line, you will be given two numbers (n and
m). Then, in the following n lines, you will be given m
integers which are between -20000 and 20000 where n
and m are between 1 and 20000
Output specification
Show one integer: Minimum processing cost.
Explanation:
In sample input 1, there are 3 rows with 4 elements. The max of first row is 9 and the processing cost of it 12.
The max of the second row is 10 with a total processing cost of 10 (6+0+2+2). Then the third series has the
max of 9. And it’s processing cost is 16. So, the second row has the minimum processing cost: 10.
http://acm.epoka.edu.al:8888/en/problem-pid-c513
For his experiments, your professor wants to use sorted lists with n elements. The list will be produced
randomly, but at the same time he needs the list to be sorted in ascending order.
Question: Write a program that that produces random but sorted list where
Note: Nearly all programming languages have a randum number function. For C/C++, you can use rand()
function (from stdlib.h library) to produce a random number. For Example, in the statement:
r = rand()%10;
r will have a random value between 0 and 9.
Input specification
You will be given 2 integers: n, k; where n is between 1 and 5000 and 1 ≤ k ≤ 50.
Output specification
(Assume that the previous number before the first number is 0) Show the sorted list separated by spaces
http://acm.epoka.edu.al:8888/en/problem-pid-c490
Question:
Write a program that produces n random passwords.
Input specification
You will be given just one integer (n) where n is between 1 and 1000.
Output specification
Show n passwords with the given format above in n lines. All passwords must be different than all others.
http://acm.epoka.edu.al:8888/en/problem-pid-c4e9
Missing Number
Shqip
Mr John is a maths professor. He writes the exercises the students have to solve on the blackboard.
He writes a sequence of N different positive integers(0 < N < 1000) on the board but the students are lazy and
don’t want to study, so, they usually erase one number for fun.
As this happens so often he wants you to write a program to help him with it.
Input specification
-In the first line you will get N(the number of positive integers).
-After that in the next line you will get N positive integers
-In the third line you will read N-1 positive integers. There is no number greater than 1000.
Output specification
The number that got erased.
http://acm.epoka.edu.al:8888/en/problem-pid-c491