Бодолт илгээх | Бүх бодолтууд | Шилдэг бодолтууд | Жагсаалт руу буцах |
RGB7313 - ХИЕХ |
Өгөгдсөн хоёр натурал тооны хамгийн их ерөнхий хуваагчийг ол.
Input
Нэг мөрөнд хоёр натурал тоо нэг зайгаар тусгаарлагдан өгөгдөнө.
Output
ХИЕХ
Example
Input: 9 15 Output: 3
Нэмсэн: | Bataa |
Огноо: | 2013-01-11 |
Хугацааны хязгаарлалт: | 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-08-07 17:22:48
#include <iostream> #include <algorithm> using namespace std; int main() { int a,b; cin>>a>>b; cout<<__gcd(a,b); return 0; }khandmaa to tusa unen bodolt |
|||||||||
2023-05-22 04:28:54
oonh3 Last edit: 2023-05-22 04:32:37 |
|||||||||
2023-04-20 05:53:47
#include <iostream> using namespace std; main() { int a,b,c=1,i; cin>>a>>b; for(i=2; i<=a && i<=b; i++) if(a%i==0 && b%i==0) //golognuuude sn huul za yu c = i; cout<<c; return 0; } |
|||||||||
2023-03-15 04:11:56
#include <iostream> using namespace std; main() { int a,b,c=1,i; cin>>a>>b; for(i=2; i<=a && i<=b; i++) if(a%i==0 && b%i==0) c = i; cout<<c; return 0; } moii |
|||||||||
2023-03-11 03:01:57
#include<bits/stdc++.h> using namespace std; int main() { int s, n, x, h; cin >>n >>x; s = 1; while (s <= n || s <= x){ if(n % s == 0 && x % s == 0) h = s; s++; } cout <<h ; } mongol oyu computriin oroo |
|||||||||
2023-01-09 09:12:51
#include<bits/stdc++.h> using namespace std; int main() { int a,s,k,l; scanf("%d%d",&a,&s); for(int i=1;i<=s;i++) { if(0==a%i&&0==s%i) { l=i; } } printf("%d",l); } |
|||||||||
2023-01-01 13:36:53
#include<cstdio> #include<algorithm> #include<map> using namespace std; typedef long long llint; const int mod = 1000000000; map< int, int > A,B; void ucitaj( map< int, int > &M ) { int n,x; scanf("%d",&n); for( int i=0; i<n;i++){ scanf("%d",&x); for( int j=2; j*j<=x;++j) while( x%j == 0 ) x/=j, M[j]++; if( x > 1 ) M[x++]; } } int main(void) { ucitaj(A); ucitaj(B); llint ans = 1; bool vise = false; for( map< int , int > :: iterator it = A.begin(); it != A.end(); ++it ) if( B.count( it->first ) ) { int p = it->first; int r = min(A[p], B[p]); for( int i = 0; i < r; ++i ) { ans = ans * p; if( ans >= mod ) ans %= mod, vise = true; } } if( vise ) printf("%09d\n", (int)ans ); else printf("%d\n", (int)ans ); return 0; } // ene ghdee yg goy oldg shuu <3 |
|||||||||
2022-11-25 08:59:33
#include<bits/stdc++.h> using namespace std; int main() { int a, b; cin>>a>>b; cout<<__gcd(a,b); return 0; } you are dumb |
|||||||||
2022-11-22 07:21:46
#include <iostream> using namespace std; int main() { int a, b, c, d, e, i; cin>>a>>b; c=0; for (i=1; i<=100; i++) { d=a%i; e=b%i; if(d==0 && e==0) { c=i; } } cout<<c; // your code here return 0; } -Erbium |
|||||||||
2022-11-17 04:28:30
#include<bits/stdc++.h> using namespace std; int main(){ long a,b; cin>>a>>b; while(a!=b){ if(a>b) a=a-b; else b=b-a; } cout<<a<<endl; } Ola Amigos |