Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7512 - Хойш 1 шилжилт

Өгөгдсөн массивын элементүүдийг хойш нь нэг цикл шилжилт хий. Өөрөөр хэлбэл 1-рийг 2-рт, 2-рыг 3-рт, гэх мэт сүүлийн элементийг 1-рт тус тус шилжүүл.

Input

Эхний мөрөнд массивын элементийн тоо өгөгдөнө. n<=100.

Хоёр дахь мөрөнд массивын элементүүд нэг нэг зайгаар тусгаарлагдан өгөгдөнө. Int Төрөл.

Output

Шилжилт хийсний дараах массивын элементүүд.

Жич: 1-рхээс эхлэн хэвлэнэ.

Example

Input:
5
1 2 3 4 5
Output: 5 1 2 3 4

Нэмсэн:Bataa
Огноо:2013-02-21
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE

hide comments
2023-11-07 13:09:10
#include <bits/stdc++.h>
using namespace std;

int main() {
int n, i;
cin >> n;
int a[n];

for (i = 0; i < n; i++) {
cin >> a[i];
}

int s = a[n - 1];

for (i = n - 1; i > 0; i--) {
a[i] = a[i - 1];
}

a[0] = s;

for (i = 0; i < n; i++) {
cout << a[i] << " ";
}

return 0;
}
2023-03-16 09:36:29
#include<bits/stdc++.h>
using namespace std;
int main()
{
int s,n,i;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
cin >> a[i];
}
s=a[n-1];
for(i=n-1;i>0;i--)
{
a[i]=a[i-1];
}
a[0]=s;
for(i=0;i<n;i++)
{
cout<<a[i]<<" ";
}
return 0;
} llriin psda
2022-12-04 06:39:36
2EZ4ME
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;
int main (){

ll n, i;

cin >> n;

vector<ll> g;

while(cin >> i){

g.push_back(i);
}
cout << g[n - 1] << " ";
for(i = 0; i < n - 1; i ++){

cout << g[i] << " ";
}
return 0;
}

Last edit: 2022-12-04 06:40:46
2022-05-16 16:30:40
package Spoj;

import java.util.Scanner;

public class RGB7512 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

int n, b;

n = input.nextInt();

int x [] = new int [n];

for (int i=0; i<n; i++) {
x[i] = input.nextInt();
}

for (int i=n-1; i>=0; i--) {
b = x[i];
x[i] = x[i-1];
x[i-1] = b;
if (i == 1) {
i = i - n;
}
}

for (int i=0; i<n; i++) {
System.out.print(x[i]+ " ");
}

input.close();

}
}
2022-04-04 07:58:24
#include<bits/stdc++.h>
using namespace std;
int main() {
int d, n ,a[1000];
cin >> n ;
for(int i=1 ; i<=n ; i++) {
cin >> a[i];
}
d=a[n];
for(int j=n ; j>=2 ; j--) {
a[j]=a[j-1];
}
a[1]=d;
for(int i=1 ; i<=n ; i++) {
cout << a[i] << " ";
}
return 0;
}

Last edit: 2022-04-04 08:02:13
2022-04-03 11:35:22
yoyoyooyoyoyoyoyoyoyooyoyoyoyyoyoyoyyoyoyyoyoyoyoyoyoyyoyooyyoy
2021-12-13 03:21:27
bod psdakuda

Last edit: 2021-12-13 03:21:44
2020-11-18 09:06:24
hello
2020-10-04 08:16:20
|Notes:|
1. Don't post any source code here.|
2. Please be careful, leave short comments only. Don't spam here.|
3. For more discussion (hints, ideas, solutions) please visit our forum.|
4. Authors are allowed to delete the post and use html code here (e.g. to provide some useful links).|
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.