tuki2501

sobacthang

Sep 4th, 2018
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.60 KB | None | 0 0
  1. uses crt;
  2. var
  3.   a:array[1..20] of longint;
  4.   i,n,c:longint;
  5.  
  6. function stpNum(x:longint):boolean;
  7. var
  8.   tmp:string;
  9.   i,n,c:longint;
  10. begin
  11.   str(x,tmp);
  12.   n:=length(tmp);
  13.   if n=1 then stpNum:=false
  14.   else
  15.     begin
  16.       c:=1;
  17.       for i:=1 to n-1 do
  18.         if tmp[i]<=tmp[i+1] then inc(c);
  19.       if c=n then stpNum:=true
  20.       else stpNum:=false;
  21.     end;
  22. end;
  23.  
  24. procedure solve();
  25. begin
  26.   for i:=1 to n do
  27.     begin
  28.       read(a[i]);
  29.       if stpNum(a[i]) then inc(c);
  30.     end;
  31.   readln();
  32. end;
  33.  
  34. begin
  35.   clrscr();
  36.  
  37.   readln(n);
  38.   solve();
  39.   writeln(c);
  40.  
  41.   readln();
  42. end.
Advertisement
Add Comment
Please, Sign In to add comment