Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool kpal(int v[101],int n,int k)
- {
- int r[101];
- int nr=1;
- for(int i=k+1;i<=n;i++)
- {
- r[nr]=v[i];
- nr++;
- }
- for(int i=1;i<=k;i++)
- {
- r[nr]=v[i];
- nr++;
- }
- int st=1;int dr=n;
- while(st<=dr)
- {
- if(r[st]!=r[dr])
- {
- return 0;
- }
- st++;
- dr--;
- }
- return 1;
- }
- int main()
- {
- int n;
- cin>>n;
- int v[101];
- for(int i=1;i<=n;i++)
- {
- cin>>v[i];
- }
- int k;
- cin>>k;
- cout<<kpal(v,n,k);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement