Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

151 uva problem solution

def power_crisis(n,k):
    if n == 1:
        return 1
    else:
        return (power_crisis(n-1,k)+k-1)%n+1

while True:
    n = int(input())
    if n == 0:
        break
    i = 1
    while power_crisis(n-1,i) != 12:
        i += 1
    print(i)
Comment

151 uva problem solution

def power_crisis(n,k):
    if n == 1:
        return 1
    else:
        return (power_crisis(n-1,k)+k-1)%n+1

while True:
    n = int(input())
    if n == 0:
        break
    i = 1
    while power_crisis(n-1,i) != 12:
        i += 1
    print(i)
Comment

PREVIOUS NEXT
Code Example
Python :: get script text selenium python 
Python :: Adding two lists using map() and Lamda Function 
Python :: del df.loc 
Python :: python - subtracting dictionary values 
Python :: bar chart in python 
Python :: get image data cv2 
Python :: can u length a dictionary in python 
Python :: display column names as a dictionary pandas 
Python :: pandas flip x and y axis 
Python :: check pd.NaT python 
Python :: python split string on char 
Python :: python remove specific character from string 
Python :: all python statements 
Python :: end without space in python 
Python :: cross_val_score scoring parameters types 
Python :: print index in for loop python 
Python :: black jack python 
Python :: flask blueprints 
Python :: read csv pandas nrow 
Python :: binary search tree implementation in python 
Python :: pandas fillna by rows 
Python :: assigning crs using python pyproj 
Python :: # unzip files 
Python :: qtimer singleshot 
Python :: puthon for loop 
Python :: datetime64 ns to date python 
Python :: treesitter python 
Python :: convert all sizes to terabytes pandas 
Python :: support vector machine example 
Python :: python re split 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =