Những câu hỏi liên quan
Hoàng Thị Minh Tuyết
Xem chi tiết
Mộng Chúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 3 2022 lúc 10:03

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n,j;

bool kt;

int main()

{

freopen("nguyento.inp","r",stdin);

freopen("nguyento.out","w",stdout);

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

for (i=1; i<=n; i++)

if (a[i]>1) 

{

kt=true;

for (j=2; j*j<=a[i]; j++)

if (a[i]%j==0) kt=false;

if (kt==true) cout<<a[i]<<" ";

}

return 0;

}

Bình luận (0)
An Đinh
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:52

Đề yêu cầu gì vậy bạn?

Bình luận (1)
Trần Trung Hiếu THCS Thá...
Xem chi tiết
Nya arigatou~
Xem chi tiết
Nya arigatou~
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 4 2021 lúc 13:16

const fi='tamgiac.dat'

      fo='tamgiac.out'

var f1,f2:text;

    a,b,c,d,e,f:array[1..100]of integer;

    i,n,dem1,dem2,dem3:integer;

    ab,bc,ac:real;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,n);

for i:=1 to n do

  readln(f1,a[i],b[i],c[i],d[i],e[i],f[i]);

dem1:=0;

dem2:=0;

dem3:=0;

for i:=1 to n do

  begin

     ab:=sqrt(sqr(a[i]-c[i])+sqr(b[i]-d[i]));

     ac:=sqrt(sqr(a[i]-e[i])+sqr(b[i]-f[i]));

     bc:=sqrt(sqr(c[i]-e[i])+sqr(d[i]-f[i]));

     if (ab>0) and (ac>0) and (bc>0) and (ab+ac>bc) and (ab+bc>ac) and

(ac+bc>ab) then

        begin

           if (ab=ac) or (ac=bc) then inc(dem1);

           if ((ab=ac) and (ab<>bc) and (ac<>bc)) then inc(dem2);

           if ((ac=bc) and (bc<>ab) and (ac<>ab)) then inc(dem2);

           if ((ac=bc) and (ac<>ab) and (bc<>ab)) then inc(dem2);

           if sqr(ab)=sqr(ac)+sqr(bc) then inc(dem3);

           if sqr(ac)=sqr(bc)+sqr(ab) then inc(dem3);

           if sqr(bc)=sqr(ab)+sqr(ac) then inc(dem3);

        end;

  end;

writeln(f2,dem1);

writeln(f2,dem2);

writeln(f2,dem3);

close(f1);

close(f2);

end.

Bình luận (0)
Nguyễn Đức Anh Khoa
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 1 2021 lúc 12:30

const fi='tong.inp'

fo='tong.out'

var f1,f2:text;

a:array[1..100]of integer;

n,i,t:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,n);

for i:=1 to n do 

  read(f1,a[i]);

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(f2,t);

close(f1);

close(f2);

end.

Bình luận (0)
APOK FF
Xem chi tiết
Trần Trọng Hùng
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 3 2022 lúc 11:20

#include <bits/stdc++.h>
using namespace std;
unsigned long long a[1000],i,n,uc;
//chuongtrinhcon
unsigned long long ucln(long long a,long long b)
{
    if (b==0) return(a);
    else return(ucln(b,a%b));
}
//chuongtrinhchinh
int main()
{
    freopen("sn3.inp","r",stdin);
    freopen("uc.out","w",stdout);
    cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

uc=ucln(a[1],a[2]);

for (i=3; i<=n; i++)

uc=ucln(uc,a[i]);

cout<<uc;
    return 0;
}

 

Bình luận (1)