s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s530411325
p01841
u591052358
1530088640
Python
Python3
py
Accepted
30
5732
907
def sToTree(S): # print(S) if len(S)==0: return 'N' c = 0 left=0 right=0 #print(S) for i in range(len(S)): if S[i] =='(': c+=1 elif S[i] ==')': c-=1 elif c==0 and S[i]=='[': left=i elif c==0 and S[i] ==']': ...
p01841
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h2>C - みさわさんの根付き木</h2> <h3>Problem Statement</h3...
((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()) (()[4]())[3](((()[2]())[1]())[8](()[3]()))
(()[6]())[8](((()[4]())[7]())[9]())
27,148
s818284211
p01841
u528682978
1597895245
Python
Python3
py
Accepted
30
5776
1,213
class binary_tree(): def __init__(self,value,left=None,right=None): self.value=value self.left=left self.right=right def find_corres_bra(s,fr,to): count=0 x=-1 for i in range(len(s)): if s[i]==fr: count += 1 elif s[i]==to: if count==1: ...
p01841
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h2>C - みさわさんの根付き木</h2> <h3>Problem Statement</h3...
((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()) (()[4]())[3](((()[2]())[1]())[8](()[3]()))
(()[6]())[8](((()[4]())[7]())[9]())
27,149
s774260440
p01841
u731941832
1562484214
Python
Python3
py
Accepted
30
5780
451
def sep(S): l=r=0 for i,s in enumerate(S): l+=s=='(' r+=s==')' if l==r: j=S.find(']',i) s_l=S[1:i] s_r=S[j+2:-1] s_c=int(S[i+2:j]) break return s_l,s_c,s_r def solve(A,B): if A=='' or B=='': return '' a_l,a_c...
p01841
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h2>C - みさわさんの根付き木</h2> <h3>Problem Statement</h3...
((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()) (()[4]())[3](((()[2]())[1]())[8](()[3]()))
(()[6]())[8](((()[4]())[7]())[9]())
27,150
s319905124
p01841
u273756488
1560581652
Python
Python3
py
Accepted
30
5900
1,046
from sys import setrecursionlimit setrecursionlimit(10 ** 8) A = input() B = input() A_root = [[-1] * 3 for i in range(1000)] B_root = [[-1] * 3 for i in range(1000)] class Source(): def __init__(self, S): self.S = S self.pos = 0 def peek(S): return S.S[S.pos] if S.pos < len(S.S) else -1 def next...
p01841
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h2>C - みさわさんの根付き木</h2> <h3>Problem Statement</h3...
((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()) (()[4]())[3](((()[2]())[1]())[8](()[3]()))
(()[6]())[8](((()[4]())[7]())[9]())
27,151
s345970195
p01845
u046108504
1556029502
Python
Python3
py
Accepted
30
5592
237
while True: R0, W0, C, R = map(int, input().split()) if R0 == 0 and W0 == 0 and C == 0 and R == 0: break i = 0 while True: if (R0 + i * R) // W0 >= C: print(i) break i += 1
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,152
s384742938
p01845
u685815919
1481250804
Python
Python
py
Accepted
20
6244
174
while True: r0,w0,c,r=map(int,raw_input().split()) if r0==0: break i=0 while True: if r0+i*r>=c*w0: print i break i+=1
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,153
s557566255
p01845
u660912567
1481733162
Python
Python3
py
Accepted
30
7604
147
import math while True: r,w,c,vr = map(int,input().split()) if r==w==0: break r = math.ceil((w*c-r)/vr) if w*c-r>=0 else 0 print(r)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,154
s120093064
p01845
u301729341
1482143275
Python
Python3
py
Accepted
40
7632
305
while True: r_0,w_0,c,r = map(int,input().split()) if r_0 == w_0 == c == r: break if c <= (r_0/w_0): print(0) else: num = 0 while True: num += 1 r_0 += r if c <= (r_0/w_0): print(num) break
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,155
s649786907
p01845
u078042885
1483500409
Python
Python3
py
Accepted
20
7596
138
import math while 1: r,w,c,rr=map(int,input().split()) if r==w==c==rr==0:break print(math.ceil((w*c-r)/rr) if w*c-r>=0 else 0)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,156
s537308125
p01845
u728992264
1490443216
Python
Python3
py
Accepted
40
7652
183
while True: R0, W0, C, R = map(int, input().split()) if R0 + W0 + C + R == 0: break n = 0 while True: if (n * R + R0) / W0 >= C: break n += 1 print(n)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,157
s637937105
p01845
u408260374
1492945210
Python
Python3
py
Accepted
40
7528
255
while True: R0, W0, C, R = map(int, input().split()) if R0 == W0 == C == R == 0: break X = 0 while True: tmp = R0 + X * R - C * W0 if tmp >= 0: print(X) break else: X += 1
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,158
s578975409
p01845
u408260374
1492945260
Python
Python3
py
Accepted
40
7628
237
while True: R0, W0, C, R = map(int, input().split()) if R0 == W0 == C == R == 0: break X = 0 while True: if R0 + X * R - C * W0 >= 0: print(X) break else: X += 1
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,159
s106083726
p01845
u260980560
1501402097
Python
Python3
py
Accepted
20
7600
125
while 1: r0, w0, c, r = map(int, input().split()) if r0+w0+c+r < 1: break print(max((c*w0-r0+r-1)//r, 0))
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,160
s034108668
p01845
u633333374
1503189881
Python
Python
py
Accepted
20
6384
255
while 1: r,w,c,a = map(int,raw_input().split()) if r == w == c == a == 0: break b = 0 sum = 0 if r / c >= w: b = 1 while b == 0: sum += 1 r += a if r/c>=w: b = 1 print sum
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,161
s383320825
p01845
u741801763
1506433606
Python
Python3
py
Accepted
50
7700
244
if __name__ == "__main__": while 1: r0,w0,c,r = list(map(int,input().strip().split())) if r0 ==w0 ==c ==r ==0:break for x in range(10000): y = r0 + r*x - c*w0 if y >=0 :break print(x)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,162
s285670535
p01845
u506554532
1513051203
Python
Python3
py
Accepted
30
5596
191
while True: R0,W0,C,R = map(int,input().split()) if R0 == 0: break x = 0 while True: r = R0 + x*R if r >= W0 * C: break x += 1 print(x)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,163
s944560391
p01845
u146816547
1523797961
Python
Python
py
Accepted
10
4632
206
while True: R_0, W_0, C, R = map(int, raw_input().split()) if R_0 == 0 and W_0 == 0 and C == 0 and R == 0: break t = C * W_0 - R_0 print max(0, t / R if t % R == 0 else t / R + 1)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,164
s939953586
p01845
u146816547
1523799043
Python
Python
py
Accepted
10
4632
207
while True: R_0, W_0, C, R = map(int, raw_input().split()) if R_0 == 0 and W_0 == 0 and C == 0 and R == 0: break t = max(0, C * W_0 - R_0) print t / R if t % R == 0 else t / R + 1
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,165
s251421342
p01845
u023471147
1526614383
Python
Python3
py
Accepted
20
5592
133
while True: r0, w0, c, r = map(int, input().split()) if r0 == 0: break print(max(0, (w0 * c - r0 - 1) // r + 1))
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,166
s379513057
p01845
u724548524
1526673960
Python
Python3
py
Accepted
20
5596
134
while True: r0, w0, c, r = map(int, input().split()) if r0 == 0:break print(0 if w0 * c <= r0 else -((r0 - w0 * c) // r))
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,167
s828797633
p01845
u509278866
1527842651
Python
Python3
py
Accepted
60
9024
851
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF()...
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,168
s040828024
p01845
u614485948
1529401264
Python
Python3
py
Accepted
20
5612
228
l_raw = input().split() l = [int(n) for n in l_raw] while l!=[0,0,0,0]: if l[2] <= l[0]/l[1]: print(0) else: print(-(-(l[2]*l[1]-l[0])//l[3])) l_raw = input().split() l = [int(n) for n in l_raw]
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,169
s918165337
p01845
u136916346
1530147862
Python
Python3
py
Accepted
40
5592
214
while 1: R0,W0,C,R=map(int,input().split()) if not R0 and not W0 and not C and not R:break n=0 while 1: if W0>1 and int((R0+R*n)/W0)>=C:break elif W0==1 and (R0+R*n)>=C:break n+=1 print(n)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,170
s898916530
p01845
u353888999
1587032012
Python
Python3
py
Accepted
30
5652
225
import math while 1: r0,w0,c,r = map(int,input().split()) if r0 == 0 and w0 == 0 and c == 0 and r == 0: break for i in range(100000): if c <= (r0+i*r) // w0: print(i) break
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,171
s115657322
p01845
u206124123
1586689102
Python
Python3
py
Accepted
30
5596
770
def get_four_int(): four_int = input().split() for i, v in enumerate(four_int): four_int[i] = int(v) return four_int def get_min_roux_num(initial_roux, initial_water, ideal_concentration, min_unit): roux = initial_roux min_roux_num = 0 min_required_roux = initial_water * ideal_concentra...
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,172
s463121890
p01845
u015993536
1575539938
Python
Python3
py
Accepted
40
5600
275
Q=[] while True: A=list(map(int,input().split())) if A==[0,0,0,0]: break else: Q.append(A) for k in range(len(Q)): for i in range(100000): P=(Q[k][0]+i*Q[k][3])/Q[k][2]-Q[k][1] if P>=0: print(i) break
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,173
s578278967
p01845
u430736685
1575539784
Python
Python3
py
Accepted
40
5592
362
R0, W0, C, R = list(map(int, input().split())) f=0 if R0 == W0 == C == R == 0: f+=1 while f==0: for X in range(10**5): if ((R0-W0*C)+R*X)>=0: y = ((R0-W0*C)+R*X)/C print(X) break else: continue R0, W0, C, R = list(map(int, input().split())) ...
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,174
s898130905
p01845
u199911712
1575539501
Python
Python3
py
Accepted
30
5592
201
while (True): r_count = 0 r0, w0, c, r = map(int, input().split()) if not(r0 and w0 and c and r): break while ((r0 + r * r_count) / w0 < c): r_count += 1 print(r_count)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,175
s227265002
p01845
u123563150
1575538639
Python
Python3
py
Accepted
20
5668
141
import math while True: r0,w,c,r=map(int,input().split()) if [r0,w,c,r]==[0,0,0,0]: exit() ans=math.ceil((c*w-r0)/r) print(max(ans,0))
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,176
s541274687
p01845
u613680365
1575538573
Python
Python3
py
Accepted
30
5592
206
while True: R0, W0, C, R = map(int, input().split(' ')) if R0 == 0 and W0 == 0 and C == 0 and R == 0: break cnt = 0 while R0/W0 < C: R0 += R cnt += 1 print(cnt)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,177
s830682942
p01845
u048191691
1575538548
Python
Python3
py
Accepted
20
5604
292
def updiv(a,b): if a % b == 0: return a // b else: return a // b + 1 while True: r,w,C,R = map(int,input().split()) if r == 0 and w == 0 and C == 0 and R == 0: break if r/w >= C: print (0) else: print (updiv(w*C-r,R))
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,178
s497301547
p01845
u556131648
1572255463
Python
Python3
py
Accepted
40
8180
1,469
from collections import defaultdict from collections import deque from heapq import heappush, heappop from functools import reduce import sys import math import bisect import random def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def LI(): return list(map(in...
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,179
s748783787
p01845
u853158149
1572253500
Python
Python3
py
Accepted
40
8168
894
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()]...
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,180
s452086299
p01845
u537067968
1561620807
Python
Python3
py
Accepted
30
5596
267
while True: R0,W0,C,R = map(int,input().split()) if R0 + W0 + C + R == 0: break ans = 0 while True: if (R0 + R * ans) / C >= W0: print(ans) break ans += 1
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,181
s495851675
p01845
u489876484
1561530657
Python
Python3
py
Accepted
20
5668
375
import math def main(): while True: r0,w0,c,r = map(int,input().split()) if not r0 and not w0 and not c and not r: return current = r0/w0 ans = 0 if c < current: ans = 0 else: ans = math.ceil((c*w0-r0)/r) print(ans...
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,182
s787056959
p01845
u037441960
1561168795
Python
Python3
py
Accepted
40
5596
273
def Con(X) : # concentration 濃度 if(r + X * R - C * w >= 0) : return 0 else : return 1 while True : r, w, C, R = map(int, input().split()) if(C == 0) : break else : for i in range(10000) : if(Con(i) == 0) : print(i) break else : pass
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,183
s437097608
p01845
u998437062
1561125424
Python
Python3
py
Accepted
30
5592
210
#!/usr/bin/env python3 while True: r0, w0, c, r = map(int, input().split()) if r0 == 0: break for x in range(10001): if r0 + x * r >= c * w0: print(x) break
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,184
s816643847
p01845
u931913851
1560768022
Python
Python3
py
Accepted
20
5660
309
import math while True: Rzero, W, C, R = map(int, input().split()) # 最初のルウRzero, 最初の水, 濃度Cのルウがベスト, 一個のルウが if Rzero == 0: break aim_status = W * C ans = math.ceil((aim_status-Rzero)/R) if ans < 0: ans = 0 print(ans)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,185
s937122557
p01845
u814278309
1560149337
Python
Python3
py
Accepted
30
5596
154
while True: r,w,c,x=map(int,input().split()) if w==c==x==0: break a=0 while True: if (a*x+r)/w>=c: break a+=1 print(a)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,186
s845644135
p01845
u805464373
1558162187
Python
Python3
py
Accepted
30
5616
521
r,w,c,rr=map(int,input().split()) lsr=[] lsw=[] lsc=[] lsrr=[] n=0 m=0 while True: R,W,C,RR=map(int,input().split()) lsr.append(R) lsw.append(W) lsc.append(C) lsrr.append(RR) if R==0: break n+=1 if lsr[0]/lsw[0]>=lsc[0]: print(0) else: while lsr[0]+lsrr[0]*m<lsw[0]*lsc[0...
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,187
s212358029
p01845
u990228206
1553071291
Python
Python3
py
Accepted
20
5660
184
import math while 1: r0,w0,c,r=map(int,input().split()) if r0==w0==c==r==0:break r1=w0*c if r1<=r0:print("0") else: nw=r1-r0 print(math.ceil(nw/r))
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,188
s446843576
p01845
u717526540
1545020056
Python
Python3
py
Accepted
30
5592
206
while 1: r0, w0, c, r = map(int, input().split()) if r == 0: break tmp = w0 * c - r0 if tmp % r == 0: print(max(tmp // r, 0)) else: print(max(tmp // r + 1, 0))
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,189
s207707536
p01845
u158979022
1542864244
Python
Python3
py
Accepted
20
5592
145
while True: R0, W0, C, R = map(int, input().split()) if R0 + W0 + C + R == 0: break print(max((C * W0 - R0 + R -1) // R, 0))
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,190
s727545494
p01845
u454636644
1529399672
Python
Python3
py
Accepted
20
5656
238
import math while True: r0, w0, c, r = map(int, input().split()) if (r0+w0+c+r) == 0: break else: tmp = math.ceil((w0*c - r0) / r) if tmp < 0: print(0) else: print(tmp)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,191
s434703610
p01845
u281836941
1513072145
Python
Python3
py
Accepted
40
5600
222
# coding: utf-8 while 1: r0,w0,c,r=map(int,input().split()) if r0==0: break n=r0/w0 x=0 if n>=c: print(0) continue while n<c: x+=1 n=(r0+r*x)/w0 print(x)
p01845
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カレー作り</h3> <p>ACM-ICPC国内予選が近づいてきたので,練習に追い込みをかけ...
10 5 3 4 2 5 2 3 91 13 7 62 10 1 3 5 20 100 2 20 2 14 7 1 0 0 0 0
2 3 0 0 9 96
27,192
s560604177
p01846
u078042885
1486430764
Python
Python3
py
Accepted
20
7712
530
while 1: s=input() if '#' in s:break p=0 e=[[]*2 for _ in range(10)] for x in s: if x=='b':e[p]+=['b'] elif x=='/':p+=1 else:e[p]+='.'*int(x) ans='' a,b,c,d=map(int,input().split()) e[a-1][b-1],e[c-1][d-1]=e[c-1][d-1],e[a-1][b-1] for i in range(p+1): i...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,193
s983902577
p01846
u408260374
1493640788
Python
Python3
py
Accepted
20
7748
850
def j2b(S): rows = S.split("/") for i, row in enumerate(rows): cand = [] for s in row: if s == "b": cand.append(s) else: cand.extend(["."] * int(s)) rows[i] = cand return rows def b2j(rows): ret = [] for row in rows: ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,194
s551492478
p01846
u231562319
1500152217
Python
Python3
py
Accepted
20
7692
871
def decode(s): ret = [] for line in s.split('/'): a = '' for c in line: if c == 'b': a += 'b' else: a += '.'*(ord(c)-ord('0')) ret.append(list(a)) return ret def encode(s): ret = [] for line in s: x = ''.join(li...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,195
s680435899
p01846
u260980560
1501403013
Python
Python3
py
Accepted
30
7680
917
while 1: s = input() if s == '#': break M = [] for l in s.split('/'): num = 0 tmp = [] for c in l: if c == 'b': if num > 0: tmp.extend([0]*num) tmp.append(1) num = 0 else: ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,196
s547404661
p01846
u724548524
1526675453
Python
Python3
py
Accepted
30
5612
1,104
while True: s = input() if s == "#":break s = s.split("/") area = [0] * len(s) for i in range(len(s)): t = [] while True: if s[i][0] == "b": t.append(1) s[i] = s[i][1:] else: if "b" in s[i]: t...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,197
s949020648
p01846
u614485948
1529402843
Python
Python3
py
Accepted
10
5604
797
now=input() while now!="#": order_raw = input() order = [int(s)-1 for s in order_raw.split(' ')] box = [[]] for n in now: if n=='/': box.append([]) elif n=='b': box[-1].append('b') else: for _ in range(int(n)): box[-1].append(...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,198
s331526880
p01846
u509278866
1529488827
Python
Python3
py
Accepted
60
9040
1,747
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdi...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,199
s348867762
p01846
u314932236
1530072271
Python
Python3
py
Accepted
30
5616
522
def main(): S = input().split("/") if S[0] == "#": return for s in range(len(S)): for i in range(10): S[s]= S[s].replace(str(i),"."*i) a,b,c,d = map(int,input().split()) S[a-1] = S[a-1][:b-1]+"."+S[a-1][b:] S[c-1] = S[c-1][:d-1]+"b"+S[c-1][d:] for s in range(len(S)): ref = "" temp = 0 for i in S[s]:...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,200
s601448697
p01846
u011621222
1530166405
Python
Python3
py
Accepted
30
5604
915
while True: s = input() if s == '#': break rows = s.split('/') a, b, c, d = map(int, input().split()) a -= 1 b -= 1 c -= 1 d -= 1 grid = ['' for _ in rows] for i, row in enumerate(rows): for kk in row: if kk == 'b': grid[i] += 'b' ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,201
s112578151
p01846
u011621222
1530170631
Python
Python3
py
Accepted
20
5624
1,298
while True: st = list(input().split("/")) if st == ["#"]: break a, b, c, d = map(int, input().split()) s=[] for i in range(len(st)): str=[] for ele in st[i]: if ele=="b": str.append("b") else: for _ in range(int(ele)): ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,202
s030518581
p01846
u853158149
1573632108
Python
Python3
py
Accepted
30
6352
1,703
import copy while 1: S = input() if S == '#': break a, b, c, d = map(lambda x : int(x)-1, input().split()) F = list(S.split('/')) if a != c: f1 = list(F[a]) f2 = list(F[c]) F[a] = [] for x in f1: if x == 'b': F[a].append('b') ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,203
s029111255
p01846
u171610951
1562669319
Python
Python3
py
Accepted
30
5616
1,022
while True: Y = input().split("/") if Y[0] == "#": break L = [[False for i in range(9)]for i in range(9)] MX = 1 MY = len(Y) for i in range(len(Y)): p = 0 for str_ in Y[i]: #print(i,str_) if str_ == "b": L[i][p] = True ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,204
s930289611
p01846
u998437062
1561789485
Python
Python3
py
Accepted
20
5600
821
#!/usr/bin/env python3 while True: s = input() if s == '#': break a, b, c, d = map(lambda x: int(x) - 1, input().split()) cell = [] for i, x in enumerate(s.split('/')): cell.append([]) for ch in x: if ch == 'b': cell[i].append('b') else...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,205
s881736961
p01846
u598814210
1561007252
Python
Python3
py
Accepted
30
5608
1,242
while True: S = input() if S == "#": break a, b, c, d = map(int, input().split()) hasBall = [[False for _ in range(10)] for _ in range(10)] rows = S.split('/') H = len(rows) for h, row in enumerate(rows, start=1): cur = 1 colsize = 0 for ch in row: ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,206
s032390576
p01846
u774794720
1560163109
Python
Python3
py
Accepted
30
5608
798
#!/usr/bin/env python3 while True: s = input() if s == '#': break a, b, c, d = map(lambda x: int(x) - 1, input().split()) tb = [] for i, x in enumerate(s.split('/')): tb.append([]) for ch in x: if ch == 'b': tb[i].append('b') else: ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,207
s309868419
p01846
u082657995
1560053888
Python
Python3
py
Accepted
20
5604
737
while True: S = input() if S=="#": exit() B = [] W = 0 for c in S: if c == "b": B.append(1) elif c != "/": B.extend([0] * int(c)) elif W==0: W = len(B) assert len(B) % W == 0 H = len(B) // W a,b,c,d = map(lambda x: int(x...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,208
s870640895
p01846
u352394527
1546724686
Python
Python3
py
Accepted
30
5604
704
def parse_line(line): ret = [] for c in line: if c == "b": ret.append("b") else: for _ in range(int(c)): ret.append(".") return ret def parse_jfen(s): return list(map(parse_line, s.split("/"))) def to_jfen(mp): ret = "" cnt = 0 for line in mp: cnt = 0 for c in line: ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,209
s246317238
p01846
u717526540
1545021096
Python
Python3
py
Accepted
30
5600
802
while 1: S = input() if S == "#": break S = S.split("/") board = [] for S_row in S: row = [] for s in S_row: if s == "b": row.append("b") else: for _ in range(int(s)): row.append(".") board.a...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,210
s651317460
p01846
u281836941
1532336297
Python
Python3
py
Accepted
30
5604
397
# coding: utf-8 while 1: s=input() if s=='#': break s=s.split('/') field=[list(''.join(['b' if c=='b' else '.'*int(c) for c in s[i]])) for i in range(len(s))] a,b,c,d=map(int,input().split()) field[a-1][b-1],field[c-1][d-1]='.','b' print('/'.join(['b'.join('' if len(c)==0 else str(l...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,211
s582297064
p01846
u454636644
1529402527
Python
Python3
py
Accepted
20
5620
2,906
while True: s = input() if s == '#': break else: a, b, c, d = map(int, input().split()) s_list = s.split('/') a_str = '' if a == c: for i in s_list[a-1]: if i == 'b': a_str += 'b' else: ...
p01846
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>jfen</h3> <p><i>H &times; W</i> の盤面で遊ぶ一人用ゲームが...
b1/1b 1 1 1 2 b5/bbbbbb 2 4 1 4 b2b2b/7 1 4 2 4 #
1b/1b b2b2/bbb1bb b5b/3b3
27,212
s084425304
p01847
u260980560
1584365812
Python
Python3
py
Accepted
40
6048
1,276
from collections import defaultdict INF = 10**9 while 1: N = int(input()) if N == 0: break P = [list(map(int, input().split())) for i in range(N)] S = defaultdict(list) X = set() x0 = y0 = INF; x1 = y1 = -INF for i in range(4): x, y = map(int, input().split()) x0 = mi...
p01847
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カーテン</h3> <p>もうすぐ夏がやってくる.あなたは夏に向けて部屋の模様替えをするこ...
4 0 0 10 0 10 10 0 10 0 0 5 0 5 10 0 10 6 0 0 10 0 10 5 5 5 5 10 0 10 2 0 8 0 8 10 2 10 12 1 1 1 3 -1 3 -1 1 -3 1 -3 -1 -1 -1 -1 -3 1 -3 1 -1 3 -1 3 1 2 2 -2 2 -2 -2 2 -2 4 20000 20000 -20000 20000 -20000 -20000 20000 -20000 1000 1000 -1000 1000 -1000 -1000 1000 -1000 4 1000 1000 -1000 1000 -1000 -1000 1000 -1000 20000...
50 30 8 1596000000 0 100
27,213
s645919662
p01847
u467175809
1530736875
Python
Python
py
Accepted
20
5040
1,104
#!/usr/bin/env python from collections import deque import itertools as it import sys import math while True: N = input() if N == 0: break lst = [] for i in range(N): x, y = map(int, raw_input().split()) lst.append((x, y)) x0, y0 = lst[0] x_pre, y_pre = lst[0] lst.a...
p01847
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <h3>カーテン</h3> <p>もうすぐ夏がやってくる.あなたは夏に向けて部屋の模様替えをするこ...
4 0 0 10 0 10 10 0 10 0 0 5 0 5 10 0 10 6 0 0 10 0 10 5 5 5 5 10 0 10 2 0 8 0 8 10 2 10 12 1 1 1 3 -1 3 -1 1 -3 1 -3 -1 -1 -1 -1 -3 1 -3 1 -1 3 -1 3 1 2 2 -2 2 -2 -2 2 -2 4 20000 20000 -20000 20000 -20000 -20000 20000 -20000 1000 1000 -1000 1000 -1000 -1000 1000 -1000 4 1000 1000 -1000 1000 -1000 -1000 1000 -1000 20000...
50 30 8 1596000000 0 100
27,214
s615813754
p01852
u885631908
1442814408
Python
Python3
py
Accepted
40
7652
180
#!/usr/bin/env python3 # -*- coding: utf-8 -*- n = int(input()) cnt = 0 if n == 0: print(0) exit() while 2**cnt < n : cnt += 1 if 2**cnt == n: cnt += 1 print(cnt)
p01852
<h1 id="a-指折り数えて-finger-counting">A : 指折り数えて / Finger Counting</h1> <h2 id="問題文">問題文</h2> <p>肉西くんは指の数を増やしたり減らしたりできる.<br />肉西くんの前には <var>n</var> 個のまんじゅうがある.<br />肉西くんは指を折ってまんじゅうの個数を数えようとしている.<br />肉西くんの指が取れる形は折れているか折れていないかの <var>2</var> つしか無い.<br />肉西くんは <a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/bdh.html">...
0
0
27,215
s644312316
p01852
u078042885
1484061125
Python
Python3
py
Accepted
20
7668
55
n,a=int(input()),0 while n: n>>=1 a+=1 print(a)
p01852
<h1 id="a-指折り数えて-finger-counting">A : 指折り数えて / Finger Counting</h1> <h2 id="問題文">問題文</h2> <p>肉西くんは指の数を増やしたり減らしたりできる.<br />肉西くんの前には <var>n</var> 個のまんじゅうがある.<br />肉西くんは指を折ってまんじゅうの個数を数えようとしている.<br />肉西くんの指が取れる形は折れているか折れていないかの <var>2</var> つしか無い.<br />肉西くんは <a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/bdh.html">...
0
0
27,216
s578221108
p01852
u260980560
1501608018
Python
Python
py
Accepted
10
6404
26
print input().bit_length()
p01852
<h1 id="a-指折り数えて-finger-counting">A : 指折り数えて / Finger Counting</h1> <h2 id="問題文">問題文</h2> <p>肉西くんは指の数を増やしたり減らしたりできる.<br />肉西くんの前には <var>n</var> 個のまんじゅうがある.<br />肉西くんは指を折ってまんじゅうの個数を数えようとしている.<br />肉西くんの指が取れる形は折れているか折れていないかの <var>2</var> つしか無い.<br />肉西くんは <a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/bdh.html">...
0
0
27,217
s007097561
p01852
u546285759
1508447554
Python
Python3
py
Accepted
70
7700
61
n = int(input()) print(0 if n == 0 else len(str(bin(n))[2:]))
p01852
<h1 id="a-指折り数えて-finger-counting">A : 指折り数えて / Finger Counting</h1> <h2 id="問題文">問題文</h2> <p>肉西くんは指の数を増やしたり減らしたりできる.<br />肉西くんの前には <var>n</var> 個のまんじゅうがある.<br />肉西くんは指を折ってまんじゅうの個数を数えようとしている.<br />肉西くんの指が取れる形は折れているか折れていないかの <var>2</var> つしか無い.<br />肉西くんは <a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/bdh.html">...
0
0
27,218
s071612278
p01852
u546285759
1508447604
Python
Python3
py
Accepted
40
7708
70
n = int(input()) print(0 * (n == 0) + len(str(bin(n))[2:]) * (n != 0))
p01852
<h1 id="a-指折り数えて-finger-counting">A : 指折り数えて / Finger Counting</h1> <h2 id="問題文">問題文</h2> <p>肉西くんは指の数を増やしたり減らしたりできる.<br />肉西くんの前には <var>n</var> 個のまんじゅうがある.<br />肉西くんは指を折ってまんじゅうの個数を数えようとしている.<br />肉西くんの指が取れる形は折れているか折れていないかの <var>2</var> つしか無い.<br />肉西くんは <a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/bdh.html">...
0
0
27,219
s030400066
p01852
u285015144
1518705644
Python
Python3
py
Accepted
20
5580
71
N = int(input()) ans = 0 while(N): N //= 2 ans += 1 print(ans)
p01852
<h1 id="a-指折り数えて-finger-counting">A : 指折り数えて / Finger Counting</h1> <h2 id="問題文">問題文</h2> <p>肉西くんは指の数を増やしたり減らしたりできる.<br />肉西くんの前には <var>n</var> 個のまんじゅうがある.<br />肉西くんは指を折ってまんじゅうの個数を数えようとしている.<br />肉西くんの指が取れる形は折れているか折れていないかの <var>2</var> つしか無い.<br />肉西くんは <a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/bdh.html">...
0
0
27,220
s843422692
p01852
u099826363
1557396032
Python
Python3
py
Accepted
30
5584
237
# from sys import exit # A,B,C = [int(n) for n in input().split()] N = int(input()) # a = [int(input()) for _ in range(N)] # S = str(input()) # L = len(S) # T = str(input()) # exit() # print(bin(N)) print(len(bin(N))-2 if N > 0 else 0)
p01852
<h1 id="a-指折り数えて-finger-counting">A : 指折り数えて / Finger Counting</h1> <h2 id="問題文">問題文</h2> <p>肉西くんは指の数を増やしたり減らしたりできる.<br />肉西くんの前には <var>n</var> 個のまんじゅうがある.<br />肉西くんは指を折ってまんじゅうの個数を数えようとしている.<br />肉西くんの指が取れる形は折れているか折れていないかの <var>2</var> つしか無い.<br />肉西くんは <a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/bdh.html">...
0
0
27,221
s841927302
p01852
u352394527
1546730438
Python
Python3
py
Accepted
20
5580
52
n = int(input()) print(len(bin(n)) - 2 if n else 0)
p01852
<h1 id="a-指折り数えて-finger-counting">A : 指折り数えて / Finger Counting</h1> <h2 id="問題文">問題文</h2> <p>肉西くんは指の数を増やしたり減らしたりできる.<br />肉西くんの前には <var>n</var> 個のまんじゅうがある.<br />肉西くんは指を折ってまんじゅうの個数を数えようとしている.<br />肉西くんの指が取れる形は折れているか折れていないかの <var>2</var> つしか無い.<br />肉西くんは <a href="http://www.asahi-net.or.jp/~ax2s-kmtn/ref/bdh.html">...
0
0
27,222
s185390673
p01853
u885631908
1442814974
Python
Python3
py
Accepted
70
7656
175
#!/usr/bin/env python3 # -*- coding: utf-8 -*- n,m = map(int,input().split()) points = ["0"] * n for i in range(n//2 + 1, n): points[i] = str(m) print(" ".join(points))
p01853
<h1 id="b-平均値の嘘-lie-with-mean-value">B : 平均値の嘘 / Lie with Mean Value</h1> <h2 id="問題文">問題文</h2> <p>R 大学情報理工学部 <var>1</var> 回生の学生 <var>n</var> 人が, プログラミング演習 1 という講義の期末試験を受験する. 試験は <var>m</var> 点満点である.つまり,<var>1</var> 人の学生の取りうる点数は <var>0</var> 以上 <var>m</var> 以下の整数である.</p> <p>担当の先生は意地が悪いので,平均値と中央値の差が最大になるような点数分布が気になっ...
3 100
0 0 100
27,223
s334697923
p01853
u078042885
1482434610
Python
Python3
py
Accepted
20
7744
191
# -*- coding: utf-8 -*- (n,m)=[int(a) for a in input().split()] for i in range(n): if i:print(" ",end="") if i<=n/2: print("0",end="") else: print("{}".format(m),end="") print("")
p01853
<h1 id="b-平均値の嘘-lie-with-mean-value">B : 平均値の嘘 / Lie with Mean Value</h1> <h2 id="問題文">問題文</h2> <p>R 大学情報理工学部 <var>1</var> 回生の学生 <var>n</var> 人が, プログラミング演習 1 という講義の期末試験を受験する. 試験は <var>m</var> 点満点である.つまり,<var>1</var> 人の学生の取りうる点数は <var>0</var> 以上 <var>m</var> 以下の整数である.</p> <p>担当の先生は意地が悪いので,平均値と中央値の差が最大になるような点数分布が気になっ...
3 100
0 0 100
27,224
s811014486
p01853
u260980560
1501608767
Python
Python3
py
Accepted
20
7648
61
n,m=map(int,input().split());p=n//2+1;print(*[0]*p+[m]*(n-p))
p01853
<h1 id="b-平均値の嘘-lie-with-mean-value">B : 平均値の嘘 / Lie with Mean Value</h1> <h2 id="問題文">問題文</h2> <p>R 大学情報理工学部 <var>1</var> 回生の学生 <var>n</var> 人が, プログラミング演習 1 という講義の期末試験を受験する. 試験は <var>m</var> 点満点である.つまり,<var>1</var> 人の学生の取りうる点数は <var>0</var> 以上 <var>m</var> 以下の整数である.</p> <p>担当の先生は意地が悪いので,平均値と中央値の差が最大になるような点数分布が気になっ...
3 100
0 0 100
27,225
s330022724
p01853
u352394527
1546731305
Python
Python3
py
Accepted
30
5604
145
n, m = map(int, input().split()) if n % 2: print(*[0] * (n // 2) + [m] * (n // 2 + 1)) else: print(*[0] * (n // 2 - 1) + [m] * (n // 2 + 1))
p01853
<h1 id="b-平均値の嘘-lie-with-mean-value">B : 平均値の嘘 / Lie with Mean Value</h1> <h2 id="問題文">問題文</h2> <p>R 大学情報理工学部 <var>1</var> 回生の学生 <var>n</var> 人が, プログラミング演習 1 という講義の期末試験を受験する. 試験は <var>m</var> 点満点である.つまり,<var>1</var> 人の学生の取りうる点数は <var>0</var> 以上 <var>m</var> 以下の整数である.</p> <p>担当の先生は意地が悪いので,平均値と中央値の差が最大になるような点数分布が気になっ...
3 100
0 0 100
27,226
s772809959
p01855
u011621222
1527851046
Python
Python3
py
Accepted
60
5620
393
def gcd(a,b): if a == 0: return b else: return gcd(b%a,a) t = int(input()) while t: t -= 1 a,b = map(int, input().split()) c = gcd(a,b) a = a//c b = b//c if a == b: ans1 = 1 ans2 = 0 elif a % 2 == 0 or b % 2 == 0: ans1 = 1 ans2 = 1 ...
p01855
<h1 id="d-市松模様-checkered-pattern">D : 市松模様 / Checkered Pattern</h1> <h2 id="問題文">問題文</h2> <p>縦横の長さが <var>h, w</var> の長方形があり, 内部には一辺の長さが <var>1</var> の正方形のマスが敷き詰められている. 最も左上のマスを <var>(0,0)</var> とし, <var>(0,0)</var> の <var>i</var> 個下で <var>j</var> 個右のマスを <var>(i,j)</var> のように表すことにすると, <var>(i,j)</var> は <var>i+j</va...
3 2 3 3 3 4 3
1 1 1 0 1 1
27,227
s949780828
p01858
u633068244
1442972192
Python
Python
py
Accepted
10
6464
1,281
K = int(raw_input()) nakaji = isono = 0 for I, N in zip([raw_input() for i in xrange(K)], [raw_input() for i in xrange(K)]): lose1 = lose2 = False if I == "kougekida" and isono == 0: lose1 = True if N == "kougekida" and nakaji == 0: lose2 = True if lose1 and lose2: continue elif lose1: print...
p01858
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>A: 磯野、あれやろうぜ! - Sendame -</h2> <h3>物語</h3> <p>中島「磯野〜,あれやろうぜ!」</p> <p>磯野「あれって何だよ,中島」</p> <p>中島「ほら,あれだよ,あれ.なぜか文字で表さなきゃならないから,説明しづらいな〜」</p> <p>磯野「いや,図や写真も入れられるみたいだぞ?」</p> <img src="https://judgeapi.u-aizu...
3 tameru tameru tameru tameru kougekida tameru
Nakajima-kun
27,228
s835661099
p01858
u011621222
1527852860
Python
Python3
py
Accepted
20
5628
1,380
K = int(input()) Is = [input() for i in range(K)] Ns = [input() for i in range(K)] atk_I = 0 atk_N = 0 #"mamoru", "tameru", "kougekida" #"Isono-kun", "Nakajima-kun", "Hikiwake-kun" for i, n in zip(Is, Ns): i_n = [i, n] if (i_n.count("mamoru") == 2): pass elif (i_n.count("mamoru") == 1): if (i_n.count("tameru") =...
p01858
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>A: 磯野、あれやろうぜ! - Sendame -</h2> <h3>物語</h3> <p>中島「磯野〜,あれやろうぜ!」</p> <p>磯野「あれって何だよ,中島」</p> <p>中島「ほら,あれだよ,あれ.なぜか文字で表さなきゃならないから,説明しづらいな〜」</p> <p>磯野「いや,図や写真も入れられるみたいだぞ?」</p> <img src="https://judgeapi.u-aizu...
3 tameru tameru tameru tameru kougekida tameru
Nakajima-kun
27,229
s609752593
p01858
u352394527
1546740380
Python
Python3
py
Accepted
20
5616
1,456
k = int(input()) isono = [input() for _ in range(k)] nakajima = [input() for _ in range(k)] isono_power = 0 nakajima_power = 0 for isono_hand, nakajima_hand in zip(isono, nakajima): if isono_hand == "mamoru": if nakajima_hand == "mamoru":pass elif nakajima_hand == "tameru":nakajima_power = min(nakajima_power ...
p01858
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>A: 磯野、あれやろうぜ! - Sendame -</h2> <h3>物語</h3> <p>中島「磯野〜,あれやろうぜ!」</p> <p>磯野「あれって何だよ,中島」</p> <p>中島「ほら,あれだよ,あれ.なぜか文字で表さなきゃならないから,説明しづらいな〜」</p> <p>磯野「いや,図や写真も入れられるみたいだぞ?」</p> <img src="https://judgeapi.u-aizu...
3 tameru tameru tameru tameru kougekida tameru
Nakajima-kun
27,230
s925633685
p01859
u633068244
1442977140
Python
Python
py
Accepted
20
6444
930
def rec(li, ri, ln, rn, hand): if hand == 0: win = 1 if li < 5: if ln < 5: win = min(win, rec(li, ri, li + ln, rn, 1 - hand)) if rn < 5: win = min(win, rec(li, ri, ln, li + rn, 1 - hand)) if ri < 5: if ln < 5: win = min(win, rec(li, ri, ri + ln, rn, 1 - ha...
p01859
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>B: 中島、あれやろうぜ! - Match Peas War -</h2> <h3>問題</h3> <p>中島「うぅっ・・・」</p> <p>磯野「中島,大丈夫か?」</p> <p>中島「・・・なんだか嫌な夢を見ていた気がするよ」</p> <p>磯野「どんな夢だい?」</p> <p>中島「無限に遊ぶ夢」</p> <p>磯野「意味わからん.まぁいいや,中島,あれやろうぜ!」</p> <p>中島「あれ...
3 2 2 2
NAKAJIMA
27,231
s996136946
p01859
u352394527
1546750144
Python
Python3
py
Accepted
20
5608
1,204
li, ri = map(int, input().split()) ln, rn = map(int, input().split()) ISONO = True NAKAJIMA = False def search(li, ri, ln, rn, turn): if li == None and ri == None: return False if ln == None and rn == None: return True if turn == ISONO: ret = False if li and ln: ret = ret or search(li, ri,...
p01859
<!--<script language="JavaScript" type="text/javascript" src="js/varmath.js" charset="UTF-8"></script>--> <h2>B: 中島、あれやろうぜ! - Match Peas War -</h2> <h3>問題</h3> <p>中島「うぅっ・・・」</p> <p>磯野「中島,大丈夫か?」</p> <p>中島「・・・なんだか嫌な夢を見ていた気がするよ」</p> <p>磯野「どんな夢だい?」</p> <p>中島「無限に遊ぶ夢」</p> <p>磯野「意味わからん.まぁいいや,中島,あれやろうぜ!」</p> <p>中島「あれ...
3 2 2 2
NAKAJIMA
27,232
s741477995
p01865
u766163292
1457244130
Python
Python3
py
Accepted
70
7792
1,073
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def solve(l, n, jota_weights): jota_torque = sum(x * w for x, w in jota_weights) if jota_torque == 0: return (0, []) else: max_w = 50000 sign = -1 if jota_torque > 0 else 1 ritsuko_weights = [] ritsuko_counter = 0 ...
p01865
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>A: 秤 /...
3 3 1 1 2 1 3 1
1 -3 2
27,233
s485593797
p01865
u078042885
1486528161
Python
Python3
py
Accepted
20
7748
140
input() m=int(input()) s=sum(x*w for x,w in [map(int,input().split()) for _ in range(m)]) print('1\n%d %d'%([1,-1][s>0],abs(s)) if s else 0)
p01865
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>A: 秤 /...
3 3 1 1 2 1 3 1
1 -3 2
27,234
s804054812
p01865
u078042885
1486602099
Python
Python3
py
Accepted
20
7724
136
input() s=sum(x*w for x,w in [map(int,input().split()) for _ in range(int(input()))]) print('1\n%d %d'%([1,-1][s>0],abs(s)) if s else 0)
p01865
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>A: 秤 /...
3 3 1 1 2 1 3 1
1 -3 2
27,235
s176083042
p01865
u036236649
1490610387
Python
Python3
py
Accepted
30
7672
214
L = int(input()) N = int(input()) s = 0 for i in range(N): x, w = map(int, input().split()) s += x * w if(s == 0): print(0) elif(s < 0): print(1) print(1, -s) else: print(1) print(-1, s)
p01865
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>A: 秤 /...
3 3 1 1 2 1 3 1
1 -3 2
27,236
s973235896
p01865
u352394527
1546756948
Python
Python3
py
Accepted
20
5600
396
l = int(input()) n = int(input()) mom = 0 for _ in range(n): x, w = map(int, input().split()) mom += x * w weight = [] while mom: if mom < 0: add_weight = min(-mom, 50000) mom += add_weight weight.append((1, add_weight)) elif mom > 0: add_weight = min(mom, 50000) mom -= add_weight weigh...
p01865
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>A: 秤 /...
3 3 1 1 2 1 3 1
1 -3 2
27,237
s552655103
p01866
u369964672
1457242991
Python
Python3
py
Accepted
70
7700
383
# -*- coding: utf-8 -*- N = int(input()) X = input() D = int(input()) ans = list(X) done = [False] * N for i in range(N): if D == 0: break if ans[i] == "0": ans[i] = "1" done[i] = True D -= 1 for i in range(N)[::-1]: if D == 0: break if ans[i] == "1" and not do...
p01866
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>B: ハミン...
5 00001 3
11101
27,238
s111242203
p01866
u766163292
1457245462
Python
Python3
py
Accepted
50
7880
870
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array def num_string_to_array(num_string): return array.array("B", map(int, num_string)) def num_array_to_string(num_array): return "".join(map(str, num_array)) def solve(n, x, d): answer = x[:] rest_distance = d for i in range(n): ...
p01866
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>B: ハミン...
5 00001 3
11101
27,239
s828833949
p01866
u078042885
1486584517
Python
Python3
py
Accepted
30
7744
188
n=int(input()) x=input() d=int(input()) x=list(x) y=[1]*n for i in range(n): if d and x[i]=='0':y[i]=0;x[i]='1';d-=1 i=n-1 while d: if y[i]:x[i]='0';d-=1 i-=1 print(*x, sep='')
p01866
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>B: ハミン...
5 00001 3
11101
27,240
s547095050
p01866
u036236649
1490666356
Python
Python3
py
Accepted
30
7804
488
n = int(input()) bits_raw = input() bits = [int(bits_raw[i]) for i in range(n)] m = int(input()) ones = [] zeros = [] for i in range(n): if(bits[i] == 1): ones.append(i) else: zeros.append(i) if(len(zeros) > m): for i in range(m): bits[zeros[i]] = 1 print(''.join(map(str, bits)))...
p01866
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>B: ハミン...
5 00001 3
11101
27,241
s635163793
p01866
u352394527
1546757739
Python
Python3
py
Accepted
20
5656
332
n = int(input()) x = input() d = int(input()) swap = {} for i in range(n): if d == 0:break if x[i] == "0": swap[i] = True d -= 1 for i in range(n - 1, -1, -1): if d == 0:break if x[i] == "1": swap[i] = True d -= 1 print("".join([x[i] if i not in swap else ("0" if x[i] == "1" else "1") for i in ra...
p01866
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>B: ハミン...
5 00001 3
11101
27,242
s284280302
p01867
u529386725
1457361430
Python
Python3
py
Accepted
60
7808
337
# -*- coding: utf-8 -*- from collections import Counter N = input() S = input().split('+') dic_chr_num = Counter(S) dic_num_kind = Counter(dic_chr_num.values()) ans = 4 * len(dic_chr_num) - 1 for num, kind in dic_num_kind.items(): if num == 1: ans -= 2 * kind elif kind >= 2: ans -= 2 * (kind...
p01867
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>C: 足し...
5 a+a+a
3
27,243
s219053407
p01867
u078042885
1486532311
Python
Python3
py
Accepted
30
7564
150
input() s=input().split('+') t=[s.count(x) for x in set(s)] a=sum(min(3*t.count(x),t.count(x)+4) for x in set(t) if x!=1)+len(t)-1+t.count(1) print(a)
p01867
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>C: 足し...
5 a+a+a
3
27,244
s685789795
p01867
u078042885
1486532412
Python
Python3
py
Accepted
20
7560
146
input() s=input().split('+') t=[s.count(x) for x in set(s)] print(sum(min(3*t.count(x),t.count(x)+4) for x in set(t) if x!=1)+len(t)-1+t.count(1))
p01867
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>C: 足し...
5 a+a+a
3
27,245
s402466641
p01867
u036236649
1490679178
Python
Python3
py
Accepted
20
7588
492
input() s = input() cs = s.split("+") ns = [] ds = [] for c in cs: cont = False i = 0 for a in ds: if(a == c): cont = True ns[i] += 1 break i += 1 if(not cont): ds.append(c) ns.append(1) nums = [0 for i in range(9)] for n in ns: num...
p01867
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>C: 足し...
5 a+a+a
3
27,246
s128041492
p01867
u352394527
1546758737
Python
Python3
py
Accepted
30
5996
280
from collections import Counter n = int(input()) s = input() counter = Counter(s[0::2]) counter2 = Counter(counter.values()) ans = 0 for k, v in counter2.items(): if k == 1: ans += 2 * v else: if v == 1: ans += 4 else: ans += 4 + v * 2 print(ans - 1)
p01867
<!-- - - - - - begin nicebody - - - - - --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <h1>C: 足し...
5 a+a+a
3
27,247