Những câu hỏi liên quan
Lala
Xem chi tiết
Trương Huy Hoàng
13 tháng 12 2023 lúc 22:58

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll> mp;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    freopen("MAP1.INP","r",stdin);
    freopen("MAP1.OUT","w",stdout);
    ll n; cin >> n;
    ll a[n+5];
    for(ll i=1;i<=n;i++) cin >> a[i], mp[a[i]]++;
    for(pair<ll,ll> it:mp) cout << it.first << " " << it.second << "\n";
}

Chúc bạn học tốt!

Bình luận (0)
ngo minh duc
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 9:26

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.

Bình luận (0)
quang cảnh lê
Xem chi tiết
Nguyễn Lê Phước Thịnh
27 tháng 2 2021 lúc 11:02

uses crt;

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

i,n,x,dem:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

 begin

write('A[',i,']='); readln(a[i]);

end;

write('Nhap x='); readln(x);

dem:=0;

for i:=1 to n do 

if a[i]=x then inc(dem);

writeln(dem);

readln;

end.

Bình luận (0)
Thùy Linhh
Xem chi tiết
nguyễn an phát
24 tháng 5 2021 lúc 11:14

program xuat_hien_k_lan;

uses crt;

var  i,n,k,j:integer;

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

begin

clrscr;

write('nhap n:');readln(n);

for i:=1 to n do

begin

write('a[',i,']=');readln(a[i]);

end;

write('nhap k:');readln(k);

for i:=1 to n do

begin

for j:=i to n do

if a[i]=a[j] then inc(b[i]);

end;

for i:=1 to n do

if b[i]>=k then write(a[i]:5);

readln;

end.

Bình luận (0)
Ngọc Ty
Xem chi tiết
Kiều Vũ Linh
24 tháng 4 2023 lúc 18:56

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

i,n:integer;

s:longint;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

Write('Nhap phan tu thu ',i,' = ');readln(a[i]);

s:=s+a[i];

End;

Write('Cac phan tu vua nhap la ');

For i:=1 to n do

Write(a[i]:8);

Writeln;

Write('Tong cua chung la ',s);

Readln

End.

Bình luận (0)
helpme
Xem chi tiết
Minh Lệ
13 tháng 2 2020 lúc 13:41

Program hotrotinhoc;

var k,n,i,x: integer;

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

begin

write('n='); readln(n);

write('k='); readln(k);

for i:=1 to n do

begin

write('a[',i,']='); readln(x);

inc(a[x]);

end;

for i:=1 to 32000 do

if a[i]=k then write(i,' ');

readln

end.

Bình luận (0)
 Khách vãng lai đã xóa
Phùng Phúc An
Xem chi tiết
APOK FF
Xem chi tiết
HOÀNG ĐẠI PHÚC
Xem chi tiết