Golden Contest.finaL

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Problem 1 ((Minimum Between input numbers))

Kamla has an assignment to find the minimum number in a set of unique numbers. the set size is
unknown. The special case for this problem is that, the minimum number should be found between
two reference numbers, not in the whole set. Help Kamla to solve this problem using
programming.
‫ الحالة‬.‫ هذه األرقام فريدة ال تتكرر‬.‫ عدد األرقام غير محدد‬.‫كاملة لديها مهمة إليجاد أقل رقم بين مجموعة من األرقام‬
‫ هذين الرقمين المرجعيين يتم‬.‫الخاصة هي أن الرقم األدنى يجب أن يوجد بين رقمين مرجعيين ليس في المجموعة كلها‬
.‫ ساعد كاملة في حل هذه المشكلة باستخدام البرمجة‬.‫إدخالهما‬
Constraints:
Sample numbers are unique (No repetition). ‫األرقام ال تتكرر في المجموعة‬

Inputs:
Integer number: The set size. )‫عدد األرقام أو (حجم المجموعة‬
The first reference number. ‫الرقم األول‬
The second reference number. ‫الرقم الثاني‬

Output:
The minimum number between the first and second numbers. (Note: Not the minimum number in
all the set).
.‫ وليس األقل في المجموعة كلها‬،‫الرقم األقل المتواجد بين الرقمين المدخلين‬

Example
Input Output
8 (‫(عدد األرقام‬ -1
3 (‫(الرقم المرجعي األول‬
9 )‫(الرقم المرجعي الثاني‬

7
3
-1
4 ‫األرقام‬
6
2
9
-8
Problem 2 ((Gross Salary))

In Alpha company, the employee is paid as the following: If his basic salary is less than 1500 Ly,
then the Tax = 10% of base salary and Allowance = 90% of basic salary.
If his salary is either equal to or above 1500 Ly, then the Tax = 500 Ly and Allowance = 98% of
basic salary.
If the Employee's salary is input, write a program to find his gross salary.

:‫ يتم دفع المرتبات للموظفين كالتالي‬،‫في شركة ألفا‬


.%30 ‫ والعالوة‬،‫ من المرتب األساسي‬%10 ‫ دينار تكون الضريبة‬1500 ‫لو كان المرتب األساسي أقل من‬
%15 ‫ دينار والعالوة‬500 ‫ دينار تكون الضريبة‬1500 ‫لو كان المرتب األساسي يساوي أو يتجاوز‬
.‫أكتب برنامج لحساب صافي المرتب‬

NOTE: Gross Salary = Basic Salary –Tax + Allowance


.‫ العالوة‬+ ‫صافي المرتب = المرتب األساسي – الضرائب‬
Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line
contains an integer salary.
.‫ ثم يتم إدخال المرتبات‬، ‫أو مدخل هو عدد الموظفين‬
Output
the gross salary of the employees.
.‫المرتبات بعد حساب صافي المرتب‬

Example
Input Output
3 ‫عدد المرتبات‬ 1443.6
1203 ‫مرتب‬ 11048.3
10042 ‫مرتب‬
1312 ‫مرتب‬ 1574.4
Problem 3 ((Find the Relation)
Draw the following shape

1
232
34543
4567654
567898765

Problem 4 ((Total Expenses))


While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than
1000.
If the quantity and price per item are input, write a program to calculate the total expenses.
‫ إذا كانت كمية وسعر‬.‫ قطعة‬1000 ‫ لو كانت الكمية المشتراة أكتر من‬%10 ‫يقوم أحد المحالت بعمل تخفيض للزبائن قدره‬
.‫ أكتب برنامج يحسب إجمالي الفاتورة‬،‫الصنف مدخلة من المستخدم‬
Input
quantity and price. ‫الكمية والسعر‬

Output
Output the total expenses while purchasing items. ‫إجمالي الفاتورة‬

Example
Input Output
100 ‫الكمية‬ 15000 ‫اإلجمالي‬
150 ‫السعر‬
Input Output
1200 ‫الكمية‬ 21600 ‫اإلجمالي‬
20 ‫السعر‬
Problem 5 ((Two vs Ten))

Hossin and Tarek are playing a game with a number X. In one turn. The goal of the game is to
make X divisible by 10 by multiply X by 2.
Help Hossin and Tarek to find the smallest number of turns necessary to win the game (it may be
possible to win in zero turns) or determine that it is impossible to make X divisible by 10.

.10 ‫ وحساب عدد المرات التي ستجعل العدد يقسم على‬، 2 ‫ تقوم اللعبة على أخذ رقم معين وضربه في‬،‫يلعب حسين وطارق لعبة أرقام‬
‫ حتى يجعلوه قابالً للقسمة‬2 ‫باستخدام البرمجة ساعد حسين وطارق على إيجاد أقل عدد من المرات التي يحتاجونها لضرب العدد في‬
‫ حينها يتوقف عن‬10 ‫ لن يقسم على‬2 ‫ فإن العدد مهما ضربناه في‬10 ‫ ولم يقبل القسمة بعد على‬1000 ‫ إذا تجاوزت النتيجة‬،10 ‫على‬
-1 ‫المحاولة ويطبع‬

Constraint:
0 < X < 50
50 ‫ و‬0 ‫ بين‬x ‫تتراوح قيمة‬

Input
• The first line of the input contains a single integer T denoting the number of test cases. test
cases follows.
‫أول سطر يحتوي عدد حاالت االختبار‬
• The first and only line of each test case contains a single integer denoting the initial value of
X
X ‫كل سطر من يحتوي حالة اختبار‬

Output
For each test case, print the minimum required number of turns or print −1 if there is no way to
win the game.
1- ‫لكل حالة اختبار سيطبع عدد مرات التكرار أو سيطبع‬

Example
Input Output
3 <--- ‫عدد حاالت االختبار‬ 0
30 -1
4 ‫حاالت االختبار‬ 1
25
Problem 6 ((Gregorian Calendar))
According to Gregorian Calendar, it was Monday on the date 01/01/2001 and Sunday on the date 01/01/2000. If
any year is input, Write a program to display what is the day on the 1st January of this year.

‫ لو تم إدخال سنة معينة هل تستطيع تحديد يوم‬.‫ يوم األحد‬2000-1-1 ‫ وصادف يوم‬،‫ يوم االثنين‬2001-1-1 ‫حسب التقويم الميالدي صادف يوم‬
.‫األسبوع الذي بدأت به تلك السنة‬

Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer
year.
.‫ ثم كل سطر يحتوي سنة مطلوب اختبارها‬،‫أول سطر يحتوي عدد حاالت االختبار‬

Output
Display the day on the 1st January of that year.
.‫ يوم األسبوع الذي بدأ به شهر يناير من تلك السنة‬/‫المخرج‬

Example
Input Output
3 saturday
1994 tuesday
1991 wednesday
2014

You might also like