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

RGB7002 - Гурвалжин

Өгөгдсөн гурвалжны периметрийг ол.

Input

Гурвалжны талууд бүхэл тоогоор нэг мөрөнд зайгаар тусгаарлагдан өгөгдөнө.

Output

Гурвалжны периметр.

Example

Input:
3 4 5

Output:
12


Нэмсэн:Bataa
Огноо:2011-01-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
2024-05-20 07:07:17
#include<iostream>
using namespace std;

int main(){
int n;
cin>>n;
int a[100][100];
for(int i = 0 ; i < n ; i++){
for(int j = 0 ; j < n ; j++){
cin >> a[i][j];
}
}
for (int i = 0; i < n; i++) {
int t = a[i][i];
a[i][i] = a[i][n - i - 1];
a[i][n - i - 1] = t;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
}
2024-05-20 07:05:35
#include <iostream>

using namespace std;

const int MAX = 300;

int main() {
int m, n, r;
cin >> m >> n >> r;

int matrix[MAX][MAX];
for (int i = 0; i < m; ++i)
for (int j = 0; j < n; ++j)
cin >> matrix[i][j];

int numRings = min(m, n) / 2;

for (int ring = 0; ring < numRings; ++ring) {
int rotations = r % (2 * (m + n - 4 * ring) - 4);

for (int rotation = 0; rotation < rotations; ++rotation) {
int temp = matrix[ring][ring];

// deed talig erguuleh
for (int j = ring; j < n - ring - 1; ++j)
matrix[ring][j] = matrix[ring][j + 1];

// baruun taliig erguuleh
for (int i = ring; i < m - ring - 1; ++i)
matrix[i][n - ring - 1] = matrix[i + 1][n - ring - 1];

// dood taliig erguuleh
for (int j = n - ring - 1; j > ring; --j)
matrix[m - ring - 1][j] = matrix[m - ring - 1][j - 1];

// zuun talig erguuleh
for (int i = m - ring - 1; i > ring; --i)
matrix[i][ring] = matrix[i - 1][ring];

matrix[ring + 1][ring] = temp;
}
}

for (int i = 0; i < m; ++i) {
for (int j = 0; j < n; ++j)
cout << matrix[i][j] << " ";
cout << endl;
}

return 0;
}

2024-05-20 06:29:11
#include <iostream>
using namespace std;

int main() {
int n;
cin >> n;

int a[100][100];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
for (int i = 0; i < n; i++) {
int t = a[i][i];
a[i][i] = a[i][n - i - 1];
a[i][n - i - 1] = t;
}

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

return 0;
}
2024-05-19 07:19:59
a,b,c=list(map(int,input().split()))
print(a+b+c)
pyton deer shu
2024-05-18 08:42:33
a


Last edit: 2024-05-18 09:03:04
2024-05-17 11:26:41
https://s.team/p/fvrn-rgmc/MHGBQRNB
2024-05-16 05:53:57
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,i,b,s;
scanf("%d",&n);
b=0;
while(n!=0){
if(n%10%2==0){
b+=n%10;
}
n=n/10;

}

printf("%d",b);

}
2024-05-16 05:32:13
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
scanf("%d%d%d",&a ,&b,&c);
if(c%b==0){
printf("%d\n",c/b);
if(c==b){
printf("%d",b);
}
if(c!=b){
printf("%d",c/(c/b));
}
}
if(c%b!=0){
printf("%d %d",c/b+1,c%b);
}
}
2024-05-16 05:30:25
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,min,s=0,max;
scanf("%d%d",&a,&b);
if(a<b) max=b;
else max=a;
while(s!=1){
if(max%a==0 && max%b==0) s++;
else max++;
}
printf("%d",max);
return 0;
}
2024-05-16 05:16:43
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,s,x,n;
scanf("%d",&n);
s=0;
while(n>0) {
x=n%10;
s=s+x;
n=n/10;
}
printf("%d",s);
return 0;
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.