Skip to content

Commit 233849f

Browse files
Mislove Has Lost an Array
Added a new problem with the solution
1 parent f033ff2 commit 233849f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Question.txt

1.65 KB
Binary file not shown.

Solution.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
int main()
4+
{
5+
long long int i,mini=1,mine=0,maxi=1,maxo=0,n,s,e;
6+
cin>>n>>s>>e;
7+
8+
for(i=1;i<=s-1;i++)
9+
{
10+
mini=2*mini;
11+
mine+=mini;
12+
}
13+
mine+=n-s+1;
14+
15+
for(i=1;i<=e-1;i++)
16+
{
17+
maxi=2*maxi;
18+
maxo+=maxi;
19+
}
20+
maxo+=1;
21+
22+
23+
maxo+=(n-e)*(maxi);
24+
cout<<mine<<" "<<maxo;
25+
return 0;
26+
}

0 commit comments

Comments
 (0)