Много лишнего(наверно), только с олимпиады!Как есть. uses crt; var b,n,i,k,c,o,x1:integer; f,s,ch:string; r,g: text; A:array [0..9] of integer; begin assign (r,'C:\Bin.txt'); reset (r); readln (r,f); close (r); for i:=1 to length(f) do begin s:=copy(f,1,1); if (s<>'0') or (s<>'1') or (s<>'2') or (s<>'3') or (s<>'4') or (s<>'5') or (s<>'6') or (s<>'7') or (s<>'8') or (s<>'9')then delete(f,1,1); if (s='0') or (s='1') or (s='2') or (s='3') or (s='4') or (s='5') or (s='6') or (s='7') or (s='8') or (s='9')then begin x1:=pos(s,ch); if x1<>0 then begin delete(ch,x1,1); ch:=ch+s; end else ch:=ch+s; end; end; val(ch,n,o); N := Abs(N); for i := 0 to 9 do A[ i ] := 0; while N > 0 do begin Inc(A[ N mod 10]); N := N div 10; end; assign (g,'C:\Bout.txt'); rewrite (g); for i := 0 to 9 do while A[ i ] > 0 do begin Write(g,i); Dec(A[ i ]); end; close(g); end.
Много лишнего(наверно), только с олимпиады!Как есть. uses crt; var b,n,i,k,c,o,x1:integer; f,s,ch:string; r,g: text; A:array [0..9] of integer; begin assign (r,'C:\Bin.txt'); reset (r); readln (r,f); close (r); for i:=1 to length(f) do begin s:=copy(f,1,1); if (s<>'0') or (s<>'1') or (s<>'2') or (s<>'3') or (s<>'4') or (s<>'5') or (s<>'6') or (s<>'7') or (s<>'8') or (s<>'9')then delete(f,1,1); if (s='0') or (s='1') or (s='2') or (s='3') or (s='4') or (s='5') or (s='6') or (s='7') or (s='8') or (s='9')then begin x1:=pos(s,ch); if x1<>0 then begin delete(ch,x1,1); ch:=ch+s; end else ch:=ch+s; end; end; val(ch,n,o); N := Abs(N); for i := 0 to 9 do A[ i ] := 0; while N > 0 do begin Inc(A[ N mod 10]); N := N div 10; end; assign (g,'C:\Bout.txt'); rewrite (g); for i := 0 to 9 do while A[ i ] > 0 do begin Write(g,i); Dec(A[ i ]); end; close(g); end.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
int K;
int N;
int count=0;
printf("Input N\n");
scanf("%d", &N);
int array[N];
for (int i=0; i < N; i++) array[i] = rand();
printf("Input K\n");
scanf("%d", &K);
for (int i=0; i < N; i++){
printf("%d, ", array[i]);
if (K < array[i]) count++;
}
printf("\nNumber of items, greater than K is %d\n", count);
}
Объяснение: