You are viewing a single comment's thread. Return to all comments →
#include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <string> #include <bitset> #include <cstdio> #include <limits> #include <vector> #include <climits> #include <cstring> #include <cstdlib> #include <fstream> #include <numeric> #include <sstream> #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; int main(){ int n; int k; int q; cin >> n >> k >> q; vector<int> a(n); for(int a_i = 0;a_i < n;a_i++){ cin >> a[a_i]; } for(int i=0;i<k;i++){ for(int j=0;j<n;j++){ if(j+1!=n) { a[j+1]=a[j]; } else { a[0]=a[n-1]; } } } for(int a0 = 0; a0 < q; a0++){ int m; cin >> m; cout<<a[m]<<endl;} return 0; }
can you plz tell me what is wrong with my code???
Circular Array Rotation
You are viewing a single comment's thread. Return to all comments →
can you plz tell me what is wrong with my code???