ioi competition - mawhiba · ioi ari bob ari, bob, chio, dmitri, ehab, fritz or gerald
TRANSCRIPT
IOI Competition International Olympiad in Informatics
IOIwww.mawhiba.org
IOIwww.mawhiba.org
IOIwww.mawhiba.org
IOI
IOI
IFIP
IOI
IOIwww.mawhiba.org
•
•
•
•
•
•
•
•
•
•
•
•
• C
JAVA
•
•
IOIwww.mawhiba.org
•
•
•
•
IOIwww.mawhiba.org
–
•
aspxdefaultPagesArorgmawhibawwwhttps
١
https://www.mawhiba.org/Ar/programs/competitions/mawhoob/Pages/Registration.aspx
IOIwww.mawhiba.org
٢
٣
IOIwww.mawhiba.org
٤
٥
IOIwww.mawhiba.org
•
––
––
٦
IOIwww.mawhiba.org
(Mathematical Skills
IOIwww.mawhiba.org
،
، ١٠، و
IOIwww.mawhiba.org
,,,,,
IOIwww.mawhiba.org
،
⅙
¼
⅓
½
،
IOIwww.mawhiba.org
xx
،
B
C
A B
C D
IOIwww.mawhiba.org
ACDEFGHB
AB
A
C D
E F
G H
B
IOIwww.mawhiba.org
Thinking Skills
IOIwww.mawhiba.org
IOIwww.mawhiba.org
IOIwww.mawhiba.org
A E
C E
B F
D F
IOIwww.mawhiba.org
IOIwww.mawhiba.org
A
B
1) A and C2) E and I3) E and H4) A and H
IOIwww.mawhiba.org
IOIwww.mawhiba.org
IOIwww.mawhiba.org
IOIwww.mawhiba.org
IOIwww.mawhiba.org
FB
F D E C A B
B A A A C E D E E D A
F D C D A E D D D A
IOIwww.mawhiba.org
A, B, C, D
TTT
A
B
C
D
IOIwww.mawhiba.org
P Q , R , S ,,T
P Q R S T
TSQ
RPQSR
RPSP
QPP
IOIwww.mawhiba.org
-
- WiFi
0 1 1 0
0 1 1 1
1 1 0 1
1 1 0 0
IOIwww.mawhiba.org
‘B’ , ‘E’,’R’, ‘A’ , ‘S’
1) : BRSBAASE , : RBSRBAE
2) : BRSEBAASE, : RBBSRBAE
3) : BRSEBAASE, : RBSRBAE
4) : ,BRSEBAAS, : RBSRBE
ZAC
PAN
IOIwww.mawhiba.org
IOIwww.mawhiba.org
IOIwww.mawhiba.org
) E D C B A) D B C A E) E C D A B) D C E B A
IOIwww.mawhiba.org
)
)
)
)
)
IOIwww.mawhiba.org
A
B
C
D
IOIwww.mawhiba.org
-
-
-
IOIwww.mawhiba.org
IOIwww.mawhiba.org
IOIwww.mawhiba.org
) ––
) ––
) ––
) ––
IOIwww.mawhiba.org
A B C D
IOIwww.mawhiba.org
BobAri
Ari, Bob, Chio, Dmitri, Ehab, Fritz or Gerald
IOIwww.mawhiba.org
A
A, B, C, D, E, F, G, H, I or J
IOIwww.mawhiba.org
önigsbergK
IOIwww.mawhiba.org
,,,,,,,,,,,,,,,,,,,,,,
IOIwww.mawhiba.org
,,
,
،
IOIwww.mawhiba.org
orgbeaveregyptwwwhttps
orgbebraswwwhttps
IOIwww.mawhiba.org
B-F
A and B
D
D
Chio
I
IOIwww.mawhiba.org
Programming Algorithmatics Skills
IOIwww.mawhiba.org
▪ C
IOIC
▪
▪
▪
▪
Flowchart
Coding
http://cpp.sh1
https://www.tutorialspoint.com/compile_cpp_online.php
https://paiza.io/en/projects/new?language=cpp
–
–
%
IOIwww.mawhiba.org
welcome
▪
▪ eelcomW
Coding
Correct Code
#include <iostream>
using namespace std;
int main()
{
cout << " welcome ";
}
Print the sum of two numbers:
-----------------------------------
The sum of 29 and 30 is : 5
IOIwww.mawhiba.org
▪
▪
▪
x
IOIwww.mawhiba.org
Coding
Correct Code
#include <iostream>
using namespace std;
int main()
{
int width, lngth, area, peri;
cout << "\n\n Find the Area and Perimeter of a Rectangle:\n";
cout << "-------------------------------------------------\n";
cout<<" Input the length of the rectangle: ";
cin>>lngth;
cout<<" Input the width of the rectangle: ";
cin>>width;
area=(lngth*width);
peri=2*(lngth+width);
cout<<" The area of the rectangle is : "<< area << endl;
cout<<" The perimeter of the rectangle is : "<< peri << endl;
cout << endl;
return 0;
}
Find the Area and Perimeter of a Rectangle:
-------------------------------------------------
Input the length of the rectangle : 10
Input the width of the rectangle : 15
The area of the rectangle is : 150
The perimeter of the rectangle is : 50
IOIwww.mawhiba.org
▪
▪
▪
statement.if
IOIwww.mawhiba.org
Coding
Correct Code
#include <iostream>
using namespace std;
int main()
{
signed long num1 = 0;
cout << "\n\n Check whether a number is positive, negative or zero :\n";
cout << "-----------------------------------------------------------\n";
cout << " Input a number : ";
cin >> num1;
if(num1 > 0)
{
cout << " The entered number is positive.\n\n";
}
else if(num1 < 0)
{
cout << " The entered number is negative. \n\n";
}
else
{
cout << " The number is zero.\n\n";
}
return 0;
}
Check whether a number is positive, negative or zero :
-----------------------------------------------------------
Input a number : 8
The entered number is positive
IOIwww.mawhiba.org
▪
▪
▪
IOIwww.mawhiba.org
Coding
Correct Code
#include <iostream>
using namespace std;
int main()
{
float frh, cel;
cout << “\n\n Convert temperature in Fahrenheit to Celsius :\n”;
cout << “---------------------------------------------------\n”;
cout << “ Input the temperature in Fahrenheit : “;
cin >> frh;
cel = ((frh * 5.0)-(5.0 * 32))/9;
cout << “ The temperature in Fahrenheit : “ << frh << endl;
cout << “ The temperature in Celsius : “ << cel << endl;
cout << endl;
return 0;
}
Convert temperature in Fahrenheit to Celsius:
---------------------------------------------------
Input the temperature in Fahrenheit: 95
The temperature in Fahrenheit: 95
The temperature in Celsius: 35
IOIwww.mawhiba.org
▪
▪
▪
IOIwww.mawhiba.org
Coding
Correct Code
#include <iostream>
using namespace std;
int main()
{
int a,i=0;
cout << "\n\n Print the multiplication table of a number upto 10:\n";
cout << "--------------------------------------------------------\n";
cout << " Input a number: ";
cin>> a;
for (i=1;i<=10;i++)
{
cout << a<<" x "<< i << " = "<<a*i<<"\n" ;
}
}
Print the multiplication table of a number up to 10:
--------------------------------------------------------
Input a number: 5
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
IOIwww.mawhiba.org
▪
▪
IOIwww.mawhiba.org
Coding
Correct Code
# include <iostream>
# include <string>
using namespace std;
int main()
{
char fname[30], lname [30];
cout << "\n\n Print the name in reverse where last name comes first:\n";
cout << "-----------------------------------------------------------\n";
cout << " Input First Name: ";
cin >> fname;
cout << " Input Last Name: ";
cin >> lname;
cout << " Name in reverse is: "<< lname << " "<< fname <<endl;
cout << endl;
return 0;
}
ما
Print the name in reverse where last name comes first:
-----------------------------------------------------------
Input First Name: Alexandra
Input Last Name: Abramov
Name in reverse is: Abramov Alexandra
IOIwww.mawhiba.org
▪
▪
▪ opFor lo
IOIwww.mawhiba.org
Coding
Correct Code
#include <iostream>
using namespace std;
int main()
{
int i;
cout << "\n\n Find the first 10 natural numbers:\n";
cout << "---------------------------------------\n";
cout << " The natural numbers are: \n";
for (i = 1; i <= 10; i++)
{
cout << i << " ";
}
cout << endl;
}
The natural numbers are:
1 2 3 4 5 6 7 8 9 10
IOIwww.mawhiba.org
▪
▪
▪
loopForstatementIF
IOIwww.mawhiba.org
(Coding)
Correct Code
#include <iostream>
using namespace std;
int main()
{
int num1, ctr = 0;
cout << "\n\n Check whether a number is prime or not:\n";
cout << "--------------------------------------------\n";
cout << " Input a number to check prime or not: ";
cin>> num1;
for (int a = 1; a <= num1; a++)
{
if (num1 % a == 0)
{
ctr++;
}
}
if (ctr == 2)
{
cout << " The entered number is a prime number. \n";
}
else {
cout << " The number you entered is not a prime number. \n";
}
}
Check whether a number is prime or no Input a number to check prime or not: 13 The entered number is a prime number
IOIwww.mawhiba.org
▪
▪
▪ while
IOIwww.mawhiba.org
(Coding)
Correct Code
#include <iostream>
using namespace std;
int main()
{
int num1, num2, r, sum;
cout << "\n\n Find the sum of digits of a given number:\n";
cout << "----------------------------------------------\n";
cout << " Input a number: ";
cin >> num1;
num2 = num1;
while (num1 > 0)
{
r = num1 % 10;
num1 = num1 / 10;
sum = sum + r;
}
cout << " The sum of digits of " << num2 << " is: " << sum << endl;
}
Input a number: 1234
he sum of digits of 1234 is: 10T
IOIwww.mawhiba.org
• https://www.mawhiba.org/
• https://www.mawhiba.org/Ar/programs/competitions/mawhoob/Pages/Registration.aspx
• https://ioi2019.az/
• https://stats.ioinformatics.org/
• https://www.bebras.org/?q=examples
• https://www.beaveregypt.org/
• https://www.w3resource.com/cpp-exercises/basic/index.php
• https://www.computer-pdf.com/programming/c-cpp/521-tutorial-c-practice-exercises-
with-solutions.html