subject
Computers and Technology, 27.08.2021 01:50 giovney

Programming challenge description: A number is a self-describing number when (assuming digit positions are labeled 0 to N-1), the digit in each position is equal to the number of times that that digit appears in the number.
Input:
Your program should read lines of text from standard input. Each line contains a single positive integer, N.
Output:
For each input N, print 1 to standard output if N is a self-describing number. Otherwise, print 0.
For the curious, here''s how 2020 is a self-describing number: Position 0 has value 2 and there are two 0s in the number. Position 1 has value 0 because there are no 1's in the number. Position 2 has value 2 and there are two 2's. And the position 3 has value 0 and there are zero 3's.
Test 1
Test Input
2020
Expected Output
1
Test 2
Test Input
22
Expected Output
1
Test 2
Test Input
22
Expected Output
0
Test 3
Test Input
1210
Expected Output
1

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
Hassan is writing his master’s thesis, which is a thirty-page document. he received some feedback from his professor in the form of comments, but does not see where the comments are. what is the fastest way for hassan to find the feedback?
Answers: 3
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Idon’t understand the double8 coding problem. it is java
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
1. which of the following is not an example of an objective question? a. multiple choice. b. essay. c. true/false. d. matching 2. why is it important to recognize the key word in the essay question? a. it will provide the answer to the essay. b. it will show you a friend's answer. c. it will provide you time to look for the answer. d. it will guide you on which kind of answer is required.
Answers: 1
You know the right answer?
Programming challenge description: A number is a self-describing number when (assuming digit posit...
Questions
question
Mathematics, 03.04.2020 05:56
question
History, 03.04.2020 05:56
Questions on the website: 13722361