Бодолт илгээх | Бүх бодолтууд | Шилдэг бодолтууд | Жагсаалт руу буцах |
RGB7316 - Гурван тооны ХБЕХ |
Өгөгдсөн 3 натурал тооны хамгийн бага ерөнхий хуваагдагчийг (ХБЕХ) ол.
Input
Нэг мөрөнд 3 натурал тоо зайгаар тусгаарлагдан өгөгдөнө. Тоонууд 1200-аас ихгүй.
Output
ХБЕХ
Example
Input:
4 6 18
Output:
36
Нэмсэн: | 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
|
|||||||||
2022-11-22 05:52:21
never gonna give you up |
|||||||||
2022-11-17 12:33:22
#include <iostream> using namespace std; int main() { int a,b,c,n=0,s=0; cin>>a>>b>>c; for(int i=0; i<b; i++){ n+=a; if(n%b==0) break; } for(int i=0; i<c; i++){ s+=n; if(s%c==0) break; } cout<<s; return 0; } //orgil edr huul2 |
|||||||||
2022-11-17 04:36:21
#include <bits/stdc++.h> using namespace std; int main(){ long p,a,b,c,m,k; cin>>a>>b>>c; m=a*b; while(a!=b){ if(a>b) a=a-b; else b=b-a; } k=m/a; p=k*c; while(k!=c){ if(k>c) k=k-c; else c=c-k; } p=p/c; cout<<p<<endl; } |
|||||||||
2022-09-01 11:22:47
#include<stdio.h> int main () { int num1, num2, num3, multi, hbeh; scanf("%d%d%d", &num1, &num2, &num3); multi=num1*num2*num3; while(multi!=0) { if(multi%num1==0&&multi%num2==0&&multi%num3==0) { hbeh=multi; } multi--; } printf("%d",hbeh); } Ганзориг Энгүүнбаяр |
|||||||||
2022-08-04 09:15:13
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e,f,g,n,y,z,x,j,i,s; cin>>a>>b>>c; s=1; d=a; if(d<b) d=b; if(d<c) d=c; for(i = 2; i<=d ; i++){ if(a%i==0||b%i==0||c%i==0){ s=s*i; if(a%i==0) a=a/i; if(b%i==0) b=b/i; if(c%i==0) c=c/i; i--; } } cout<<s; return 0; } |
|||||||||
2022-06-22 11:02:50
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
|||||||||
2022-01-09 08:03:36
#include<stdio.h> int main() { int a,b,c,d; scanf("%d%d%d",&a,&b,&c); d=a; while(true) { if(d%b==0 && d%c==0) break; d++; while(true) { if(d%a==0) break; d++; } } printf("%d",d); } joohn l hugatsaa hetercihle ahha |
|||||||||
2021-08-26 13:29:44
gcd geer yaj bodhu |
|||||||||
2020-12-22 07:07:50
#include<bits/stdc++.h> #include<cmath> using namespace std; int XBEX(int x,int y){ if (y==0) return x; else return XBEX(y,x%y); } int main() { int a,b,c,d,e; cin>>a>>b>>c; d=a*b/XBEX(a,b); e=d*c/XBEX(d,c); cout<<e; return 0; } |
|||||||||
2020-11-25 10:35:28
#include<bits/stdc++.h> using namespace std; main() { int a,b,c,max,min1,min2,i=2,d; scanf("%d%d%d",&a,&b,&c); max=a; min1=b; min2=c; if(max<b) { max=b; min1=a; min2=c; } if(max<c) { max=c; min1=a; min2=b; } d=max; while(i>0) { d=max*i; i++; if(d%min1==0 && d%min2==0) break; } printf("%d",d); } |