-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccb4ced
commit db063ad
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
Task | ||
Given a base- integer, , convert it to binary (base-). Then find and print the base- integer denoting the maximum number of consecutive 's in 's binary representation. | ||
Input Format | ||
A single integer, . | ||
Constraints | ||
Output Format | ||
Print a single base- integer denoting the maximum number of consecutive 's in the binary representation of . | ||
Sample Input 1 | ||
5 | ||
Sample Output 1 | ||
1 | ||
Sample Input 2 | ||
13 | ||
Sample Output 2 | ||
2 | ||
Explanation | ||
Sample Case 1: | ||
The binary representation of is , so the maximum number of consecutive 's is . | ||
Sample Case 2: | ||
The binary representation of is , so the maximum number of consecutive 's is . | ||
""" | ||
# SOLUTION | ||
#!/bin/python3 | ||
|
||
import math | ||
import os | ||
import random | ||
import re | ||
import sys | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
n = int(input()) | ||
print(max(len(length) for length in bin(n)[2:].split('0'))) |