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.
Câu 7:
const fi='dayso.inp';
fo='dayso.out';
var f1,f2:text;
a,b:array[1..100]of integer;
i,n,dem,j,t,kt,dem1: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,'Tong cua day so la: ',t);
b[1]:=a[1];
dem:=1;
for i:=1 to n do
begin
kt:=0;
for j:=1 to dem do
if a[i]=b[j] then kt:=1;
if kt=0 then
begin
inc(dem);
b[dem]:=a[i];
end;
end;
for i:=1 to dem do
begin
dem1:=0;
for j:=1 to n do
if b[i]=a[j] then inc(dem1);
writeln(f2,b[i],' xuat hien ',dem1,' lan');
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll i, j, n, a[1000005], dem = 0, m;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> a[i];
if (a[i] % 3 == 0)
{
n--;
i--;
}
}
for (i = 1; i <= n; i++)
{
cout << a[i] << " ";
}
cout<<endl;
for(i=1;i<=n;i++)
{
if(a[i]%5==0)
{
for(j=i;j<=n;j++)
{
a[j]=a[j+1];
}
n--;
i--;
}
}
for(i=1;i<=n;i++)
{
cout<<a[i]<<" ";
}
return 0;
}
uses crt;
var a,b,c:array[1..1000]of integer;
i,n,dem,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
for i:=1 to n do
if max=a[i] then
begin
inc(dem);
b[dem]:=a[i];
c[dem]:=i;
end;
if dem=1 then writeln('So lon nhat la: ',b[dem],' vi tri la: ',c[dem])
else writeln('So lon nhat la: ',b[1],' vi tri la: ',c[1]);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,a[1000],t,dem,t1;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]%2==0) cout<<a[i]<<" ";
cout<<endl;
t=0;
dem=0;
for (i=1; i<=n; i++)
if (a[i]%2==0)
{
t=t+a[i];
dem++;
}
cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0)<<endl;
t1=0;
for (i=1; i<=n; i++)
if (a[i]%2!=0 || a[i]%3==0) t1+=a[i];
cout<<t1;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,a[1000];
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
sort(a+1,a+n+1);
for (i=n; i>=1; i--) cout<<a[i]<<" ";
return 0;
}
Var a:array[1..100] of integer;
i,d1,d2:integer;
Begin
For i:=1 to 100 do
Begin
Write('Nhap phan tu thu ',i);readln(a[i]);
End;
For i:=1 to 100 do
If a[i] mod 2 = 0 then d1:=d1+1
Else d2:=d2+1;
Writeln('So phan tu chan la ',d1);
Write('So phan tu le la ',d2);
Readln;
End.
uses crt;
var n,i,a[100],dem1,dem2:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
dem1:=0;
dem2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then inc(dem1)
else inc(dem2);
end;
writeln(dem1,' ',dem2);
readln;
end.
```python
def nen_day_so(N):
if N == 1:
return 1
else:
return (nen_day_so(N-1) + N) % 1000000000
N = int(input("Nhập N: "))
ket_qua = nen_day_so(N)
print(ket_qua)
```