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

RGB7540 - Утга олголт 0

NxN хэмжээтэй квадрат массивыг жишээн дээрх загвараар дүүргэ.

Input

Квадрат массивын хэмжээ натурал тоо N өгөгдөнө. N<10.

Output

Квадрат массивын элементүүдийг мөр мөрөөр нь хэвлэнэ.

Гэхдээ элемент бүрийг 3 хоосон зайд хойш нь шахаж хэвлэнэ. Жишээг сайн ажиглана уу.

Жишээн дээрх 1-ийн тоо гэхэд урдаа, хойноо тус бүр 2 хоосон зайтай байна. Мөн 16-гийн тоо урдаа, хойноо тус бүр 1 хоосон зайтай байна.

Example

Input:
5

Output:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

Нэмсэн:Bataa
Огноо:2013-02-07
Хугацааны хязгаарлалт: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
2019-04-02 08:20:37
#include<cstdio>
#include<cstdlib>
int main()
{
int a[100][100];
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
a[i][j]=(i-1)*n+j;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if (a[i][j]<10) printf(" ");
printf( "%d ",a[i][j]);
}
printf("\n");
}
}
2019-03-28 02:52:11


Last edit: 2019-03-28 02:52:49
2019-02-21 09:47:02
#include<bits/stdc++.h>

using namespace std;

int main(){
long long n,i,s;

cin>>n;

for(i=1;i<=n*n;i++){
if((i/10)>0) cout<<" "<<i;
else cout<<" "<<" "<<i;
if(i%n==0) cout<<endl;
}
cout<<endl;

return 0;
} lol
2018-12-13 02:17:34
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int b[100][100];
cin >>n;
int lol = 1;
for(int i = 1; i <= n; i++){
for(int j = 1;j<= n;j++){
b[i][j] = lol;
lol++;
}
}
for(int i = 1; i <= n;i++){
for(int j = 1;j <= n;j++){
printf("%2d ", b[i][j]);
}
cout<<endl;
}
}
2018-12-13 02:17:33
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int b[100][100];
cin >>n;
int lol = 1;
for(int i = 1; i <= n; i++){
for(int j = 1;j<= n;j++){
b[i][j] = lol;
lol++;
}
}
for(int i = 1; i <= n;i++){
for(int j = 1;j <= n;j++){
printf("%2d ", b[i][j]);
}
cout<<endl;
}
}
2018-03-07 08:26:01
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int b[100][100];
cin >>n;
int lol = 1;
for(int i = 1; i <= n; i++){
for(int j = 1;j<= n;j++){
b[i][j] = lol;
lol++;
}
}
for(int i = 1; i <= n;i++){
for(int j = 1;j <= n;j++){
printf("%2d ", b[i][j]);
}
cout<<endl;
}
}
2017-12-26 04:33:49


Last edit: 2017-12-26 04:36:48
2016-01-14 10:16:29
#include<cstdio>
#include<cstdlib>
int main()
{
int a[100][100];
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
a[i][j]=(i-1)*n+j;
for(int i=1;i<=n;i++)
{

for(int j=1;j<=n;j++)
{

if (a[i][j]<10) printf(" ");
printf( "%d ",a[i][j]);
}
printf("\n");
}
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.