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

RGB7317 - Цөөн квадрат

Өгөгдсөн тэгш өнцөгтийг хамгийн цөөн квадратадуудад хуваа.  

Input

2 бүхэл эерэг тоо зайгаар тусгаарлагдан өгөгдөнө.

Output

Мөр тус бүрт квадратын талын хэмжээ хэдэн ширхэг байгааг зайгаар тусгаарлан хэвлэнэ.

Example

Input 1:

11 4

Output:

3 1
1 3

 

4 2

3 1

1 3

 


Нэмсэн:Bataa
Огноо:2013-01-14
Хугацааны хязгаарлалт: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-13 04:03:10
#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <cmath>

using namespace std;

// Headers
string toString (double);
int toInt (string);
double toDouble (string);

int main() {
int a, b;

cin >> a;
cin >> b;
while (a > 0 && b > 0) {
if (a > b) {
cout << b;
cout << " ";
cout << (double) a / b << endl;
a = a % b;
} else {
cout << a;
cout << " ";
cout << (double) b / a << endl;
b = b % a;
}
}
return 0;
}

// The following implements type conversion functions.
string toString (double value) { //int also
stringstream temp;
temp << value;
return temp.str();
}

int toInt (string text) {
return atoi(text.c_str());
}

double toDouble (string text) {
return atof(text.c_str());
}
2024-05-06 05:19:04
UNDRAM X TSELMEG
2024-05-06 05:15:41
BI GEGEED HAIRTAI GEGEEG HARAH BURD SETGEL HUDUDLDUG BAS BI GEGEETEE HMT HONOJ BAINA GJ ZUUDELSEN
2024-05-06 05:15:41
.


Last edit: 2024-05-06 05:15:54
2024-05-06 05:14:45
MUNJIII
2024-05-06 05:14:29
TSETSE ZAILAA

Last edit: 2024-05-06 05:16:18
2024-05-06 05:14:29
TSETSEEEE

2024-05-06 05:13:45
#include <iostream>
using namespace std;

int main() {
int a,b;
cin>>a>>b;
while(a!=0 && b!=0){
if(a>b){
cout<<b<<" "<<a/b<<endl;
a=a%b;
}
else{
cout<<a<<" "<<b/a<<endl;
b=b%a;
}
}
return 0;
}
2024-04-09 09:28:34
hi gays
2024-04-05 05:59:05
шүдний аппаратаа авахаар явсан
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.