This file contains hidden or 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
| solve <- function(n) { | |
| result <- largeSubtract(largeAdd(sumMultiple(n, 3), sumMultiple(n, 5)), sumMultiple(n, 15)) | |
| } | |
| right <- function (string, char){ | |
| substr(string,nchar(string)-(char-1),nchar(string)) | |
| } | |
| left <- function (string,char){ | |
| substr(string,1,char) |
This file contains hidden or 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
| def sumMultiple(n, k): | |
| n -= n % k | |
| return (n + k) * int(n / k) >> 1 | |
| def solve(N): | |
| result = sumMultiple(N, 3) + sumMultiple(N, 5) - sumMultiple(N, 15) | |
| return result | |
| T = int(input()) |
This file contains hidden or 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
| cache = {} | |
| def calc(n, blank): | |
| if blank < 0: | |
| return 0; | |
| if blank in cache: | |
| return cache[blank]; | |
| value = 1 |
This file contains hidden or 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
| import numpy as np | |
| def solve(): | |
| mat = [[np.inf] * 100 for _ in range(100)] | |
| for i in range(100): | |
| mat[i][i] = 0 | |
| n, m, k = [int(x) for x in input().split()] | |
| s = [0] * (k+2) |
This file contains hidden or 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
| import numpy as np | |
| def solve(): | |
| mat = [[np.inf] * 100 for _ in range(100)] | |
| for i in range(100): | |
| mat[i][i] = 0 | |
| n, m, k = [int(x) for x in input().split()] | |
| s = [0] * (k+2) |
This file contains hidden or 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
| t = int(input()) | |
| x = [[0] * 100 for _ in range(200)] | |
| def solve(): | |
| (n, r) = map(lambda x: int(x), input().split()) | |
| x = [0] * n | |
| y = [0] * n | |
| sol = [set() for _ in range(n*n)] |
This file contains hidden or 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
| def solve(): | |
| (n, m) = map(lambda x: int(x), input().split()) | |
| now = []; | |
| cost = 0 | |
| for i in range(n): | |
| c = list(map(lambda x: int(x), input().split())) | |
| c.sort() | |
| count = 0 | |
| for x in c: | |
| count += 1 |