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
import java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); |
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
import java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static void main(String[] args) { | |
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ |
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
import java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static void main(String[] args) { | |
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ |
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
#!/bin/python3 | |
import sys | |
s,t = input().strip().split(' ') | |
s,t = [int(s),int(t)] | |
a,b = input().strip().split(' ') | |
a,b = [int(a),int(b)] | |
m,n = input().strip().split(' ') |
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
from math import sqrt | |
def fibo(n): | |
return (((1+sqrt(5))**n - (1-sqrt(5))**n)/(2**n*sqrt(5))) | |
while True: | |
try: | |
n = int(input().strip()) | |
print (int(fibo(n))) | |
except(EOFError): |
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
#!/bin/python3 | |
import sys | |
def get_num(n, strr): | |
num = [i for i in strr if i == n] | |
return (len(num)) | |
def adjust(strr): | |
flag = True |
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
array = input().strip() | |
lst = [] | |
for i in range(len(array)): | |
if array[i] == '(' or array[i] == '[' or array[i] == '{': | |
lst.append(array[i]) | |
elif array[i] == ')': | |
if len(lst) != 0 and lst[len(lst)-1] == '(': | |
lst.pop() |
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
n = int(input().strip()) | |
for i in range(1,n+1): | |
if i%3 == 0 and i%5 == 0: | |
print ("FizzBuzz") | |
elif i % 3 == 0: | |
print ("Fizz") | |
elif i % 5 == 0: | |
print ("Buzz") | |
else: |
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
first_line = [int(item) for item in input().strip().split(" ")] | |
N = first_line[0] | |
seqList = [[] for i in range(N)] | |
lastAns = 0 | |
def query1(x,y): | |
global N, seqList, lastAns | |
seqList[(x^lastAns) % N].append(y) | |
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
firstLine = [int(i) for i in input().strip().split(" ")] | |
secondLine = [int (j) for j in input().strip().split(" ")] | |
n = firstLine[1]%firstLine[0] | |
secondLine += secondLine[0:n] | |
secondLine = secondLine[n:] | |
[print (i, end = " ") for i in secondLine] |
OlderNewer