Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
//chuongtrinhcon
long long gcd(long long a,long long b)
{
if (b==0) return(a);
return gcd(b,a%b);
}
//chuongtrinhchinh
int main()
{
cin>>a>>b;
if ((a>0 && b>0) or (a<0 && b<0)) cout<<a/gcd(a,b)<<" "<<b/gcd(a,b);
else cout<<"-"<<-a/gcd(-a,b)<<" "<<b/gcd(-a,b);
return 0;
}
uses crt;
var a,b,x,y:integer;
//chuongtrinhcon
function ucln(var a,b:integer):integer;
var r:integer;
begin
while b>0 do
begin
r:=a mod b;
a:=b;
b:=r;
end;
ucln:=a;
end;
//chuongtrinhchinh
begin
clrscr;
readln(a,b);
x:=a;
y:=b;
if (x>0) and (y>0) then writeln(x div ucln(a,b),' ',y div ucln(a,b));
if (x<0) and (y<0) then
begin
x:=abs(x);
y:=abs(y);
a:=abs(a);
b:=abs(b);
writeln(x div ucln(a,b),' ',y div ucln(a,b));
end;
if (x<0) and (y>0) then
begin
write('-');
x:=abs(x);
y:=abs(y);
a:=abs(a);
b:=abs(b);
writeln(x div ucln(a,b),' ',y div ucln(a,b));
end;
if (x>0) and (y<0) then
begin
write('-');
x:=abs(x);
y:=abs(y);
a:=abs(a);
b:=abs(b);
writeln(x div ucln(a,b),' ',y div ucln(a,b));
end;
readln;
end.
uses crt;
var a,b,x,y:integer;
//chuongtrinhcon
function ucln(var a,b:integer):integer;
var r:integer;
begin
while b>0 do
begin
r:=a mod b;
a:=b;
b:=r;
end;
ucln:=a;
end;
//chuongtrinhchinh
begin
clrscr;
readln(a,b);
x:=a;
y:=b;
if (x>0) and (y>0) then writeln(x div ucln(a,b),' ',y div ucln(a,b));
if (x<0) and (y<0) then
begin
x:=abs(x);
y:=abs(y);
a:=abs(a);
b:=abs(b);
writeln(x div ucln(a,b),' ',y div ucln(a,b));
end;
if (x<0) and (y>0) then
begin
write('-');
x:=abs(x);
y:=abs(y);
a:=abs(a);
b:=abs(b);
writeln(x div ucln(a,b),' ',y div ucln(a,b));
end;
if (x>0) and (y<0) then
begin
write('-');
x:=abs(x);
y:=abs(y);
a:=abs(a);
b:=abs(b);
writeln(x div ucln(a,b),' ',y div ucln(a,b));
end;
readln;
end.
Program HOC24;
var n,i: integer;
begin
write('Nhap so nguyen: '); readln(n);
for i:=1 to 10 do
writeln(n,' x ',i,' = ',n*i);
readln
end.
uses crt;
var n,i:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to 10 do
writeln(n,'*',i,'=',n*i);
readln;
end.
uses crt;
var a,b:integer;
{-----------------chuong-trinh-con-------------------}
function ucln(x,y:integer):integer;
var i,uc:integer;
begin
if x<y then
begin
uc:=1;
for i:=1 to x do
if (x mod i=0) and (y mod i=0) then
begin
if uc<i then uc:=i;
end;
end
else begin
uc:=1;
for i:=1 to y do
if (x mod i=0) and (y mod i=0) then
begin
if uc<i then uc:=i;
end;
end;
ucln:=uc;
end;
{--------------------------chuong-trinh-chinh------------------------}
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
writeln(a,'/',b,'=',a div ucln(a,b),'/',b div ucln(a,b));
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,ln,i,n;
int main()
{
cin>>n;
ln=LLONG_MIN;
for (i=1; i<=n; i++)
{
cin>>x;
ln=max(ln,x);
}
cout<<ln;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,vt,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
nn=a[1];
for (i=1; i<=n; i++) nn=min(nn,a[i]);
vt=0;
for (i=1; i<=n; i++) if (min==a[i]) vt=i;
cout<<nn<<endl;
cout<<vt;
return 0;
}
lỗi r
lỗi