Những câu hỏi liên quan
huynh chinh
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 4 2022 lúc 22:03

#include <bits/stdc++.h>

using namespace std;

long long n,i;

bool kt;

int main()

{

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

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

cin>>n;

kt=true;

for (i=2; i*i<=n; i++)

if (n%i==0) kt=false;

if (kt==true && n>1) cout<<"YES";

else cout<<"NO";

return 0;

}

Bình luận (0)
Sự tâm
Xem chi tiết
Trần Minh Vương
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 11 2021 lúc 23:26

uses crt;

const fi='doc.inp'

var f1:text;

n,i:integer;

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

begin

clrscr;

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

readln(f1,n);

for i:=1 to n do 

 read(f1,a[i]);

min:=a[1];

for i:=1 to n do 

  if min>=a[i] then min:=a[i];

writeln(min);

close(f1);

readln;

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)
Hoàng Thị Minh Tuyết
Xem chi tiết
Huệ Hà
Xem chi tiết
Huệ Hà
3 tháng 4 2022 lúc 9:15

Giúp em với ạ mai em thi cuối học kì rồi ạ 

Bình luận (0)
huynh chinh
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 4 2022 lúc 21:49

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i;

int main()

{

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

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

cin>>n;

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

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

if (a[i]>0) cout<<a[i]<<" ";

return 0;

}

Bình luận (0)
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)