output_description
stringlengths
15
956
submission_id
stringlengths
10
10
status
stringclasses
3 values
problem_id
stringlengths
6
6
input_description
stringlengths
9
2.55k
attempt
stringlengths
1
13.7k
problem_description
stringlengths
7
5.24k
samples
stringlengths
2
2.72k
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s749838404
Accepted
p03135
Input is given from Standard Input in the following format: T X
t = list(map(int, input().split())) print(t[0] / t[1])
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s979291159
Accepted
p03135
Input is given from Standard Input in the following format: T X
li = list(map(int, input().split())) print(li[0] / li[1])
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s984862367
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
a, b = map(int.input().split(" ")) print(a * b)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s843860989
Accepted
p03135
Input is given from Standard Input in the following format: T X
import math import queue import bisect import heapq import time import itertools mod = int(1e9 + 7) def swap(a, b): return (b, a) def my_round(a, dig=0): p = 10**dig return (a * p * 2 + 1) // 2 / p def gcd(a, b): # 最大公約数 if a < b: a, b = swap(a, b) if b == 0: return a else: return gcd(b, a % b) def lcm(a, b): # 最小公倍数 return a / gcd(a, b) * b def divisors(a): # 約数列挙 divisors = [] for i in range(1, int(a**0.5) + 1): if a % i == 0: divisors.append(i) if i != a // i: divisors.append(a // i) return divisors def is_prime(a): # 素数判定 if a < 2: return False elif a == 2: return True elif a % 2 == 0: return False sqrt_num = int(a**0.5) for i in range(3, sqrt_num + 1, 2): if a % i == 0: return False return True def prime_num(a): # 素数列挙 pn = [2] for i in range(3, int(a**0.5), 2): prime = True for j in pn: if i % j == 0: prime = False break if prime: pn.append(i) return pn def prime_fact(a): # 素因数分解 sqrt = math.sqrt(a) res = [] i = 2 if is_prime(a): res.append(a) else: while a != 1: while a % i == 0: res.append(i) a //= i i += 1 return res def main(): t, x = map(int, input().split()) ans = t / x print(ans) return if __name__ == "__main__": main()
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s709557172
Accepted
p03135
Input is given from Standard Input in the following format: T X
import math # inputList=[] # for i in range(6): # inputNum = input() # inputList.append(inputNum) inputa = input().split() # inputb = input().split() a = int(inputa[0]) b = int(inputa[1]) # c = int(inputa[2]) # x = int(inputb[0]) # y = int(inputb[1]) print(float(a) / float(b))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s453039052
Accepted
p03135
Input is given from Standard Input in the following format: T X
from statistics import mean, median, variance, stdev import sys import math import fractions def j(q): if q == 1: print("YES") else: print("NO") exit(0) def ct(x, y): if x > y: print("") elif x < y: print("") else: print("") def ip(): return int(input()) # n = ip() #入力整数1つ t, x = (int(i) for i in input().split()) # 入力整数横2つ # x,y,z = (int(i) for i in input().split()) #入力整数横3つ # n,m,x,y= (int(i) for i in input().split()) #入力整数横4つ # a = [int(i) for i in input().split()] #入力整数配列 # a = input() #入力文字列 # a = input().split() #入力文字配列 # jの変数はしようできないので注意 print(t / x)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s594462060
Accepted
p03135
Input is given from Standard Input in the following format: T X
lst = input().rstrip().split(" ") print(float(lst[0]) / float(lst[1]))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s413625760
Accepted
p03135
Input is given from Standard Input in the following format: T X
import sys sys.setrecursionlimit(10000) input = sys.stdin.readline def chk(a): a_name = "" for k, v in globals().items(): if id(v) == id(a): a_name = k break print(a_name + " = " + str(a), file=sys.stderr) def mt(f): import time def wrap(*args, **kwargs): s = time.time() ret = f(*args, **kwargs) e = time.time() print(e - s, "sec", file=sys.stderr) return ret return wrap @mt def slv(T, X): chk(T) chk(X) return T / X T, X = [int(i) for i in input().split()] print(slv(T, X))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s959754627
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
import numpy as np N, K = list(map(int, input().split())) X = input().split() for i in range(len(X)): X[i] = int(X[i]) X = np.array(X) keta = len(bin(K)) - 2 matrix = np.zeros(keta * N).reshape(N, keta) i_count = 0 for i in X: for j in range(min(len(bin(i)[2:]), keta)): matrix[i_count, -j - 1] = bin(i)[-j - 1] i_count += 1 tot = np.zeros(keta) for i in range(keta): tot[i] = sum(matrix[:, i]) ans = np.zeros(keta) for i in range(len(tot)): if int(tot[i]) < N / 2: ans[i] = int(1) answer = "" for i in ans: answer += str(int(i)) an = int(answer, 2) ind = 100 if an > K: cand = np.where(ans == 1)[0] ind = -1 while an > K: lis = list(ans) lis[cand[ind]] = 0 answer = "" for i in lis: answer += str(int(i)) lis[cand[ind]] = 1 an = int(answer, 2) ind -= 1 ind += 1 j = tot for i in range(len(j)): j[i] = max(j[i], N - j[i]) if ind < 50: j[ind] = N - j[ind] b = 0 for i in range(len(j)): b += int(j[-i - 1]) * (2**i) print(b)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s567151273
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
from copy import deepcopy N, K = map(int, input().split()) positiveD = [[] for _ in range(N + 1)] negativeD = [[] for _ in range(N + 1)] Const = [] for _ in range(K): inputList = [int(i) for i in input().split()] if inputList[0] == 0: Const = inputList elif inputList[1] > 0: positiveD[inputList[0]].append(inputList) else: negativeD[inputList[0]].append(inputList) def ChooseGroup(DList): # i次項の中でxjを共通に持つ項を選ぶ Group = [] if len(DList) == 1: Group.append(DList.pop()) commonfact = Group[0][2] else: for a in range(len(DList)): for b in range(len(DList)): if a != b and set(DList[a][2:]) & set(DList[b][2:]): commonfact = list(set(DList[a][2:]) & set(DList[b][2:]))[0] break for items in DList: if commonfact in items[2:]: Group.append(items) for items in Group: DList.remove(items) return (Group, commonfact) def PositiveDegrade(i, x, DList): # i次の項を下げる while DList[i]: CommonGroup, CommonFactor = ChooseGroup(DList[i]) next = i - 1 totalaH = 0 for items in CommonGroup: newList = [next, items[1]] for d in items[2:]: if d != CommonFactor: newList.append(d) totalaH += items[1] negativeTerm = deepcopy(items) negativeTerm.append(N + x) negativeTerm[1] *= -1 for j in DList[next]: # 次数を落とした項を、該当するリストに格納 if set(j[2:]) == set(newList[2:]): j[1] += newList[1] break else: DList[next].append(newList) negativeD[i].append(negativeTerm) for j in DList[2]: if j[2:] == [CommonFactor, N + x]: j[1] += totalaH break else: DList[2].append([2, totalaH, CommonFactor, N + x]) x += 1 def NegativeDegrade(i, x, DList): while DList[i]: item = DList[i].pop() for j in positiveD[1]: if j[2] == N + x: j[1] += -item[1] * (i - 1) break else: positiveD[1].append([1, -item[1] * (i - 1), N + x]) for d in item[2:]: DList[2].append([2, item[1], d, N + x]) x += 1 return x x = 1 for i in reversed(range(3, N + 1)): PositiveDegrade(i, x, positiveD) for i in range(3, N + 1): x = NegativeDegrade(i, x, negativeD) Merged = [deepcopy(positiveD[1]), deepcopy(positiveD[2])] for item in negativeD[1]: for compare in Merged[0]: if item[2:] == compare[2:]: compare[1] += item[1] if compare[1] == 0: Merged[0].remove(compare) break else: Merged[0].append(item) for item in negativeD[2]: for compare in Merged[1]: if item[2:] == compare[2:]: compare[1] += item[1] if compare[1] == 0: Merged[1].remove(compare) break else: Merged[1].append(item) L = len(Const) + len(Merged[0]) + len(Merged[1]) print(N + x - 1, L) if Const: print(" ".join(map(str, Const[0]))) for item in Merged[0]: print(" ".join(map(str, item))) for item in Merged[1]: print(" ".join(map(str, item)))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s298477350
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
N, K = map(int, input().split()) A = list(map(int, input().split())) k = [(K + 1) & (1 << i) for i in range(40)] c = [0] * 40 for a in A: for i in range(40): if a & (1 << i): c[i] += 1 m = [0] * 40 for i in range(40): if 2 * c[i] < N: m[i] = (1 << i) * (N - c[i]) else: m[i] = (1 << i) * c[i] x = sum(A) for i in reversed(range(40)): if k[i] != 0: x = max(x, sum(m[:i] + [(1 << i) * (N - c[i])] + k[i + 1 :])) print(x)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s585665054
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math from collections import deque from fractions import gcd from functools import lru_cache ############# # Constants # ############# MOD = 10**9 + 7 INF = float("inf") ############# # Functions # ############# ######INPUT###### def inputI(): return int(input().strip()) def inputS(): return input().strip() def inputIL(): return list(map(int, input().split())) def inputSL(): return list(map(str, input().split())) def inputILs(n): return list(int(input()) for _ in range(n)) def inputSLs(n): return list(input().strip() for _ in range(n)) def inputILL(n): return [list(map(int, input().split())) for _ in range(n)] def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)] #####Inverse##### def inv(n): return pow(n, MOD - 2, MOD) ######Combination###### kaijo_memo = [] def kaijo(n): if len(kaijo_memo) > n: return kaijo_memo[n] if len(kaijo_memo) == 0: kaijo_memo.append(1) while len(kaijo_memo) <= n: kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD) return kaijo_memo[n] gyaku_kaijo_memo = [] def gyaku_kaijo(n): if len(gyaku_kaijo_memo) > n: return gyaku_kaijo_memo[n] if len(gyaku_kaijo_memo) == 0: gyaku_kaijo_memo.append(1) while len(gyaku_kaijo_memo) <= n: gyaku_kaijo_memo.append( gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo), MOD - 2, MOD) % MOD ) return gyaku_kaijo_memo[n] def nCr(n, r): if n == r: return 1 if n < r or r < 0: return 0 ret = 1 ret = ret * kaijo(n) % MOD ret = ret * gyaku_kaijo(r) % MOD ret = ret * gyaku_kaijo(n - r) % MOD return ret ######Factorization###### def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if arr == []: arr.append([n, 1]) return arr #####LCM##### def lcm(a, b): return a * b // gcd(a, b) ############# # Main Code # ############# T, X = inputIL() pirnt(T / X)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s517915962
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
N, K = map(int, input().split()) L = list(map(int, input().split())) XOR = 0 result = [] for i in range(K + 1): for LINT in L: XOR += i ^ LINT result.append(XOR) print(max(result))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s764567130
Wrong Answer
p03135
Input is given from Standard Input in the following format: T X
X, Y = list(map(int, input().split())) if X < Y: print("<") if X == Y: print("=") if X > Y: print(">")
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s079505694
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
#!usr/bin/env python3 from collections import defaultdict import math def LI(): return list(map(int, input().split())) def II(): return int(input()) def LS(): return input().split() def S(): return input() def IIR(n): return [II() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] mod = 1000000007 # A """ t,x = LI() print(t/x) """ # B """ n= II() a = LI() m = max(a) if m >= sum(a)-m: print("No") else: print("Yes") """ # C """ n,m = LI() x = LI() x.sort() l = [x[i+1]-x[i] for i in range(m-1)] l.sort() l = l[::-1] ans = sum(l[max(n-1,0):]) print(ans) """ # D n, k = LI() a = LI() l = 0 b = [0 for i in range(n)] for i in range(n): b[i] = list(bin(a[i]))[2:] l = max(l, len(b[i])) s = [0 for i in range(l)] for i in range(n): for j in range(l - len(b[i])): b[i].insert(0, "0") for i in range(n): for j in range(l): s[j] += 1 - int(b[i][j]) ke = 1 ans = 0 i = l - 1 while i >= 0: if s[i] <= n // 2: ans += (n - s[i]) * ke s.pop(i) else: ans += (n - s[i]) * ke s[i] = [(2 * s[i] - n) * ke, ke] i -= 1 ke *= 2 s.sort(key=lambda x: x[0]) s = s[::-1] d = 0 key = len(list(bin(k))) - 2 key -= l ke = 2**l for i in range(key): d += ke ans += n * ke ke *= 2 w = len(s) if w == 0: print(ans) quit() b = ans c = d for i in range(w): q, p = s[i] if d + p <= k: d += p ans += q import random for j in range(10): a = b e = c l = [i for i in range(w)] for _ in range(w - 1): i = random.randint(0, len(l) - 1) i = l.pop(i) q, p = s[i] if e + p <= k: e += p a += q ans = max(ans, a) print(ans) # E # F # G # H # I # J # K # L # M # N # O # P # Q # R # S # T
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s439207817
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
t,x=map(float, input().split()) print({0:.4f}.format(t/x))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s738199043
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
mod = 10**9 + 7 mod2 = 2**61 + 1 from collections import deque import heapq from bisect import bisect_left, insort_left, bisect_right _NUMINT_ALL = list(range(10)) def main(): ans = solve() if ans is not None: print(ans) def solve(): N, M = iip(False) X = iip() X.sort() A = [X[i + 1] - X[i] for i in range(len(X) - 1)] A.sort() return sum(A[0 : min(0, -N + 1)]) #####################################################ライブラリ集ここから def iip(listed=True, num_only=True): # 数字のinputをlistで受け取る if num_only: ret = [int(i) for i in input().split()] else: ret = [int(i) if i in _NUMINT_ALL else i for i in input().split()] if len(ret) == 1 and not listed: return ret[0] return ret def saidai_kouyakusuu(A): # 最大公約数 l = len(A) while True: m = min(A) mx = max(A) if m == mx: return m for i in range(l): if A[i] % m == 0: A[i] = m else: A[i] %= m def sort_tuples(l, index): # タプルのリストを特定のインデックスでソートする if isinstance(l, list): l.sort(key=lambda x: x[index]) return l else: l = list(l) return sorted(l, key=lambda x: x[index]) def count_elements(l): # リストの中身の個数を種類分けして辞書で返す d = {} for i in l: if i in d: d[i] += 1 else: d[i] = 1 return d def safeget( l, index, default="exception" ): # listの中身を取り出す時、listからはみ出たり if index >= len(l): # マイナスインデックスになったりするのを防ぐ if default == "exception": raise Exception( "".join( [ "safegetに不正な値 ", index, "が渡されました。配列の長さは", len(l), "です", ] ) ) else: return default elif index < 0: if default == "exception": raise Exception( "".join( [ "safegetに不正な値 ", index, "が渡されました。負の値は許可されていません", ] ) ) else: return default else: return l[index] def iipt( l, listed=False, num_only=True ): # 縦向きに並んでいるデータをリストに落とし込む(iip利用) ret = [] for i in range(l): ret.append(iip(listed=listed, num_only=num_only)) return ret def sortstr(s): # 文字列をソートする return "".join(sorted(s)) def iip_ord(startcode="a"): # 文字列を数字の列に変換する(数字と文字は1:1対応) if isinstance(startcode, str): startcode = ord(startcode) return [ord(i) - startcode for i in input()] def YesNo(s): # TrueFalseや1, 0をYesNoに変換する if s: print("Yes") else: print("No") def fprint(s): # リストを平たくしてprintする(二次元リストを見やすくしたりとか) for i in s: print(i) def bitall(N): # ビット全探索用のインデックスを出力 ret = [] for i in range(2**N): a = [] for j in range(N): a.append(i % 2) i //= 2 ret.append(a) return ret def split_print_space(s): # リストの中身をスペース区切りで出力する print(" ".join([str(i) for i in s])) def split_print_enter(s): # リストの中身を改行区切りで出力する print("\n".join([str(i) for i in s])) def soinsuu_bunkai(n): # 素因数分解 ret = [] for i in range(2, int(n**0.5) + 1): while n % i == 0: n //= i ret.append(i) if i > n: break if n != 1: ret.append(n) return ret def conbination(n, r, mod, test=False): # nCrをmodを使って計算する if n <= 0: return 0 if r == 0: return 1 if r < 0: return 0 if r == 1: return n ret = 1 for i in range(n - r + 1, n + 1): ret *= i ret = ret % mod bunbo = 1 for i in range(1, r + 1): bunbo *= i bunbo = bunbo % mod ret = (ret * inv(bunbo, mod)) % mod if test: # print(f"{n}C{r} = {ret}") pass return ret def inv(n, mod): # modnにおける逆元を計算 return power(n, mod - 2) def power(n, p, mod_=mod): # 繰り返し二乗法でn**p % modを計算 if p == 0: return 1 if p % 2 == 0: return (power(n, p // 2, mod_) ** 2) % mod_ if p % 2 == 1: return (n * power(n, p - 1, mod_)) % mod_ if __name__ == "__main__": main()
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s359309533
Wrong Answer
p03135
Input is given from Standard Input in the following format: T X
def time(T, X): t = T / X return t
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s157356325
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
a
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s181875784
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
a, s = input().split() print(a / s)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s017558204
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
t,x=map(int,input().split())) print(t/x)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s456759341
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
8 3
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s392936461
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
N, A = map(int, input().split()) pritn(N / A)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s389318756
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
t, x = map(float, input()) print(t / 3)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s229755415
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
a,b = map(int,input()split()) print(a/b)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s468149496
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
t, x = map(int input().split()) print(t / x)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s095058625
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
d = input().split() print(float(d[0]) / d[1])
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s810114518
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
T,X=(int(x) for x input().split()) print(T/X)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s437714734
Accepted
p03135
Input is given from Standard Input in the following format: T X
x = list(map(int, input().split())) print(x[0] / x[1])
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s017053823
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
T, X = [int(n) for n in input().split()] print(T / X)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s803845538
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
T, X = list(map(int, input().split()) print(T / X)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s831435693
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
X,T = map.(int, input().split(' ')) input(T/X)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s174009132
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
T,X = map(int, input().split(" ")) print(f"{T/X:.5f})
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s527398555
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
t,x=map(int,input().split()) print(round((t/x),4)))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s239800200
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
T,X=(float(x) for x input().split()) print(T/X)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s220995846
Accepted
p03135
Input is given from Standard Input in the following format: T X
inputParam = input() inputParamList = inputParam.split(" ") timeInWorldB = int(inputParamList[0]) / int(inputParamList[1]) print(timeInWorldB)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s080324434
Accepted
p03135
Input is given from Standard Input in the following format: T X
nums = input().split(" ") print(int(nums[0]) / int(nums[1]))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s765122177
Accepted
p03135
Input is given from Standard Input in the following format: T X
TX = [int(i) for i in input().split()] print(float(TX[0] / TX[1]))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s536686334
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
package main import "fmt" func main() { var T, X int fmt.Scan(&T) fmt.Scan(&X) fmt.Println(float64(T) / float64(X)) }
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s611131361
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
import sys def solve(T,X): return T/X def readQuestion(): ws = sys.stdin.readline().strip().split() T = int(ws[0]) X = int(ws[1]) return (T, X,) def main(): solve(*readQuestion()) # Uncomment before submission main()
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s008038165
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
#!venv/bin/python N, K = [int(x) for x in input().split()] A = [format(int(x), "b") for x in input().split()] count_1 = [0 for i in range(40)] count_0 = [0 for i in range(40)] print(A) for a in A: for i in range(40): if i >= len(a): count_0[i] += 1 continue if a[-(i + 1)] == "1": count_1[i] += 1 else: count_0[i] += 1 k = 0 for i in range(39, 0, -1): if 2**i + k > K: continue if count_0[i] > count_1[i]: k += 2**i ans = 0 for a in A: ans += k ^ int(a, 2) print(ans)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s405628127
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
# -*- coding: <encoding name> -*- ''' T, X = int(input()) print(T / X) ''' T, X = map(int, input().split()) print(T / X)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s600140489
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
N, M = map(int, input().split(" ")) A = list(sorted(map(int, input().split(" ")))) L = sorted([A[s] - A[s + 1] for s in range(M - 1)]) print(abs(sum(L[N - 1 :])))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s771615708
Wrong Answer
p03135
Input is given from Standard Input in the following format: T X
( n, *a, ) = map(int, open(0).read().split()) a.sort() print("YNeos"[sum(a[:-1]) <= a[-1] :: 2])
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s144563559
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
def nyu(): N, M = map(int, input().split()) X = list(map(int, input().split())) X.sort() return N, M, X def kansu(N, M, X): x_abs = [X[m + 1] - X[m] for m in range(M - 1)] # print(x_abs) cnt_n = N while cnt_n - 1 > 0: x_abs[x_abs.index(max(x_abs))] = -1 cnt_n -= 1 koma_max = 0 sum = 0 for m in range(M - 1): if x_abs[m] != -1: koma_max += x_abs[m] print(koma_max) N, M, X = nyu() # print(X) if M == 1: print(0) else: kansu(N, M, X) # print(S)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s943150263
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
A, B, C = map(int, input().split()) S = A * B // 2 print(S)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s539131103
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
N, M = list(map(int, input().split())) X_list = sorted(list(map(int, input().split()))) result_list = [] for i in range(M): result = 0 for x in X_list: result += i ^ x result_list.append(result) if len(result_list) == 0: print(X_list[0]) else: print(max(result_list))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s478511560
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
a, b = map(int, input().split()) print({:.10f}.format(a/b))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s243150782
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
numN = int(input()) args = input() lines = list() for i in range(numN): list.append(int(args[0:args.find(" ")])) list_sorted = sorted(list) max_line = list_sorted[0] for m in range(numN - 1) : max_line = max_line - list_sorted[m+1] if max_line < 0 : print(yes) else print(no)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s264152294
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
a, b = map(int, input().split()) c = list(map(int, input s = 0 for i in range(44, -1, -1): if 2 ** i + s <= b if a > d[i] * 2: s += 2 ** i for i in c: ans += i ^ s print(ans)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s872860947
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
N, M = (int(i) for i in input().split()) X = [int(i) for i in input().split()] lg_bw_x = [] s= 0 if N >= M: print(0) else X.sort() for i in range(M-1): lg_bw_x.append(X[i+1] - X[i]) lg_bw_x.sort() for j in range(M-N-1): s = s+lg_bw_x[j] print(s)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s394156918
Accepted
p03135
Input is given from Standard Input in the following format: T X
n, p = map(int, input().split()) print(n / p)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s831468860
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
i = input().split() print(i[0] / i[1])
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s936491074
Wrong Answer
p03135
Input is given from Standard Input in the following format: T X
A, B = map(int, input().split(" ")) print(B / A)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s744719129
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
return T / X
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s136182137
Accepted
p03135
Input is given from Standard Input in the following format: T X
a = input().split() print(int(a[0]) / int(a[1]))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s233352577
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
x, t = = map(int, input().split()) print(x/t)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s042531064
Accepted
p03135
Input is given from Standard Input in the following format: T X
print((lambda T, X: T / X)(*map(int, input().split())))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s421672097
Accepted
p03135
Input is given from Standard Input in the following format: T X
[print(t / x) for t, x in [[int(i) for i in input().split()]]]
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s383895290
Accepted
p03135
Input is given from Standard Input in the following format: T X
s = input().split(" ") result = int(s[0]) / int(s[1]) print("{:0<13}".format(str(result)))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s466014734
Wrong Answer
p03135
Input is given from Standard Input in the following format: T X
a, b = list(input().split()) u = int(a) i = int(b) y = int(u / i) print(y)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s154359717
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
import math def main(): data_num, max_num_10 = list(map(int, input().split())) data = list(map(int, input().split())) max_num_2 = bin(max_num_10)[2:] ketasuu = len(max_num_2) max_ketasuu = ketasuu for point_10 in data: point_2 = bin(point_10)[2:] if max_ketasuu < len(point_2): max_ketasuu = len(point_2) keta_count = [0 for i in range(max_ketasuu)] for point_10 in data: point_2 = bin(point_10)[2:][::-1] # print(point_2) for i in range(len(point_2)): if point_2[i] == '1': keta_count[i] += 1 # print(keta_count) ans = '' for i in range(ketasuu): if keta_count[i] >= math.ceil(data_num / 2): ans += '0' else: ans += '1' ans = ans[::-1] # asn = '1100' # max_num_2 = '1001' # ketasuu = 4 if max_num_10 < int(ans, 2): # print('yyy') count = 1 for i in range(ketasuu)[::-1]: if ans[i] == '1' and max_num_2[i] == '0': # print('uyt', count) if max_num_10 >= int(ans, 2) - count: # print('uuuuu') # print(ans) ans = list(ans) # print(ans) ans[i] = '0' # print(ans) ans = ''.join(ans) # print(ans) break if max_num_10 < int(ans, 2) ans = list(ans) # print(ans) ans[0] = '0' # print(ans) ans = ''.join(ans) # count *= 2 ans = ans[::-1] ans_count = 0 now_point = 1 for i in range(max_ketasuu): if i >= ketasuu: count_number = keta_count[i] else: if ans[i] == '1': count_number = data_num - keta_count[i] else: count_number = keta_count[i] # print(ans_count, now_point, count_number) ans_count += now_point * count_number now_point *= 2 print(ans_count) def test(): ans = '1110' max_num_2 = '1011' ketasuu = 4 max_num_10 = 11 if max_num_10 < int(ans, 2): # print('yyy') count = 1 for i in range(ketasuu)[::-1]: if ans[i] == '1' and max_num_2[i] == '0': print('uyt', count) if max_num_10 >= int(ans, 2) - count: print('uuuuu') # print(ans) ans = list(ans) # print(ans) ans[i] = '0' # print(ans) ans = ''.join(ans) # print(ans) break count *= 2 # ans = ans[::-1] print(ans) if __name__ == '__main__': main() # test()
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s860901131
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
import sys def solve(T,X): return T/X def readQuestion(): ws = sys.stdin.readline().strip().split() T = int(ws[0]) X = int(ws[1]) return (T, X,) def main(): solve(*readQuestion()) # Uncomment before submission main()
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s329398140
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
def read(): N, K = list(map(int, input().strip().split())) A = list(map(int, input().strip().split())) return N, K, A def binary_digits(x): digit = 0 while x > 0: x >>= 1 digit += 1 return digit def maximum_X(N, K, A): digitK = binary_digits(K) counts = [] bitmask = 1 for d in range(digitK): count = 0 for i in range(N): if A[i] & bitmask == bitmask: count += 1 counts.append(count) bitmask <<= 1 X = 0 bitmask = 1 for d in range(digitK): if counts[d] * 2 <= N: if K & bitmask == bitmask: X += bitmask bitmask <<= 1 return X def f(x, A): y = 0 for a in A: y += x ^ a return y def solve(N, K, A): X = maximum_X(N, K, A) return f(X, A) if __name__ == "__main__": inputs = read() print("%d" % solve(*inputs))
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s359176438
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
'''T, Xの入力''' T = input('Tの入力') X = input('Xの入力') t = T / X print(t):
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s063399093
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
x = input().split() a = int(x[0]) b = int(x[1]) result = float(a / b) result = round(result, 10) print(result) x = input().slice() a = int(x[0]) b = int(x[1]) result = float(a / b) result = round(result, 10) print(result)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s217861751
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
# -*- coding: <encoding name> -*- ''' T, X = int(input()) print(T / X) ''' T, X = map(int(input())) print(T / X)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s309904376
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
N, M = map(int, input().split()) # print(N) # print(M) datas = list(map(int, input().split())) # print(datas) datas.sort() # print(datas) Ms = M - 1 dest = list() K = 0 i = 0 for i in range(Ms): K = datas[i + 1] - datas[i] dest.append(K) dest.sort() # print(K) # print(dest) L = 0 MN = M - N for j in range(MN): L = L + dest[j] print(L)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s880656778
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
import sys def solve(T,X): return T/X pass def readQuestion(): ws = sys.stdin.readline().strip().split() T = int(ws[0]) X = int(ws[1]) return (T, X,) def main(): solve(*readQuestion()) # Uncomment before submission main()
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
Print the number of hours that will pass in World A. The output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}. * * *
s222243825
Runtime Error
p03135
Input is given from Standard Input in the following format: T X
N, K = [int(i) for i in input().split()] num = list(map(int, input().split())) k = K ans = 0 count = 0 print(K) if K == 0: print(sum(num)) else: K2 = [] while K > 0: K2.append(K % 2) K //= 2 data = [] for i in num: num2 = [] while i > 0: num2.append(i % 2) i //= 2 while len(num2) < len(K2): num2.append(0) data.append(list(reversed(num2))) for i in range(len(K2)): t = 0 b = 2 ** (len(K2) - i - 1) # べき乗 for j in range(N): t += data[j][i] if t >= N - t: ans += b * t else: count += b if count <= k: ans += b * (N - t) else: ans += b * t print(ans)
Statement In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[{"input": "8 3", "output": "2.6666666667\n \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]
For each $getSum$ query, print the sum in a line.
s498990757
Accepted
p02374
The input is given in the following format. $n$ $node_0$ $node_1$ $node_2$ $:$ $node_{n-1}$ $q$ $query_1$ $query_2$ $:$ $query_{q}$ The first line of the input includes an integer $n$, the number of nodes in the tree. In the next $n$ lines,the information of node $i$ is given in the following format: ki c1 c2 ... ck $k_i$ is the number of children of node $i$, and $c_1$ $c_2$ ... $c_{k_i}$ are node IDs of 1st, ... $k$th child of node $i$. In the next line, the number of queries $q$ is given. In the next $q$ lines, $i$th query is given in the following format: 0 v w or 1 u The first integer represents the type of queries.'0' denotes $add(v, w)$ and '1' denotes $getSum(u)$.
N = 10**5 prt = [0] * (N + 1) left = [-1] + [0] * N right = [-1] + [0] * N sz = [0] + [1] * N key = [0] * (N + 1) val = [0] * (N + 1) rev = [0] * (N + 1) def update(i, l, r): # assert 1 <= i <= N sz[i] = 1 + sz[l] + sz[r] val[i] = key[i] + val[l] + val[r] def swap(i): if i: left[i], right[i] = right[i], left[i] rev[i] ^= 1 def prop(i): swap(left[i]) swap(right[i]) rev[i] = 0 return 1 def splay(i): # assert 1 <= i <= N x = prt[i] rev[i] and prop(i) li = left[i] ri = right[i] while x and not left[x] != i != right[x]: y = prt[x] if not y or left[y] != x != right[y]: if rev[x] and prop(x): li, ri = ri, li swap(li) swap(ri) if left[x] == i: left[x] = ri prt[ri] = x update(x, ri, right[x]) ri = x else: right[x] = li prt[li] = x update(x, left[x], li) li = x x = y break rev[y] and prop(y) if rev[x] and prop(x): li, ri = ri, li swap(li) swap(ri) z = prt[y] if left[y] == x: if left[x] == i: v = left[y] = right[x] prt[v] = y update(y, v, right[y]) left[x] = ri right[x] = y prt[ri] = x update(x, ri, y) prt[y] = ri = x else: left[y] = ri prt[ri] = y update(y, ri, right[y]) right[x] = li prt[li] = x update(x, left[x], li) li = x ri = y else: if right[x] == i: v = right[y] = left[x] prt[v] = y update(y, left[y], v) left[x] = y right[x] = li prt[li] = x update(x, y, li) prt[y] = li = x else: right[y] = li prt[li] = y update(y, left[y], li) left[x] = ri prt[ri] = x update(x, ri, right[x]) li = y ri = x x = z if left[z] == y: left[z] = i update(z, i, right[z]) elif right[z] == y: right[z] = i update(z, left[z], i) else: break update(i, li, ri) left[i] = li right[i] = ri prt[li] = prt[ri] = i prt[i] = x rev[i] = prt[0] = 0 def expose(i): p = 0 cur = i while cur: splay(cur) right[cur] = p update(cur, left[cur], p) p = cur cur = prt[cur] splay(i) return i def cut(i): expose(i) p = left[i] left[i] = prt[p] = 0 return p def link(i, p): expose(i) expose(p) prt[i] = p right[p] = i def evert(i): expose(i) swap(i) rev[i] and prop(i) def query(v): r = expose(v + 1) return val[r] def query_add(v, w): key[v + 1] += w expose(v + 1) readline = open(0).readline writelines = open(1, "w").writelines N = int(readline()) for i in range(N): k, *C = map(int, readline().split()) # for c in C: # link(c+1, i+1) if k: expose(i + 1) for c in C: expose(c + 1) prt[c + 1] = i + 1 right[i + 1] = C[0] + 1 Q = int(readline()) ans = [] for q in range(Q): t, *args = map(int, readline().split()) if t: ans.append("%d\n" % query(args[0])) else: query_add(*args) writelines(ans)
Range Query on a Tree Write a program which manipulates a weighted rooted tree $T$ with the following operations: * $add(v,w)$: add $w$ to the edge which connects node $v$ and its parent * $getSum(u)$: report the sum of weights of all edges from the root to node $u$ The given tree $T$ consists of $n$ nodes and every node has a unique ID from $0$ to $n-1$ respectively where ID of the root is $0$. Note that all weights are initialized to zero.
[{"input": "6\n 2 1 2\n 2 3 5\n 0\n 0\n 0\n 1 4\n 7\n 1 1\n 0 3 10\n 1 2\n 0 4 20\n 1 3\n 0 5 40\n 1 4", "output": "0\n 0\n 10\n 60"}, {"input": "4\n 1 1\n 1 2\n 1 3\n 0\n 6\n 0 3 1000\n 0 2 1000\n 0 1 1000\n 1 1\n 1 2\n 1 3", "output": "1000\n 2000\n 3000"}, {"input": "2\n 1 1\n 0\n 4\n 0 1 1\n 1 1\n 0 1 1\n 1 1", "output": "1\n 2"}]
Print the maximum number of happiness points that can be earned. * * *
s591245348
Accepted
p02724
Input is given from Standard Input in the following format: X
data = int(input()) result = (data // 500) * 1000 data %= 500 result += (data // 5) * 5 print(result)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s154787335
Wrong Answer
p02724
Input is given from Standard Input in the following format: X
temp0 = int(input()) n500 = int(temp0 / 500) temp1 = temp0 - n500 * 500 n5 = int(temp1 / 5) n500 * 1000 + n5 * 5
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s594889414
Accepted
p02724
Input is given from Standard Input in the following format: X
""" 問題: 高橋君は金色の硬貨が好きです。 自分が持っている 500円硬貨 1枚につき 1000、 5円硬貨 1枚につき 5の嬉しさ を得ます。 高橋君は X 円を持っています。 これを高橋君の嬉しさが最大になるように両替したとき、高橋君の嬉しさはいくらになりますか? (なお、利用できる硬貨は 500 円玉、100 円玉、50 円玉、10 円玉、5円玉、1 円玉の 6 種類とします。) """ """ Xは整数 0 ≦ X ≦ 1,000,000,000 """ # def calc # 標準入力から X の値を取得する input_x = int(input()) ret1 = input_x // 500 # 500円で割った商 ret2 = ret1 * 1000 # 高橋君 500円の喜び ret3 = input_x - (ret1 * 500) # X円から500円の枚数分を引いたお金 ret4 = ret3 // 5 # (X円から500円の枚数分を引いたお金)÷ 5 ret5 = ret4 * 5 # 高橋君 5円の喜び print(ret2 + ret5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s107835112
Runtime Error
p02724
Input is given from Standard Input in the following format: X
from collections import deque import copy X, Y, A, B, C = map(int, input().split()) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) p1 = deque(p) q1 = deque(q) r1 = deque(r) p2 = copy.deepcopy(p1) q2 = copy.deepcopy(q1) r2 = copy.deepcopy(r1) ans = 0 ans1 = 0 for _ in range(X): if len(r1) > 0: if p1[0] > r1[0]: ans1 += p1.popleft() else: ans1 += r1.popleft() else: ans1 += p1.popleft() for _ in range(Y): if len(r1) > 0: if q1[0] > r1[0]: ans1 += q1.popleft() else: ans1 += r1.popleft() else: ans1 += q1.popleft() ans2 = 0 for _ in range(Y): if len(r2) > 0: if q2[0] > r2[0]: ans2 += q2.popleft() else: ans2 += r2.popleft() else: ans2 += q2.popleft() for _ in range(X): if len(r2) > 0: if p2[0] > r2[0]: ans2 += p2.popleft() else: ans2 += r2.popleft() else: ans2 += p2.popleft() ans = max(ans1, ans2) print(ans)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s054339951
Accepted
p02724
Input is given from Standard Input in the following format: X
input_line = int(input()) Hcounter = 0 tmp = input_line for i in range(input_line, 499, -500): Hcounter += 1000 tmp -= 500 for j in range(tmp, 4, -5): Hcounter += 5 print(Hcounter)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s423778576
Accepted
p02724
Input is given from Standard Input in the following format: X
n = int(input()) s = 0 while n - 5 > 0: if n - 500 >= 0: n -= 500 s += 1000 elif n - 100 >= 0: n -= 100 s += 100 elif n - 50 >= 0: n -= 50 s += 50 elif n - 10 >= 0: n -= 10 s += 10 elif n - 5 > 0: n -= 5 s += 5 # elif n - 1 >= 0: # n -= 1 # s += 1 print(s)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s619730715
Accepted
p02724
Input is given from Standard Input in the following format: X
n = int(input()) a = n % 500 b = int((n - a) / 500) c = a % 5 d = int((a - c) / 5) print(1000 * b + d * 5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s762275787
Accepted
p02724
Input is given from Standard Input in the following format: X
num = int(input()) ans_500 = int(num / 500) ans_5 = int((num % 500) / 5) print(1000 * ans_500 + 5 * ans_5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s876761314
Accepted
p02724
Input is given from Standard Input in the following format: X
x = int(input()) eq = 0 eq = x // 500 eq2 = eq * 1000 eq3 = x % 500 eq4 = eq3 // 5 eq5 = eq4 * 5 print(eq2 + eq5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s123207928
Accepted
p02724
Input is given from Standard Input in the following format: X
user_input = eval(input()) print((user_input // 500) * 1000 + ((user_input % 500) // 5) * 5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s375091313
Wrong Answer
p02724
Input is given from Standard Input in the following format: X
user_input = eval(input()) // 500 print(user_input * 1000 + ((user_input % 500) * 2) * 5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s435617889
Wrong Answer
p02724
Input is given from Standard Input in the following format: X
inp = int(input()) add = int(inp / 500) * 1000 add += int((inp % 100) / 5) * 5 print(add)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s039820840
Wrong Answer
p02724
Input is given from Standard Input in the following format: X
def coin(usr_input): return (int(usr_input / 500) * 1000) + ( int((usr_input - int(usr_input / 500) * 500) / 5) * 5 )
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s126452154
Runtime Error
p02724
Input is given from Standard Input in the following format: X
a, b = divmod(int(input), 500) print(a * 1000 + b // 5 * 5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s693226515
Wrong Answer
p02724
Input is given from Standard Input in the following format: X
M = int(input()) e, M = divmod(M, 500) e *= 1000 e += (M % 5) * 5 print(e)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s730055355
Runtime Error
p02724
Input is given from Standard Input in the following format: X
c = input() p1 = c % 500 t = c // 500 t = t * 1000 + ((p1 // 5) * 5) print(t)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s091884144
Wrong Answer
p02724
Input is given from Standard Input in the following format: X
x = int(input("x: ")) tot = int(x / 500) y = x - tot * 500 tot = tot * 1000 + int(y / 5) * 5 print(tot)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s884402380
Wrong Answer
p02724
Input is given from Standard Input in the following format: X
Y = input() X = int(Y) A = (X // 500) * 1000 B = X - X // 500 * 500 print(A + B)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s797184524
Accepted
p02724
Input is given from Standard Input in the following format: X
x = int(input()) a = x % 500 # 500円玉の枚数 b = int((x - a) / 500) # 残りのお金 c = x - (b * 500) d = c % 5 # 5円玉の枚数 e = int((c - d) / 5) print(b * 1000 + e * 5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
Print the maximum number of happiness points that can be earned. * * *
s566954067
Wrong Answer
p02724
Input is given from Standard Input in the following format: X
price = int(input()) num500 = int(price / 500) price = price - (num500 * 500) num5 = int(price % 5) print(num500 * 1000 + num5 * 5)
Statement Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.) Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn? (We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)
[{"input": "1024", "output": "2020\n \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n \n\nHe is a billionaire - in yen."}]
For each dataset in the input, one line should be output as specified below. An output line should not contain extra characters such as spaces. If the traveler can reach the destination, the time needed for the best route (a route with the shortest time) should be printed. The answer should not have an error greater than 0.001. You may output any number of digits after the decimal point, provided that the above accuracy condition is satisfied. If the traveler cannot reach the destination, the string "`Impossible`" should be printed. One cannot reach the destination either when there are no routes leading to the destination, or when the number of tickets is not sufficient. Note that the first letter of "`Impossible`" is in uppercase, while the other letters are in lowercase.
s092107411
Wrong Answer
p00719
The input consists of multiple datasets, each in the following format. The last dataset is followed by a line containing five zeros (separated by a space). > _n m p a b_ > _t_ 1 _t_ 2 ... _t n_ > _x_ 1 _y_ 1 _z_ 1 > _x_ 2 _y_ 2 _z_ 2 > ... > _x p_ _y p_ _z p_ > Every input item in a dataset is a non-negative integer. If a line contains two or more input items, they are separated by a space. _n_ is the number of coach tickets. You can assume that the number of tickets is between 1 and 8. _m_ is the number of cities in the network. You can assume that the number of cities is between 2 and 30. _p_ is the number of roads between cities, which may be zero. _a_ is the city index of the starting city. _b_ is the city index of the destination city. _a_ is not equal to _b_. You can assume that all city indices in a dataset (including the above two) are between 1 and _m_. The second line of a dataset gives the details of coach tickets. _t i_ is the number of horses specified in the _i_ -th coach ticket (1<=_i_ <=_n_). You can assume that the number of horses is between 1 and 10. The following _p_ lines give the details of roads between cities. The _i_ -th road connects two cities with city indices _x i_ and _y i_, and has a distance _z i_ (1<=_i_ <=_p_). You can assume that the distance is between 1 and 100. No two roads connect the same pair of cities. A road never connects a city with itself. Each road can be traveled in both directions.
from collections import defaultdict class Edge: def __init__(self, inputs): start, end, self.dist = [int(i) for i in inputs] self.nodes = [start, end] def isConnect(self, node): return node in self.nodes def other_side(self, node): if self.nodes[0] == node: return self.nodes[1] else: return self.nodes[0] def __str__(self): return "%d - %d (%d)" % (self.nodes[0], self.nodes[1], self.dist) def calc_cost(list, tickets): s_list = sorted(list, reverse=True) return sum(c / t for c, t in zip(s_list, tickets)) while True: n, m, p, a, b = [int(i) for i in input().split()] print("ticktes: %d, m: %d, edge_num: %d, %d -> %d)" % (n, m, p, a, b)) if n == m == p == a == b == 0: quit() tickets = sorted([int(i) for i in input().split()], reverse=True) e = defaultdict(list) for i in range(p): start, end, cost = [int(i) for i in input().split()] e[start].append((end, cost)) e[end].append((start, cost)) m_cost = defaultdict(lambda: float("inf")) # edges = [ Edge(input().split()) for i in range(p) ] # print(tickets) result = (a, [a], [], float("inf")) if p == 0: print("Impossible") continue q = [(e[0], [a, e[0]], [e[1]], calc_cost([e[1]], tickets)) for e in e[a]] while len(q) != 0: now = q.pop() # print("now: ", now) # ?????±????????°????¶?????????´??? if len(now[1]) - 1 > n: continue if m_cost[now[0]] < now[3]: continue else: m_cost[now[0]] = now[3] # ??????????????????????????£?????´??? if now[0] == b and now[3] < result[3]: result = now q.extend( [ ( e[0], now[1] + [e[0]], now[2] + [e[1]], calc_cost(now[2] + [e[1]], tickets), ) for e in e[now[0]] if e[0] not in now[1] ] ) if result[0] == b: print(result[3]) else: print("Impossible")
D: Traveling by Stagecoach Once upon a time, there was a traveler. He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route for him. There are several cities in the country, and a road network connecting them. If there is a road between two cities, one can travel by a stagecoach from one of them to the other. A coach ticket is needed for a coach ride. The number of horses is specified in each of the tickets. Of course, with more horses, the coach runs faster. At the starting point, the traveler has a number of coach tickets. By considering these tickets and the information on the road network, you should find the best possible route that takes him to the destination in the shortest time. The usage of coach tickets should be taken into account. The following conditions are assumed. * A coach ride takes the traveler from one city to another directly connected by a road. In other words, on each arrival to a city, he must change the coach. * Only one ticket can be used for a coach ride between two cities directly connected by a road. * Each ticket can be used only once. * The time needed for a coach ride is the distance between two cities divided by the number of horses. * The time needed for the coach change should be ignored.
[{"input": "4 3 1 4\n 3 1 2\n 1 2 10\n 2 3 30\n 3 4 20\n 2 4 4 2 1\n 3 1\n 2 3 3\n 1 3 3\n 4 1 2\n 4 2 5\n 2 4 3 4 1\n 5 5\n 1 2 10\n 2 3 10\n 3 4 10\n 1 2 0 1 2\n 1\n 8 5 10 1 5\n 2 7 1 8 4 5 6 3\n 1 2 5\n 2 3 4\n 3 4 7\n 4 5 3\n 1 3 25\n 2 4 23\n 3 5 22\n 1 4 45\n 2 5 51\n 1 5 99\n 0 0 0 0 0", "output": ".000\n 3.667\n Impossible\n Impossible\n 2.856"}]
For each dataset in the input, one line should be output as specified below. An output line should not contain extra characters such as spaces. If the traveler can reach the destination, the time needed for the best route (a route with the shortest time) should be printed. The answer should not have an error greater than 0.001. You may output any number of digits after the decimal point, provided that the above accuracy condition is satisfied. If the traveler cannot reach the destination, the string "`Impossible`" should be printed. One cannot reach the destination either when there are no routes leading to the destination, or when the number of tickets is not sufficient. Note that the first letter of "`Impossible`" is in uppercase, while the other letters are in lowercase.
s115060695
Accepted
p00719
The input consists of multiple datasets, each in the following format. The last dataset is followed by a line containing five zeros (separated by a space). > _n m p a b_ > _t_ 1 _t_ 2 ... _t n_ > _x_ 1 _y_ 1 _z_ 1 > _x_ 2 _y_ 2 _z_ 2 > ... > _x p_ _y p_ _z p_ > Every input item in a dataset is a non-negative integer. If a line contains two or more input items, they are separated by a space. _n_ is the number of coach tickets. You can assume that the number of tickets is between 1 and 8. _m_ is the number of cities in the network. You can assume that the number of cities is between 2 and 30. _p_ is the number of roads between cities, which may be zero. _a_ is the city index of the starting city. _b_ is the city index of the destination city. _a_ is not equal to _b_. You can assume that all city indices in a dataset (including the above two) are between 1 and _m_. The second line of a dataset gives the details of coach tickets. _t i_ is the number of horses specified in the _i_ -th coach ticket (1<=_i_ <=_n_). You can assume that the number of horses is between 1 and 10. The following _p_ lines give the details of roads between cities. The _i_ -th road connects two cities with city indices _x i_ and _y i_, and has a distance _z i_ (1<=_i_ <=_p_). You can assume that the distance is between 1 and 100. No two roads connect the same pair of cities. A road never connects a city with itself. Each road can be traveled in both directions.
while True: N, M, P, A, B = map(int, input().split()) if not (N | M | P | A | B): break A, B = A - 1, B - 1 T = [int(x) for x in input().split()] dp = [[float("inf")] * M for _ in range(1 << N)] dp[0][A] = 0 edges = [] for _ in range(P): s, t, c = map(int, input().split()) s, t = s - 1, t - 1 edges.append((s, t, c)) edges.append((t, s, c)) ans = float("inf") for state in range(1 << N): for s, t, c in edges: for k in range(N): if state >> k & 1: dp[state][t] = min( dp[state][t], dp[state & ~(1 << k)][s] + c / T[k] ) ans = min(dp[state][B] for state in range(1 << N)) print("Impossible" if ans == float("inf") else "{:.05f}".format(ans))
D: Traveling by Stagecoach Once upon a time, there was a traveler. He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route for him. There are several cities in the country, and a road network connecting them. If there is a road between two cities, one can travel by a stagecoach from one of them to the other. A coach ticket is needed for a coach ride. The number of horses is specified in each of the tickets. Of course, with more horses, the coach runs faster. At the starting point, the traveler has a number of coach tickets. By considering these tickets and the information on the road network, you should find the best possible route that takes him to the destination in the shortest time. The usage of coach tickets should be taken into account. The following conditions are assumed. * A coach ride takes the traveler from one city to another directly connected by a road. In other words, on each arrival to a city, he must change the coach. * Only one ticket can be used for a coach ride between two cities directly connected by a road. * Each ticket can be used only once. * The time needed for a coach ride is the distance between two cities divided by the number of horses. * The time needed for the coach change should be ignored.
[{"input": "4 3 1 4\n 3 1 2\n 1 2 10\n 2 3 30\n 3 4 20\n 2 4 4 2 1\n 3 1\n 2 3 3\n 1 3 3\n 4 1 2\n 4 2 5\n 2 4 3 4 1\n 5 5\n 1 2 10\n 2 3 10\n 3 4 10\n 1 2 0 1 2\n 1\n 8 5 10 1 5\n 2 7 1 8 4 5 6 3\n 1 2 5\n 2 3 4\n 3 4 7\n 4 5 3\n 1 3 25\n 2 4 23\n 3 5 22\n 1 4 45\n 2 5 51\n 1 5 99\n 0 0 0 0 0", "output": ".000\n 3.667\n Impossible\n Impossible\n 2.856"}]
Print a string S that represents a shortest path for Dolphin. The i-th character in S should correspond to his i-th movement. The directions of the movements should be indicated by the following characters: * `U`: Up * `D`: Down * `L`: Left * `R`: Right If there exist multiple shortest paths under the condition, print any of them. * * *
s591248861
Accepted
p03836
The input is given from Standard Input in the following format: sx sy tx ty
sx, sy, tx, ty = map(int, input().split()) xf, xb, yf, yb = "R", "L", "U", "D" dx = abs(tx - sx) dy = abs(ty - sy) if tx < sx: xf, xb = "L", "R" if ty < sy: yf, yb = "D", "U" s = "" if dx == 0: s += yf * dy s += xf s += yb * dy s += xb s += xb s += yf * dy s += xf s += yf s += xf * 2 s += yb * (dy + 2) s += xb * 2 s *= yb elif dy == 0: s += xf * dx s += yb s += xb * dx s += yf s += yf s += xf * dx s += yb s += xf s += yb * 2 s += xb(dx + 2) s += yf * 2 s += xf else: s += yf * dy s += xf * dx s += yb * dy s += xb * dx s += xb s += yf * (dy + 1) s += xf * (dx + 1) s += yb s += xf s += yb * (dy + 1) s += xb * (dx + 1) s += yf print(s)
Statement Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him.
[{"input": "0 0 1 2", "output": "UURDDLLUUURRDRDDDLLU\n \n\nOne possible shortest path is:\n\n * Going from (sx,sy) to (tx,ty) for the first time: (0,0) \u2192 (0,1) \u2192 (0,2) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the first time: (1,2) \u2192 (1,1) \u2192 (1,0) \u2192 (0,0)\n * Going from (sx,sy) to (tx,ty) for the second time: (0,0) \u2192 (-1,0) \u2192 (-1,1) \u2192 (-1,2) \u2192 (-1,3) \u2192 (0,3) \u2192 (1,3) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the second time: (1,2) \u2192 (2,2) \u2192 (2,1) \u2192 (2,0) \u2192 (2,-1) \u2192 (1,-1) \u2192 (0,-1) \u2192 (0,0)\n\n* * *"}, {"input": "-2 -2 1 1", "output": "UURRURRDDDLLDLLULUUURRURRDDDLLDL"}]
Print a string S that represents a shortest path for Dolphin. The i-th character in S should correspond to his i-th movement. The directions of the movements should be indicated by the following characters: * `U`: Up * `D`: Down * `L`: Left * `R`: Right If there exist multiple shortest paths under the condition, print any of them. * * *
s849002132
Runtime Error
p03836
The input is given from Standard Input in the following format: sx sy tx ty
sx, sy, tx, ty=map(int,inpu().split()) dx=tx-sx dy=ty-sy d={0:'R', 1:'U', 2:'L', 3:'D'} dirc=[dx,dy,dx,dy] s='' for j in range(4)" s+=d[j]*(dirc[j]+i) s+='D' for j in range(2): s+=d[j]*(dirc[j]+1) s+='L' s+='U' for j in range(2): s+=d[j+2]*(dirc[j+2]+1) s+='R' print(s)
Statement Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him.
[{"input": "0 0 1 2", "output": "UURDDLLUUURRDRDDDLLU\n \n\nOne possible shortest path is:\n\n * Going from (sx,sy) to (tx,ty) for the first time: (0,0) \u2192 (0,1) \u2192 (0,2) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the first time: (1,2) \u2192 (1,1) \u2192 (1,0) \u2192 (0,0)\n * Going from (sx,sy) to (tx,ty) for the second time: (0,0) \u2192 (-1,0) \u2192 (-1,1) \u2192 (-1,2) \u2192 (-1,3) \u2192 (0,3) \u2192 (1,3) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the second time: (1,2) \u2192 (2,2) \u2192 (2,1) \u2192 (2,0) \u2192 (2,-1) \u2192 (1,-1) \u2192 (0,-1) \u2192 (0,0)\n\n* * *"}, {"input": "-2 -2 1 1", "output": "UURRURRDDDLLDLLULUUURRURRDDDLLDL"}]
Print a string S that represents a shortest path for Dolphin. The i-th character in S should correspond to his i-th movement. The directions of the movements should be indicated by the following characters: * `U`: Up * `D`: Down * `L`: Left * `R`: Right If there exist multiple shortest paths under the condition, print any of them. * * *
s775873384
Accepted
p03836
The input is given from Standard Input in the following format: sx sy tx ty
p, q, x, y = map(int, input().split()) x -= p y -= q u = "U" * y + "R" * x d = "D" * y + "L" * x + "LU" print(u + d + u + "RDRD" + d)
Statement Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him.
[{"input": "0 0 1 2", "output": "UURDDLLUUURRDRDDDLLU\n \n\nOne possible shortest path is:\n\n * Going from (sx,sy) to (tx,ty) for the first time: (0,0) \u2192 (0,1) \u2192 (0,2) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the first time: (1,2) \u2192 (1,1) \u2192 (1,0) \u2192 (0,0)\n * Going from (sx,sy) to (tx,ty) for the second time: (0,0) \u2192 (-1,0) \u2192 (-1,1) \u2192 (-1,2) \u2192 (-1,3) \u2192 (0,3) \u2192 (1,3) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the second time: (1,2) \u2192 (2,2) \u2192 (2,1) \u2192 (2,0) \u2192 (2,-1) \u2192 (1,-1) \u2192 (0,-1) \u2192 (0,0)\n\n* * *"}, {"input": "-2 -2 1 1", "output": "UURRURRDDDLLDLLULUUURRURRDDDLLDL"}]
Print a string S that represents a shortest path for Dolphin. The i-th character in S should correspond to his i-th movement. The directions of the movements should be indicated by the following characters: * `U`: Up * `D`: Down * `L`: Left * `R`: Right If there exist multiple shortest paths under the condition, print any of them. * * *
s702262314
Wrong Answer
p03836
The input is given from Standard Input in the following format: sx sy tx ty
sx, sy, tx, ty = map(int, input().split()) dx = tx - sx dy = ty - sy ls = [ "R" * dx, "U" * dy, "L" * dx, "D" * dy, "D", "R" * (dx + 1), "U" * (dy + 1), "L", "U", "L" * (dy + 1), "D" * (dy + 1), "R", ] print("".join(ls))
Statement Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him.
[{"input": "0 0 1 2", "output": "UURDDLLUUURRDRDDDLLU\n \n\nOne possible shortest path is:\n\n * Going from (sx,sy) to (tx,ty) for the first time: (0,0) \u2192 (0,1) \u2192 (0,2) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the first time: (1,2) \u2192 (1,1) \u2192 (1,0) \u2192 (0,0)\n * Going from (sx,sy) to (tx,ty) for the second time: (0,0) \u2192 (-1,0) \u2192 (-1,1) \u2192 (-1,2) \u2192 (-1,3) \u2192 (0,3) \u2192 (1,3) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the second time: (1,2) \u2192 (2,2) \u2192 (2,1) \u2192 (2,0) \u2192 (2,-1) \u2192 (1,-1) \u2192 (0,-1) \u2192 (0,0)\n\n* * *"}, {"input": "-2 -2 1 1", "output": "UURRURRDDDLLDLLULUUURRURRDDDLLDL"}]
Print a string S that represents a shortest path for Dolphin. The i-th character in S should correspond to his i-th movement. The directions of the movements should be indicated by the following characters: * `U`: Up * `D`: Down * `L`: Left * `R`: Right If there exist multiple shortest paths under the condition, print any of them. * * *
s031944439
Accepted
p03836
The input is given from Standard Input in the following format: sx sy tx ty
sx, sy, tx, ty = map(int, input().rstrip().split()) dx = tx - sx dy = ty - sy ret = "" ret += "R" * dx + "U" * dy ret += "L" * dx + "D" * dy ret += "D" ret += "R" * dx + "R" + "U" * dy + "U" ret += "L" ret += "U" ret += "L" * dx + "L" + "D" * dy + "D" ret += "R" print(ret)
Statement Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him.
[{"input": "0 0 1 2", "output": "UURDDLLUUURRDRDDDLLU\n \n\nOne possible shortest path is:\n\n * Going from (sx,sy) to (tx,ty) for the first time: (0,0) \u2192 (0,1) \u2192 (0,2) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the first time: (1,2) \u2192 (1,1) \u2192 (1,0) \u2192 (0,0)\n * Going from (sx,sy) to (tx,ty) for the second time: (0,0) \u2192 (-1,0) \u2192 (-1,1) \u2192 (-1,2) \u2192 (-1,3) \u2192 (0,3) \u2192 (1,3) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the second time: (1,2) \u2192 (2,2) \u2192 (2,1) \u2192 (2,0) \u2192 (2,-1) \u2192 (1,-1) \u2192 (0,-1) \u2192 (0,0)\n\n* * *"}, {"input": "-2 -2 1 1", "output": "UURRURRDDDLLDLLULUUURRURRDDDLLDL"}]
Print a string S that represents a shortest path for Dolphin. The i-th character in S should correspond to his i-th movement. The directions of the movements should be indicated by the following characters: * `U`: Up * `D`: Down * `L`: Left * `R`: Right If there exist multiple shortest paths under the condition, print any of them. * * *
s586471402
Accepted
p03836
The input is given from Standard Input in the following format: sx sy tx ty
sx, sy, tx, ty = map(int, input().split()) x, y = tx - sx, ty - sy Root = "" # Go1 Root += "L" + "U" * (y + 1) + "R" * (x + 1) + "D" # Back1 Root += "L" * x + "D" * y # Go2 Root += "D" + "R" * (x + 1) + "U" * (y + 1) + "L" # Back2 Root += "D" * y + "L" * x print(Root)
Statement Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him.
[{"input": "0 0 1 2", "output": "UURDDLLUUURRDRDDDLLU\n \n\nOne possible shortest path is:\n\n * Going from (sx,sy) to (tx,ty) for the first time: (0,0) \u2192 (0,1) \u2192 (0,2) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the first time: (1,2) \u2192 (1,1) \u2192 (1,0) \u2192 (0,0)\n * Going from (sx,sy) to (tx,ty) for the second time: (0,0) \u2192 (-1,0) \u2192 (-1,1) \u2192 (-1,2) \u2192 (-1,3) \u2192 (0,3) \u2192 (1,3) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the second time: (1,2) \u2192 (2,2) \u2192 (2,1) \u2192 (2,0) \u2192 (2,-1) \u2192 (1,-1) \u2192 (0,-1) \u2192 (0,0)\n\n* * *"}, {"input": "-2 -2 1 1", "output": "UURRURRDDDLLDLLULUUURRURRDDDLLDL"}]
Print a string S that represents a shortest path for Dolphin. The i-th character in S should correspond to his i-th movement. The directions of the movements should be indicated by the following characters: * `U`: Up * `D`: Down * `L`: Left * `R`: Right If there exist multiple shortest paths under the condition, print any of them. * * *
s461516083
Runtime Error
p03836
The input is given from Standard Input in the following format: sx sy tx ty
N = int(input()) A = list(map(int, input().split())) ans = 1 if N % 2 == 0: for i in list(range(1, N, 2)): if A.count(i) != 2: ans = 0 break else: if A.count(0) == 1: for i in list(range(2, N, 2)): if A.count(i) != 2: ans = 0 break else: ans = 0 if ans == 0: print(0) else: print((2 ** (N // 2)) % (10**9 + 7))
Statement Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up. Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1. Here, both the x\- and y-coordinates before and after each movement must be integers. He will first visit the point (tx,ty) where sx < tx and sy < ty, then go back to the point (sx,sy), then visit the point (tx,ty) again, and lastly go back to the point (sx,sy). Here, during the whole travel, he is not allowed to pass through the same point more than once, except the points (sx,sy) and (tx,ty). Under this condition, find a shortest path for him.
[{"input": "0 0 1 2", "output": "UURDDLLUUURRDRDDDLLU\n \n\nOne possible shortest path is:\n\n * Going from (sx,sy) to (tx,ty) for the first time: (0,0) \u2192 (0,1) \u2192 (0,2) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the first time: (1,2) \u2192 (1,1) \u2192 (1,0) \u2192 (0,0)\n * Going from (sx,sy) to (tx,ty) for the second time: (0,0) \u2192 (-1,0) \u2192 (-1,1) \u2192 (-1,2) \u2192 (-1,3) \u2192 (0,3) \u2192 (1,3) \u2192 (1,2)\n * Going from (tx,ty) to (sx,sy) for the second time: (1,2) \u2192 (2,2) \u2192 (2,1) \u2192 (2,0) \u2192 (2,-1) \u2192 (1,-1) \u2192 (0,-1) \u2192 (0,0)\n\n* * *"}, {"input": "-2 -2 1 1", "output": "UURRURRDDDLLDLLULUUURRURRDDDLLDL"}]