Cho một dãy gồm n số nguyên dương A1,A2,…,An (N≤105,Ai≤109).

K
Khách

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.

26 tháng 9 2025

Các thiết bị vào – ra là nhóm các thiết bị ngoại vi đa dạng và phong phú nhất của máy tính.

+ Các thiết bị vào cho phép nhập dữ liệu vào máy tính như bàn phím, chuột…

+ Các thiết bị ra chuyển thông tin từ máy tính ra ngoài như màn hình, máy in, máy chiếu

+ Một số thiết bị có khả năng trao đổi thông tin hai chiều với máy tính có thể được coi vừa là thiết bị vào, vừa là thiết bị ra. Ví dụ các bộ nhớ ngoài kết nối theo cổng USB


26 tháng 9 2025

BỐ TAO CŨNG KHÔNG BIẾT


30 tháng 12 2021

em chào chj ạ,chj check ib em vs ạ

 

30 tháng 12 2021

sau này lm bộ trưởng bộ ngoại giao của hoc24 dc á

12 tháng 5 2021

program du_lieu;

uses crt;

var i,n:integer;

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

tbc:real;

f:text;

begin

clrscr;

assign(f,'DULIEU.INP');reset(f);

readln(f,n);

for i:=1 to n do

begin

read(f,a[i]);

end;

close(f);

for i:=1 to n do

tbc:=tbc+a[i];

writeln(tbc/n);

readln;

end.

14 tháng 1 2025

#include <bits/stdc++.h> #define N int(1e7) #define ll long long using namespace std; ll n,a[N],sum=0; int main() { ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin>>n; for(int i=1;i<=n;++i) { cin>>a[i]; sum+=a[i]; } cout<<sum/n; }


12 tháng 5 2021

uses crt;

const fi='dulieu.inp';

var f1:text;

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

n,i,t1,t2:integer;

begin

clrscr;

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

readln(f1,n);

for i:=1 to n do 

  read(f1,a[i]);

t1:=0;

t2:=0;

for i:=1 to n do 

 begin

if a[i]>0 then t1:=t1+a[i];

if a[i]<0 then t2:=t2+a[i];

end;

writeln('Tong cac so duong la: ',t1);

writeln('Tong cac so am la: ',t2);

close(f1);

readln;

end.

14 tháng 3 2022

#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;

}

14 tháng 1 2025

#include <bits/stdc++.h> #define N int(1e7) #define sp ios_base::sync_with_stdio(0),cin.tie(0),cin.tie(0),cout.tie(0); using namespace std; long long l,r,d=0,b[N]; bool a[N]; void sang() { a[1]=true; for(int i=2; i*i<=N; i++) if(a[i]==false) for(int j=i*i; j<=N; j+=i) a[j]=true; for(int i=1; i<=N; i++) { if(a[i]==false) d+=i; b[i]=d; } } int main() { sp sang(); int t; while(t--) { cin>>l>>r; cout<<b[r]-b[l-1]<<'\n'; } }

7 tháng 4 2025

def generate_sequence(n):

"""Generates the sequence A up to the nth term."""


if n < 0:

return "Please enter a non-negative number."


sequence = [] # This list will hold our sequence


if n >= 0:

sequence.append(1) # A[0] = 1


if n >= 1:

sequence.append(3) # A[1] = 3


for i in range(2, n + 1):

# Calculate A[i] using the rule: A[i] = A[i-1] * 2 * A[i-2]

next_term = sequence[i - 1] * 2 * sequence[i - 2]

sequence.append(next_term)


return sequence


# Let's see the sequence up to the 5th term (A[0] to A[5])

result = generate_sequence(5)

print(result) # Output: [1, 3, 6, 36, 432, 31104]

13 tháng 10 2019

Program hotrotinhoc;

const fi='lientiep.inp';

fo='lientiep.out';

var f: text;

a,b: array[1..32000] of integer;

k,i,n,max,vtd,vtc: integer;

procedure ip;

begin

assign(f,fi);

reset(f);

readln(f,n,k);

for i:=1 to n do read(f,a[i]);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

max:=0; i:=1;

while i<=n do

begin

j:=i;

t:=a[i];

while (a[j]<a[j+1]) and (j<=n) do

begin

inc(j);

t:=t+a[j];

end;

if t>max then

begin

max:=t;

vtd:=i;

vtc:=j;

end;

i:=j+1;

end;

for i:=vtc downto vtd do

begin

inc(d1);

b[d1]:=a[i];

end;

for i:= k dowto 1 do

write(f,b[i],' ');

close(f);

end;

begin

ip;

out;

end.

8 tháng 8 2023

uses crt;

var st:string;

d,i,n:integer;

begin

clrscr;

readln(n);

str(n,st);

d:=length(st);

for i:=d downto 1 do

write(st[i]);

readln;

end.