Skip to content

Commit 68422fe

Browse files
authored
Create Circular_Array_Rotation.cpp
1 parent fcb8db4 commit 68422fe

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
int main()
4+
{
5+
int n,k,q,j,w;
6+
cin>>n>>k>>q;
7+
int a[n],i,b[n];
8+
for(i=0;i<n;i++)
9+
{
10+
cin>>a[i];
11+
}
12+
for(i=0;i<n;i++)
13+
{
14+
b[(i+k)%n]=a[i];
15+
}
16+
for(i=0;i<q;i++)
17+
{
18+
int m;
19+
cin>>m;
20+
cout<<b[m]<<endl;
21+
}
22+
return 0;
23+
}

0 commit comments

Comments
 (0)