Last active
December 7, 2019 05:36
-
-
Save darkmatter18/569baa49f3b4b920f68caa534f0706b1 to your computer and use it in GitHub Desktop.
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
# Problem 1 | |
# EXUNA | |
# Weird Modulo Problem | |
no=int(input()) | |
for _ in range(no): | |
input() | |
l=list(map(int,input().split())) | |
l.sort() | |
print(l[0]) | |
# ----------------------------------------------------------------------- | |
# Problem 2 | |
# SCLEAN | |
# Shrub Cleaning | |
def ShrubCleaning(string): | |
output = str() | |
if len(string) == 1: | |
return string | |
i = 0 | |
outi = 0 | |
while i < len(string): | |
char = string[i] | |
if i == 0: | |
output += char | |
outi += 1 | |
else: | |
if output[outi-1] == char: | |
pass | |
else: | |
output += char | |
outi += 1 | |
i += 1 | |
return output | |
if __name__ == "__main__": | |
testno = int(input()) | |
for _ in range(testno): | |
ips = input() | |
print(ShrubCleaning(ips)) | |
# ----------------------------------------------------------------------- | |
# Problem 3 | |
# MUL35 | |
# Common Multiples | |
def apsum(d,n): | |
if n > 0: | |
no = n // d | |
return (no * (no + 1) * d) // 2 | |
else: | |
return 0 | |
if __name__ == "__main__": | |
test = int(input()) | |
for _ in range(test): | |
no = int(input()) | |
no = no-1 | |
print(apsum(3,no) + apsum(5,no) - apsum(15,no)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment