Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
ai giúp mình bài tập pascal về Lỗ hổng chữ số với?
Các chữ số từ 0 đến 9, nếu 1 chữ số bất kì có 1 đườg khép kín thì chữ số đoá koá 1 lỗ hổg, 2 đườg khép kín-->2 lỗ hổg, khôg koá đườg khép kín-->0 lỗ hổg.
Vậy 0,4,6,9 có 1 lỗ hổg.
8 có 2 lỗ hổg.
1,2,3,5,7 có 0 lỗ hổg.
Cho 1 số nguyên dương N(1<=N<=2147483647), ta luôn đếm đc số lỗ hổg của các chữ số xuất hiện trong đó.
Ví dụ : N=388247 -->N có 5 lỗ hổg.
Giúp mình nhanh nhé, 25 này mình thi tin học trẻ ùi.
1 Answer
- nonameLv 49 years agoFavorite Answer
//chắc bạn thi bảng B nhỉ ~~
var i,s:integer;
a:array[0..9] of byte;
n:longint
begin
a[8]:=2;a[0]:=1;a[4]:=1;a[6]:=1;a[9]:=1;
readln(n);
s:=0;
repeat
i:=n mod 10;
s:=s+a[i];
n:=n div 10;
until n=0;
writeln(s);
end.