forked from Sniper7sumit/Hacktoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumber of sportsperson.cpp
More file actions
35 lines (29 loc) · 955 Bytes
/
number of sportsperson.cpp
File metadata and controls
35 lines (29 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// There are n number of sportspersons and each of their induvial scores are also given.They are stuck between two pillars. Each pillar has a strength. A sportsperson can
// come out only if he/she breaks both the pillars.Only one pillar can be broken at a time. A pillar can be broken only if its strength is a multiple of the score of the
// sportsperson. We have to find the number of sportspersons who can come out of the pillars.
// Input: N number of sprtspersons Scores of sportspersons Strength of pillars
// Output: number of sportspersons who can come out of the pillars
// This is the question
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n,p,q,c=0;
cin>>n;
int a[n];
for(int i=0; i<n; i++)
{
cin>>a[i];
}
cin>>p>>q;
for(int i=0; i<n; i++)
{
if(p%a[i]==0 && q%a[i]==0 )
c=c+1;
}
cout<<c;
return 0;
}