Friday the 13th, Programmers Day

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
345 Friday the 13th, Programmers Day FINISHED False 7200 397318823 Sept. 13, 2013, 3:40 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 129 ) B Triskaidekaphobia PROGRAMMING *special 2000

Triskaidekaphobia is a fear of number 13. Ordinary people who suffer from this phobia feel uncomfortable around numbers 13, 130, 513 etc, but you, being a programmer, take this fear one step further. For example, consider number 7. It's ok when written in decimal, but written in base 4 it becomes 13, the dreadful number! The more you think about it, the worse it looks. Number 100 has as many as 13 notations which contain 13! And there are numbers which have 13 in infinite number of their notations! Luckily, you can do any math in binary, which is completely safe from the nasty number. But still, you want to be able to estimate the level of nastiness of any number. Your task is: given an integer n , find the number of different integer bases b ( b ≥ 2) for which n , written in base b , contains at least one 13. Assume that "digits" of the number in bases larger than 10 are written not as letters but as decimal numbers; thus, 30 in base 16 is not 1E but (1)(14) or simply 114. Please note, that 13 must be present as a substring of notation, not a subsequence (123 doesn't contain 13). The only line of the input contains a single integer n (1 ≤ n ≤ 10 5 ) . Output a single integer — the number of different integer bases b ( b ≥ 2) for which n , written in base b , contains at least one 13. If there are infinitely many such bases, output -1.

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
14043887 130705009 B Nov. 3, 2015, 3:23 p.m. OK Ada TESTS 36 30 0 2000
5454275 Tohka B Dec. 17, 2013, 8:55 a.m. OK Ada TESTS 36 30 0 2000
4535282 hza B Sept. 22, 2013, 8:21 a.m. OK Ada TESTS 36 30 0 2000
4475433 cuiaoxiang B Sept. 15, 2013, 7:18 a.m. OK Ada TESTS 36 30 0 2000
4475133 stp B Sept. 15, 2013, 6:18 a.m. OK Ada TESTS 36 30 0 2000
4455968 Alex_Mishenev B Sept. 14, 2013, 7:01 a.m. OK Ada TESTS 36 30 0 2000
4455955 accidentallygivenfuck B Sept. 14, 2013, 6:55 a.m. OK Ada TESTS 36 30 0 2000
4454403 Xellos B Sept. 13, 2013, 7:49 p.m. OK Ada TESTS 36 30 0 2000
4454164 37ae912 B Sept. 13, 2013, 6:40 p.m. OK Ada TESTS 36 30 0 2000
4454089 Witalia B Sept. 13, 2013, 6:16 p.m. OK Ada TESTS 36 30 0 2000

remove filters

Back to search problems