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.|

RGB7530 - Массив эргүүлэлт

Өгөгдсөн n*m хэмжээст массивыг цагийн зүүний дагуу 90 градус эргүүл.

Input

Эхний мөрөнд массивын хэмжээс n,m натурал тоонууд зайгаар тусгаарлагдан өгөгдөнө. n,m<=50.

Дараагийн n мөрөнд m бүхэл тоонууд нэг нэг зайгаар тусгаарлагдан өгөгдөнө.

Output

Эргэсэн массив жишээн дээрх хэлбэрээр..

Example

Input:
3 4
1 2 3 4
5 6 7 8
9 10 11 12
Output:
4 3
9 5 1
10 6 2
11 7 3
12 8 4

Нэмсэн:Bataa
Огноо:2013-03-15
Хугацааны хязгаарлалт: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
2021-11-24 11:42:54
javascript code:
function processData(input) {
//Enter your code here
var lines = input.split("\n");
var line = lines[0];
var elms = line.split(" ");
var r = parseInt(elms[0]);
var c = parseInt(elms[1]);
var n = parseInt(elms[2]);
var map = [];
for(var i = 1; i <= r; i++){
var tRow = lines[i].split("");
var row = [];
for(var j = 0; j < c; j++){
if(tRow[j] === "."){
row.push(-1);
} else {
row.push(3);
}
}
map.push(row);
}
var repeat;
if(n < 2){
repeat = 0;
} else if(n%2 === 0){
repeat = 2;
} else if ((n+1)%4 === 0){
repeat = 3;
} else if ((n-1)%4 === 0){
repeat = 5;
}
for(var i = 2; i <= repeat; i++){
for(var j = 0; j < r; j++){
for(var k = 0; k < c; k++){
if(i === map[j][k] && i%2 === 1){
map[j][k] = -1;
if(j !== 0 && map[j-1][k] < i+3 && map[j-1][k] !== i){
map[j-1][k] = -1;
}
if(j !== r-1 && map[j+1][k] < i+3 && map[j+1][k] !== i){
map[j+1][k] = -1;
}
if(k !== 0 && map[j][k-1] < i+3 && map[j][k-1] !== i){
map[j][k-1] = -1;
}
if(k !== c-1 && map[j][k+1] < i+3 && map[j][k+1] !== i){
map[j][k+1] = -1;
}
} else if(i%2 === 0 && map[j][k] === -1){
map[j][k] = i+3;
}
}
}
}
for(var i = 0; i < r; i++){
var line = "";
for(var j = 0; j < c; j++){
if(map[i][j] > -1){
line+="O";
} else {
2020-01-02 15:22:53
BODOLTIIN AVAH YUM UU
2020-01-02 15:22:12
HOG UHAJ L BNUU
2020-01-02 15:21:57
HOG UHAJ L BNUU
2019-12-17 14:08:50
C++ avhuu
2019-12-06 12:17:31
#include <cstdio>
int main()
{
int n,m,i,j,a[50][50],b[50][50];
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
scanf("%d",&a[i][j]);
b[j][n+1-i]=a[i][j];
}
}
printf("%d %d\n",m,n);
for(j=1;j<=m;j++)
{
for(i=1;i<=n;i++)
{
printf("%d ",b[j][i]);
}
printf("\n");
}
}
2019-05-29 15:34:43
iostream bodson bodolt bn uu
2014-04-01 07:26:12 Tserennadmid
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main()
{
int a,b[100][100],c,i,s,max,r,t;
scanf("%d%d",&a,&c);
for(i=1;i<=a;i++)
{
for(int j=1;j<=c;j++)
scanf("%d",&b[i][j]);}
printf("%d %d\n",c,a);
for(i=1;i<=c;i++)
{for(int j=a;j>0;j--)
printf("%d ",b[j][i]);
printf("\n");
}


system("pause");
}
2014-01-21 13:56:27 ochirsvm
#include<stdio.h>

main()
{
freopen("b.in","r",stdin);
freopen("b.out","w",stdout);

int m,n;

scanf("%d%d",&m,&n);

while(m!=n){

if(m<n){
m=m+n;
}
else{
n=n+m;
}
}
printf("%d",n);
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.