Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {Волкович Максим (volkovcih.maksim.s@gmail.com), 112гр., v1.0,
- описать функцию, подсчитывающую количество разлиных элементов в массиве V типа T1}
- program t_14_29_a (input,output);
- const n=20;
- type T1 = array[1..n] of 0..999;
- var V:T1; i:integer;
- function diff(a:T1):integer;
- var t:set of 0..999; i,count:integer;
- begin
- t:=[]; count:=0;
- for i:=1 to n do
- if not(a[i] in t) then
- begin
- count:=count+1;
- t:=t+[a[i]];
- end;
- diff:=count;
- end;
- begin
- for i:=1 to n do read(V[i]);
- writeln(diff(V));
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement