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 16:30
The most common battery cable terminal is a that provides a large surface contact area with the ability to tighten the terminal onto the battery post using a nut and bolt.
Answers: 2
question
Computers and Technology, 24.06.2019 04:30
Write and test a python program to find and print the largest number in a set of real (floating point) numbers. the program should first read a single positive integer number from the user, which will be how many numbers to read and search through. after reading in all of the numbers, the largest of the numbers input (not considering the count input) should be printed.
Answers: 1
question
Computers and Technology, 24.06.2019 09:00
Why might you chose to crest a function resume
Answers: 1
question
Computers and Technology, 24.06.2019 22:00
Ican’t open these when it’s just a comment. someone pls explain why this is happening
Answers: 1
You know the right answer?
Programming challenge description: A number is a self-describing number when (assuming digit posit...
Questions
question
Mathematics, 22.10.2020 01:01
question
Mathematics, 22.10.2020 01:01
question
Mathematics, 22.10.2020 01:01
question
Mathematics, 22.10.2020 01:01
question
Geography, 22.10.2020 01:01
question
Mathematics, 22.10.2020 01:01
Questions on the website: 13722362