Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python
- import math
- import os
- import random
- import re
- import sys
- # Complete the minuteToWinIt function below.
- def minuteToWinIt(a, k, n):
- valores = dict()
- for i in range(0, n):
- val = a[i] - k*i
- if(val in valores):
- valores[val] += 1
- else:
- valores[val] = 1
- max = 0
- for values in valores:
- if max < valores[values]:
- max = valores[values]
- return (n - max)
- if __name__ == '__main__':
- fptr = open(os.environ['OUTPUT_PATH'], 'w')
- nk = raw_input().split()
- n = int(nk[0])
- k = int(nk[1])
- a = map(int, raw_input().rstrip().split())
- result = minuteToWinIt(a, k, n)
- fptr.write(str(result) + '\n')
- fptr.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement