Skip to content

Commit 400057e

Browse files
committed
Added 755A - PolandBall and Hypothesis.cpp
1 parent 89f09dc commit 400057e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

755A - PolandBall and Hypothesis.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
bool isPrime(int x)
7+
{
8+
if (x<=1)
9+
{
10+
return false;
11+
}
12+
for(int i=2;i<x;i++)
13+
{
14+
if(x%i==0)
15+
{
16+
return false;
17+
}
18+
}
19+
return true;
20+
}
21+
22+
int main()
23+
{
24+
int n;
25+
cin>>n;
26+
int ans;
27+
for(int m=1;m<=1000;m++)
28+
{
29+
if(!isPrime(n*m+1))
30+
{
31+
ans=m;
32+
break;
33+
}
34+
}
35+
cout<<ans<<endl;
36+
}
37+
38+
39+
40+
41+

0 commit comments

Comments
 (0)