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
s203786027
p00993
u633068244
1400316328
Python
Python
py
Accepted
20
4336
82
print reduce(lambda x,y: x*y, range(1,1501))+2 for i in range(2,input()+2):print i
p00993
<H1>Problem D : Numbers </H1> <p> <i>n</i> が与えられるので、<i>n</i> 個の連続した正の整数を求めよ。 ただしすべての数が、1とその数自身以外の約数をもたなくてはならない。 </p> <H2>Input</H2> <p> 入力は以下のフォーマットで与えられる。 </p> <pre> <i>n</i> </pre> <p> 入力は以下の制約を満たす。<br> 1 &le; <i>n</i> &le; 1,500 </p> <h2>Output</h2> <p> 最初の行に、あなたが選んだ連続した<i>n</i> 個の正の整数の中で一番小さいものを出力せよ。<br> 2行目...
2
8 2 3
25,238
s885444156
p00993
u352394527
1545165249
Python
Python3
py
Accepted
20
8356
231
import sys sys.setrecursionlimit(1000000) memo = {0:1} def fact(num): if num in memo:return memo[num] memo[num] = num * fact(num - 1) return memo[num] n = int(input()) print(fact(n + 1) + 2) for i in range(n): print(i + 2)
p00993
<H1>Problem D : Numbers </H1> <p> <i>n</i> が与えられるので、<i>n</i> 個の連続した正の整数を求めよ。 ただしすべての数が、1とその数自身以外の約数をもたなくてはならない。 </p> <H2>Input</H2> <p> 入力は以下のフォーマットで与えられる。 </p> <pre> <i>n</i> </pre> <p> 入力は以下の制約を満たす。<br> 1 &le; <i>n</i> &le; 1,500 </p> <h2>Output</h2> <p> 最初の行に、あなたが選んだ連続した<i>n</i> 個の正の整数の中で一番小さいものを出力せよ。<br> 2行目...
2
8 2 3
25,239
s483563644
p00993
u539753516
1532619217
Python
Python3
py
Accepted
20
5804
92
import math n=int(input()) print(math.factorial(n+1)+2) for i in range(2,n+2): print(i)
p00993
<H1>Problem D : Numbers </H1> <p> <i>n</i> が与えられるので、<i>n</i> 個の連続した正の整数を求めよ。 ただしすべての数が、1とその数自身以外の約数をもたなくてはならない。 </p> <H2>Input</H2> <p> 入力は以下のフォーマットで与えられる。 </p> <pre> <i>n</i> </pre> <p> 入力は以下の制約を満たす。<br> 1 &le; <i>n</i> &le; 1,500 </p> <h2>Output</h2> <p> 最初の行に、あなたが選んだ連続した<i>n</i> 個の正の整数の中で一番小さいものを出力せよ。<br> 2行目...
2
8 2 3
25,240
s014493467
p00999
u847467233
1531455261
Python
Python3
py
Accepted
20
5596
393
# AOJ 1509 Rental DVD Shop NEO # Python3 2018.7.13 bal4u while True: a, b, c, d, e = map(int, input().split()) if a == 0: break na, nb, nc = map(int, input().split()) if nc >= d: ans = e*nc + b*nb + a*na else: ans = c*nc + b*nb + a*na k = d-nc; if k <= nb: nb -= k; k = 0 else: k -= nb; nb = 0 if k <= na...
p00999
<h1>Problem A: Rental DVD Shop NEO</h1> <h2>Problem</h2> <p> 僕はレンタルDVDショップ、「NEO」でアルバイトを始めた。まずはこの店の料金システムを勉強することになった。 </p> <p> レンタルDVDは旧作、準新作、新作の3種類存在し、1本のレンタル料金がそれぞれ<var> a </var>円、<var> b </var>円、<var> c </var>円である。 会計の際に以下に示すセットレンタルを複数回適用することができる。 </p> <ul> <li>まだセットレンタルを適用していないDVDを数本選ぶ。</li> <li>選んだDVDの本数が<var> d...
70 100 340 4 200 1 1 4 70 100 340 4 200 0 1 3 70 100 340 4 200 1 1 2 0 0 0 0 0
970 800 800
25,241
s569860163
p00999
u266872031
1439257997
Python
Python
py
Accepted
20
4240
485
while(1): [a,b,c,d,e]=[int(x) for x in raw_input().split()] if a==0: break else: [na,nb,nc]=[int(x) for x in raw_input().split()] if nc>=d: price=nc*e+nb*b+na*a else: if nb>=d-nc: price=min(d*e+(nb+nc-d)*b+na*a,nc*c+nb*b+na*a) ...
p00999
<h1>Problem A: Rental DVD Shop NEO</h1> <h2>Problem</h2> <p> 僕はレンタルDVDショップ、「NEO」でアルバイトを始めた。まずはこの店の料金システムを勉強することになった。 </p> <p> レンタルDVDは旧作、準新作、新作の3種類存在し、1本のレンタル料金がそれぞれ<var> a </var>円、<var> b </var>円、<var> c </var>円である。 会計の際に以下に示すセットレンタルを複数回適用することができる。 </p> <ul> <li>まだセットレンタルを適用していないDVDを数本選ぶ。</li> <li>選んだDVDの本数が<var> d...
70 100 340 4 200 1 1 4 70 100 340 4 200 0 1 3 70 100 340 4 200 1 1 2 0 0 0 0 0
970 800 800
25,242
s261236753
p00999
u332822187
1444899967
Python
Python
py
Accepted
30
6452
893
while True: a,b,c,d,e = map(int,raw_input().split()) if a==0: break na,nb,nc = map(int,raw_input().split()) t=na+nb+nc ans=na*a+nb*b+nc*c if t < d: if ans > d*e: ans=d*e else: tmp = 0 dd=d cnt=0 if dd>=nc: cnt+=nc*c dd-=nc else: cnt+=dd*c dd=0 if dd>=nb: cnt+=nb*b dd-=nb e...
p00999
<h1>Problem A: Rental DVD Shop NEO</h1> <h2>Problem</h2> <p> 僕はレンタルDVDショップ、「NEO」でアルバイトを始めた。まずはこの店の料金システムを勉強することになった。 </p> <p> レンタルDVDは旧作、準新作、新作の3種類存在し、1本のレンタル料金がそれぞれ<var> a </var>円、<var> b </var>円、<var> c </var>円である。 会計の際に以下に示すセットレンタルを複数回適用することができる。 </p> <ul> <li>まだセットレンタルを適用していないDVDを数本選ぶ。</li> <li>選んだDVDの本数が<var> d...
70 100 340 4 200 1 1 4 70 100 340 4 200 0 1 3 70 100 340 4 200 1 1 2 0 0 0 0 0
970 800 800
25,243
s771239935
p00999
u633068244
1400245702
Python
Python
py
Accepted
20
4228
334
while 1: a,b,c,d,e = map(int,raw_input().split()) if a == 0: break na,nb,nc = map(int,raw_input().split()) ans = a*na + b*nb + c*nc if nc >= d: ans = a*na + b*nb +e*nc else: nd = d; d -= nc t = nb if nb < d else d nb -= t; d -= t t = na if na < d else d na -= t; d -= t ans = min(ans,a*na + b*nb + e*...
p00999
<h1>Problem A: Rental DVD Shop NEO</h1> <h2>Problem</h2> <p> 僕はレンタルDVDショップ、「NEO」でアルバイトを始めた。まずはこの店の料金システムを勉強することになった。 </p> <p> レンタルDVDは旧作、準新作、新作の3種類存在し、1本のレンタル料金がそれぞれ<var> a </var>円、<var> b </var>円、<var> c </var>円である。 会計の際に以下に示すセットレンタルを複数回適用することができる。 </p> <ul> <li>まだセットレンタルを適用していないDVDを数本選ぶ。</li> <li>選んだDVDの本数が<var> d...
70 100 340 4 200 1 1 4 70 100 340 4 200 0 1 3 70 100 340 4 200 1 1 2 0 0 0 0 0
970 800 800
25,244
s830720991
p00999
u633068244
1400245904
Python
Python
py
Accepted
20
4228
314
while 1: a,b,c,d,e = map(int,raw_input().split()) if a == 0: break na,nb,nc = map(int,raw_input().split()) ans = a*na + b*nb + c*nc if nc >= d: ans = a*na + b*nb +e*nc else: nd = d; d -= nc t = min(nb,d) nb -= t; d -= t t = min(na,d) na -= t; d -= t ans = min(ans,a*na + b*nb + e*nd) print ans
p00999
<h1>Problem A: Rental DVD Shop NEO</h1> <h2>Problem</h2> <p> 僕はレンタルDVDショップ、「NEO」でアルバイトを始めた。まずはこの店の料金システムを勉強することになった。 </p> <p> レンタルDVDは旧作、準新作、新作の3種類存在し、1本のレンタル料金がそれぞれ<var> a </var>円、<var> b </var>円、<var> c </var>円である。 会計の際に以下に示すセットレンタルを複数回適用することができる。 </p> <ul> <li>まだセットレンタルを適用していないDVDを数本選ぶ。</li> <li>選んだDVDの本数が<var> d...
70 100 340 4 200 1 1 4 70 100 340 4 200 0 1 3 70 100 340 4 200 1 1 2 0 0 0 0 0
970 800 800
25,245
s416370112
p01012
u971272427
1529825974
Python
Python3
py
Accepted
20
5620
186
m,n,x=[int(i) for i in input().split()] k,l,y=[int(i) for i in input().split()] res=0.5*(1.0+((m**2+n**2)**x)/((m+n)**(2*x))) res*=0.5*(1.0+((k**2+l**2)**y)/((k+l)**(2*y))) print(res)
p01012
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1>Planarian Regeneration</h1> <h2>Problem</h2> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE3_ACPC2013Aizu_aizuicpc_planarian" width="250"><br/> <p> 皆さん、「プラナリア」って知っていますか?<br/> プラナリアとは、日本では川の上流の石や枯葉などの裏に張り付いて生息している水生生物です。<br/> プラナリアの最も優れた能...
1 1 1 1 1 1
0.562500
25,252
s430269103
p01012
u905303767
1529834472
Python
Python3
py
Accepted
20
5620
187
m,n,x=[int(i) for i in input().split()] k,l,y=[int(i) for i in input().split()] res=0.5*(1.0+((m**2+n**2)**x)/((m+n)**(2*x))) res*=0.5*(1.0+((k**2+l**2)**y)/((k+l)**(2*y))) print(res)
p01012
<script src="./IMAGE/varmath.js" charset="UTF-8"></script> <h1>Planarian Regeneration</h1> <h2>Problem</h2> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE3_ACPC2013Aizu_aizuicpc_planarian" width="250"><br/> <p> 皆さん、「プラナリア」って知っていますか?<br/> プラナリアとは、日本では川の上流の石や枯葉などの裏に張り付いて生息している水生生物です。<br/> プラナリアの最も優れた能...
1 1 1 1 1 1
0.562500
25,253
s150852984
p01016
u855694108
1577757452
Python
Python3
py
Accepted
20
5560
334
a = input() b = input() for i in range(len(a) - len(b) + 1): f = True for j in range(len(b)): if a[i+j] == b[j]: pass else: if b[j] == '_': pass else: f = False break if f: print('Yes') exit(...
p01016
<h1>Problem A: Password</h1> <p> 太郎君は、自分のパソコンを持っていて、ログイン時のパスワードを設定していた。しかし、不注意にも太郎君はそのパスワードを忘れてしまった。そこで、パスワードをメモした紙があることを思い出し、紙を見つけた太郎君はそれを見て驚いた。なんと紙は切れていて断片しか存在せず、ところどころに汚れがあり、読めなくなっていたのだ。太郎君はそのメモを参考にパスワードを推測することにした。 </p> <h2>Problem</h2> <p> 二つの文字列A, Bが与えられる。文字列Aの中に文字列Bが含まれているかどうかを判定し、含まれている場合は"Yes"を、そうでなければ"No"を出力...
ABCDE ABC
Yes
25,254
s222132846
p01016
u759934006
1548336476
Python
Python3
py
Accepted
40
6620
121
import re A = input() B = input() B = B.replace('_', '.') if re.search(B, A): print('Yes') else: print('No')
p01016
<h1>Problem A: Password</h1> <p> 太郎君は、自分のパソコンを持っていて、ログイン時のパスワードを設定していた。しかし、不注意にも太郎君はそのパスワードを忘れてしまった。そこで、パスワードをメモした紙があることを思い出し、紙を見つけた太郎君はそれを見て驚いた。なんと紙は切れていて断片しか存在せず、ところどころに汚れがあり、読めなくなっていたのだ。太郎君はそのメモを参考にパスワードを推測することにした。 </p> <h2>Problem</h2> <p> 二つの文字列A, Bが与えられる。文字列Aの中に文字列Bが含まれているかどうかを判定し、含まれている場合は"Yes"を、そうでなければ"No"を出力...
ABCDE ABC
Yes
25,255
s049144437
p01016
u352394527
1547561412
Python
Python3
py
Accepted
20
5568
329
a = input() b = input() length_a = len(a) length_b = len(b) def check(): for i in range(length_a - length_b + 1): for j in range(length_b): if b[j] == "_" or a[i + j] == b[j]:continue else:break else: print("Yes") return print("No") return ...
p01016
<h1>Problem A: Password</h1> <p> 太郎君は、自分のパソコンを持っていて、ログイン時のパスワードを設定していた。しかし、不注意にも太郎君はそのパスワードを忘れてしまった。そこで、パスワードをメモした紙があることを思い出し、紙を見つけた太郎君はそれを見て驚いた。なんと紙は切れていて断片しか存在せず、ところどころに汚れがあり、読めなくなっていたのだ。太郎君はそのメモを参考にパスワードを推測することにした。 </p> <h2>Problem</h2> <p> 二つの文字列A, Bが与えられる。文字列Aの中に文字列Bが含まれているかどうかを判定し、含まれている場合は"Yes"を、そうでなければ"No"を出力...
ABCDE ABC
Yes
25,256
s208916989
p01017
u352394527
1547565530
Python
Python3
py
Accepted
20
5720
599
H, W = map(int, input().split()) a_mp = [list(map(int, input().split())) for _ in range(H)] b_mp = [list(map(int, input().split())) for _ in range(H)] h, w = map(int, input().split()) c_mp = [list(map(int, input().split())) for _ in range(h)] INF = 10 ** 20 def check(x, y): ret = 0 for dy in range(h): for dx ...
p01017
<h1>Problem B: Yu-kun Likes Rectangles</h1> <h2>Background</h2> <p> 会津大学付属幼稚園はプログラミングが大好きな子供が集まる幼稚園である。園児の一人であるゆう君は、プログラミングと同じくらい長方形が大好きだ。そんなゆう君は3つの長方形を使って得点を得る新たな遊びを考え、得られる最大の得点を計算するためのプログラムを書くことにした。 </p> <h2>Problem</h2> <p> <var>H</var> <var>×</var> <var>W</var> マスの長方形 A , B と<var>h</var> <var>×</var> <var>w</var...
4 4 10 2 -1 6 8 1 -100 41 22 47 32 11 -41 99 12 -8 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 2 3 1 0 1 0 1 0
193
25,257
s644582585
p01019
u352394527
1547569128
Python
Python3
py
Accepted
40
6288
2,232
dic = {((0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 4), (2, 0), (2, 1), (2, 2), (2, 3), (2, 4)):"0", ((0, 0), (0, 1), (0, 2), (0, 3), (0, 4)):"1", ((0, 0), (0, 2), (0, 3), (0, 4), (1, 0), (1, 2), (1, 4), (2, 0), (2, 1), (2, 2), (2, 4)):"2", ((0, 0), (0, 2)...
p01019
<h1>Problem D: Cheat Case</h1> <h2>Problem</h2> <p> 算数のテストを受けることになった俺達は、今から勉強しても赤点を取ってしまうことを確信し、カンニングで乗り切ることを決意した。 </p> <p> 算数のテスト問題を作成するA先生はテスト用紙を手書きで作ることで知られている。彼がテスト問題を作成している時の筆跡情報を、近所の博士に作ってもらった筆跡盗聴鉛筆で盗み取る作戦だ。だが肝心の筆跡情報から問題を復元するプログラムは博士の技術では作ることができなかった。しかも、たとえ問題が復元できたとしても、俺達の頭脳では問題を解くことができない。どうすることもできなくなった俺達は、プログ...
4 1 1 1 5 3 3 5 3 4 2 4 4 7 1 7 5
2
25,258
s286878012
p01028
u352394527
1547619741
Python
Python3
py
Accepted
20
5644
344
from itertools import combinations_with_replacement as cwr n, m = map(int, input().split()) c_lst = list(map(int, input().split())) for t in cwr((0, 1, 2, 3, 4, 5, 6, 7, 8, 9), n): out = "" cost = 0 for n in t: cost += c_lst[n] out += str(n) if cost <= m: print(out) brea...
p01028
<h1>Problem A: Yu-kun Likes an Integer</h1> <h2>Background</h2> <p> 会津大学付属幼稚園はプログラミングが大好きな子供が集まる幼稚園である。園児の一人であるゆう君は、プログラミングと同じくらい数字が大好きだ。そんなゆう君は最近、表に0から9までのいずれかの数字の書かかれたプレートを<var>n</var>枚購入して<var>n</var>桁の数を作る遊びに熱中している。 今月もゆう君は貰ったお小遣いで<var>n</var>枚のプレートを買いに行こうと考えていた。 </p> <h2>Problem</h2> <p> プレートは表に書かれている数字によって値段が異なる...
1 10 1 2 3 4 5 6 7 8 9 10
0
25,259
s167634789
p01036
u878783752
1558176615
Python
Python3
py
Accepted
30
5764
2,808
# 参考 http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3277276#1 from math import acos, hypot, isclose, sqrt def intersection(circle, polygon): # 円と多角形の共通部分の面積 # 多角形の点が反時計回りで与えられれば正の値、時計回りなら負の値を返す x, y, r = circle polygon = [(xp-x, yp-y) for xp, yp in polygon] area = 0.0 for p1, p2 in zip(po...
p01036
<h1>Problem J: Yu-kun Likes To Play Darts</h1> <h2>Background</h2> <p> 会津大学付属幼稚園はプログラミングが大好きな子供が集まる幼稚園である。園児の一人であるゆう君は、プログラミングと同じくらいダーツが大好きだ。 そんなゆう君は最近ダーツにはまっていたが、普通のダーツに飽きてしまったため独自のダーツボードを作ることにした。 </p> <p> ダーツについては<a href="http://ja.wikipedia.org/wiki/ダーツ">ダーツ</a>を参照。 </p> <h2>Problem</h2> <p> ゆう君が考えたダーツの内容は以下の通りだ。 ...
1 2 2 1 4 1 0 0 2 0 2 2 0 2
0.2500000000
25,260
s311276202
p01037
u878783752
1557637165
Python
Python3
py
Accepted
20
5612
674
N, M = map(int, input().split()) L = [0]*(N*2) for i in range(M): a, l = map(int, input().split()) for ll in range(a, a+l): L[ll] = 1 for i in range(N, 2*N): L[i-N] = max(L[i-N], L[i]) #print(L) left = 0 i = 0 while L[i]==1: left += 1 i += 1 if i==N: print(N, 1) exit() ...
p01037
<h1>Problem A: A White Wall</h1> <h2>Background</h2> <p> とある都市に住むA氏の家の敷地は、真っ白な壁に囲まれている。壁に物足りなさを感じたA氏は、近所の子供たちを呼んで、壁を自由に塗ってもらうことにした。子供達にはそれぞれ壁の好きな区間を選んで色を塗ってもらう。 さて、壁はどのように塗られただろうか。 </p> <h2>Problem</h2> <p> 0〜<var>N</var>-1の区画で構成される以下のような円型の白い壁がある。 </p> <br> <left> <img width="480" src="https://judgeapi.u-aizu....
5 3 0 1 2 1 3 1
2 1 1 1
25,261
s489697561
p01048
u847467233
1531475193
Python
Python3
py
Accepted
20
5592
129
# AOJ 1562: Divisor # Python3 2018.7.13 bal4u ans = [0, 1, 2, 4, 6, 16, 12, 64, 24, 36, 48, 1024, 60] print(ans[int(input())])
p01048
<h1>Divisor</h1> <h2>Problem</h2> <p> 12以下の自然数 <var>N</var> が与えられるので、約数の個数がちょうど <var>N</var> 個であるような最小の自然数を求めよ。 </p> <h2>Input</h2> <p> 1つの自然数 <var>N</var> が 1 行で与えられる。 </p> <h2>Constraints</h2> <ul> <li>1 &le; <var>N</var> &le; 12</li> </ul> <h2>Output</h2> <p> 約数の個数がちょうど <var>N</var> 個であるような最小の自然数を1行に出力せよ。 </p...
1
1
25,262
s302272958
p01048
u283783177
1442887414
Python
Python3
py
Accepted
70
7668
252
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def f(n): ret = 0 for a in range(1, n+1): if n % a == 0: ret += 1 return ret N = int(input()) n = 1 while True: if f(n) == N: print(n) break n += 1
p01048
<h1>Divisor</h1> <h2>Problem</h2> <p> 12以下の自然数 <var>N</var> が与えられるので、約数の個数がちょうど <var>N</var> 個であるような最小の自然数を求めよ。 </p> <h2>Input</h2> <p> 1つの自然数 <var>N</var> が 1 行で与えられる。 </p> <h2>Constraints</h2> <ul> <li>1 &le; <var>N</var> &le; 12</li> </ul> <h2>Output</h2> <p> 約数の個数がちょうど <var>N</var> 個であるような最小の自然数を1行に出力せよ。 </p...
1
1
25,263
s465144320
p01048
u885631908
1442947029
Python
Python3
py
Accepted
100
7640
355
#!/usr/bin/env python3 # -*- coding: utf-8 -*- n = int(input()) i = 1 num = [0] * 13 while True: cnt = 0 for j in range(1, i+1): if i % j == 0: cnt += 1 if cnt > 12: i += 1 continue if num[cnt] == 0: num[cnt] = i if num[n] > 0: ans = num[n] ...
p01048
<h1>Divisor</h1> <h2>Problem</h2> <p> 12以下の自然数 <var>N</var> が与えられるので、約数の個数がちょうど <var>N</var> 個であるような最小の自然数を求めよ。 </p> <h2>Input</h2> <p> 1つの自然数 <var>N</var> が 1 行で与えられる。 </p> <h2>Constraints</h2> <ul> <li>1 &le; <var>N</var> &le; 12</li> </ul> <h2>Output</h2> <p> 約数の個数がちょうど <var>N</var> 個であるような最小の自然数を1行に出力せよ。 </p...
1
1
25,264
s299324768
p01048
u075836834
1459267761
Python
Python3
py
Accepted
70
7764
202
def solve(n): for i in range(1,10000): cnt=0 for j in range(1,i+1): if i%j==0: cnt+=1 if cnt==n: return(i) while True: try: n=int(input()) print(solve(n)) except EOFError: break
p01048
<h1>Divisor</h1> <h2>Problem</h2> <p> 12以下の自然数 <var>N</var> が与えられるので、約数の個数がちょうど <var>N</var> 個であるような最小の自然数を求めよ。 </p> <h2>Input</h2> <p> 1つの自然数 <var>N</var> が 1 行で与えられる。 </p> <h2>Constraints</h2> <ul> <li>1 &le; <var>N</var> &le; 12</li> </ul> <h2>Output</h2> <p> 約数の個数がちょうど <var>N</var> 個であるような最小の自然数を1行に出力せよ。 </p...
1
1
25,265
s422208666
p01048
u116766943
1509552389
Python
Python3
py
Accepted
60
7688
58
print([1,2,4,6,16,12,64,24,36,48,1024,60][int(input())-1])
p01048
<h1>Divisor</h1> <h2>Problem</h2> <p> 12以下の自然数 <var>N</var> が与えられるので、約数の個数がちょうど <var>N</var> 個であるような最小の自然数を求めよ。 </p> <h2>Input</h2> <p> 1つの自然数 <var>N</var> が 1 行で与えられる。 </p> <h2>Constraints</h2> <ul> <li>1 &le; <var>N</var> &le; 12</li> </ul> <h2>Output</h2> <p> 約数の個数がちょうど <var>N</var> 個であるような最小の自然数を1行に出力せよ。 </p...
1
1
25,266
s307871973
p01048
u724548524
1526735291
Python
Python3
py
Accepted
20
5592
59
print([0,1,2,4,6,16,12,64,24,36,48,1024,60][int(input())])
p01048
<h1>Divisor</h1> <h2>Problem</h2> <p> 12以下の自然数 <var>N</var> が与えられるので、約数の個数がちょうど <var>N</var> 個であるような最小の自然数を求めよ。 </p> <h2>Input</h2> <p> 1つの自然数 <var>N</var> が 1 行で与えられる。 </p> <h2>Constraints</h2> <ul> <li>1 &le; <var>N</var> &le; 12</li> </ul> <h2>Output</h2> <p> 約数の個数がちょうど <var>N</var> 個であるような最小の自然数を1行に出力せよ。 </p...
1
1
25,267
s637517730
p01048
u997314882
1549173207
Python
Python3
py
Accepted
70
5592
210
N = int(input()) target = 1 while True: count = 0 for i in range(1, target+1): if target % i == 0: count += 1 if count == N: print(target) break target += 1
p01048
<h1>Divisor</h1> <h2>Problem</h2> <p> 12以下の自然数 <var>N</var> が与えられるので、約数の個数がちょうど <var>N</var> 個であるような最小の自然数を求めよ。 </p> <h2>Input</h2> <p> 1つの自然数 <var>N</var> が 1 行で与えられる。 </p> <h2>Constraints</h2> <ul> <li>1 &le; <var>N</var> &le; 12</li> </ul> <h2>Output</h2> <p> 約数の個数がちょうど <var>N</var> 個であるような最小の自然数を1行に出力せよ。 </p...
1
1
25,268
s591666102
p01049
u847467233
1531475895
Python
Python3
py
Accepted
30
5600
411
# AOJ 1563: Array Update # Python3 2018.7.13 bal4u def get(id): global a, d if id in dic: ans = dic[id] else: ans = a + (id-1)*d; return ans dic = {} N = int(input()) a, d = map(int, input().split()) M = int(input()) for i in range(M): x, y, z = map(int, input().split()) if x == 0: vy, vz = get(y), get(z) d...
p01049
<h1>Array Update</h1> <h2>Problem</h2> <p> 項数 <var>N</var>、初項 <var>a</var>、公差 <var>d</var> の等差数列 <var>A</var> がある。以下の形式で数列を更新する命令文が <var>M</var> 個与えられるので、与えられた順序で数列 <var>A</var> を <var>M</var> 回更新したときの <var>K</var> 項目の値を求めよ。 </p> <ul> <li> <var>i</var> 番目の命令文は3つの整数 <var> x<sub>i</sub> , y<sub>i</sub> , z<sub>i</...
5 2 3 3 0 2 5 0 3 5 1 2 4 2
11
25,269
s501233489
p01049
u283783177
1442887991
Python
Python3
py
Accepted
70
7724
666
#!/usr/bin/env python3 # -*- coding: utf-8 -*- N = int(input()) a, d = map(int, input().split()) M = int(input()) data = {} def get_i(data, i): if i in data: return data[i] else: return a + d * i def data_swap(y, z, data): tmp = get_i(data, y) data[y] = get_i(data, z) data[z] = tm...
p01049
<h1>Array Update</h1> <h2>Problem</h2> <p> 項数 <var>N</var>、初項 <var>a</var>、公差 <var>d</var> の等差数列 <var>A</var> がある。以下の形式で数列を更新する命令文が <var>M</var> 個与えられるので、与えられた順序で数列 <var>A</var> を <var>M</var> 回更新したときの <var>K</var> 項目の値を求めよ。 </p> <ul> <li> <var>i</var> 番目の命令文は3つの整数 <var> x<sub>i</sub> , y<sub>i</sub> , z<sub>i</...
5 2 3 3 0 2 5 0 3 5 1 2 4 2
11
25,270
s002442316
p01049
u885631908
1442948795
Python
Python3
py
Accepted
50
7752
926
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #B n = int(input()) a,d = map(int,input().split()) A = [] m = int(input()) x = [0] * m y = [0] * m z = [0] * m NumOfTerms = [] for i in range(m): x[i],y[i],z[i] = map(int,input().split()) NumOfTerms.append(y[i]) NumOfTerms.append(z[i]) num = set(NumOfTerms) ...
p01049
<h1>Array Update</h1> <h2>Problem</h2> <p> 項数 <var>N</var>、初項 <var>a</var>、公差 <var>d</var> の等差数列 <var>A</var> がある。以下の形式で数列を更新する命令文が <var>M</var> 個与えられるので、与えられた順序で数列 <var>A</var> を <var>M</var> 回更新したときの <var>K</var> 項目の値を求めよ。 </p> <ul> <li> <var>i</var> 番目の命令文は3つの整数 <var> x<sub>i</sub> , y<sub>i</sub> , z<sub>i</...
5 2 3 3 0 2 5 0 3 5 1 2 4 2
11
25,271
s503098130
p01049
u724548524
1526736131
Python
Python3
py
Accepted
20
5604
326
input() a, d = map(int, input().split()) x = [tuple(map(int, input().split())) for _ in range(int(input()))] k = int(input()) for i in x[::-1]: if i[0] == 1: if i[1] == k: k = i[2] else: if i[1] == k: k = i[2] elif i[2] == k: k = i[1] print(a + d * (k ...
p01049
<h1>Array Update</h1> <h2>Problem</h2> <p> 項数 <var>N</var>、初項 <var>a</var>、公差 <var>d</var> の等差数列 <var>A</var> がある。以下の形式で数列を更新する命令文が <var>M</var> 個与えられるので、与えられた順序で数列 <var>A</var> を <var>M</var> 回更新したときの <var>K</var> 項目の値を求めよ。 </p> <ul> <li> <var>i</var> 番目の命令文は3つの整数 <var> x<sub>i</sub> , y<sub>i</sub> , z<sub>i</...
5 2 3 3 0 2 5 0 3 5 1 2 4 2
11
25,272
s338645519
p01049
u997314882
1549173778
Python
Python3
py
Accepted
30
6024
686
# coding:utf-8 import sys from collections import Counter, defaultdict INF = float('inf') 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 LS(): return sys.stdin.readline().split() def II(): return int(sys.stdin...
p01049
<h1>Array Update</h1> <h2>Problem</h2> <p> 項数 <var>N</var>、初項 <var>a</var>、公差 <var>d</var> の等差数列 <var>A</var> がある。以下の形式で数列を更新する命令文が <var>M</var> 個与えられるので、与えられた順序で数列 <var>A</var> を <var>M</var> 回更新したときの <var>K</var> 項目の値を求めよ。 </p> <ul> <li> <var>i</var> 番目の命令文は3つの整数 <var> x<sub>i</sub> , y<sub>i</sub> , z<sub>i</...
5 2 3 3 0 2 5 0 3 5 1 2 4 2
11
25,273
s274357741
p01049
u352394527
1547660135
Python
Python3
py
Accepted
30
5600
388
n = int(input()) a, d = map(int, input().split()) mem = {} def get_mem(num): if num in mem:return mem[num] else:return num m = int(input()) for _ in range(m): x, y, z = map(int, input().split()) if x == 0: ny, nz = get_mem(y), get_mem(z) mem[y] = nz mem[z] = ny if x == 1: nz = get_mem(...
p01049
<h1>Array Update</h1> <h2>Problem</h2> <p> 項数 <var>N</var>、初項 <var>a</var>、公差 <var>d</var> の等差数列 <var>A</var> がある。以下の形式で数列を更新する命令文が <var>M</var> 個与えられるので、与えられた順序で数列 <var>A</var> を <var>M</var> 回更新したときの <var>K</var> 項目の値を求めよ。 </p> <ul> <li> <var>i</var> 番目の命令文は3つの整数 <var> x<sub>i</sub> , y<sub>i</sub> , z<sub>i</...
5 2 3 3 0 2 5 0 3 5 1 2 4 2
11
25,274
s690941901
p01050
u847467233
1531480591
Python
Python3
py
Accepted
20
5568
567
# AOJ 1564: String Compression # Python3 2018.7.13 bal4u f = [0]*128 ch0, ch9n, cha, chzn = ord('0'), ord('9')+1, ord('a'), ord('z')+1 def act(start, end, n): while True: for i in range(start, end): if f[i] == 0: continue f[i] -= 1; S.append(i) n -= 1 if n <= 0: return S = list(input()) w = len(S) for...
p01050
<h1>String Compression</h1> <h2>Problem</h2> <p> アルファベットの小文字と数字からなる文字列 <var>S</var> が与えられる。次の手順で文字列 <var>S</var> の長さを圧縮する。 </p> <ol> <li>文字列内の文字の順番を任意の順番に入れ替える。<br> 例: "0ig3he12fz99" &rarr; "efghiz012399"</li> <li>次の操作を任意の回数行う。</li> </ol> <ul style="margin: 0 0 0 2em"> <li>文字列内にある、"abcdefghijklmnopqrstuvwxyz"の連続し...
0ig3he12fz99
9
25,275
s845781003
p01050
u283783177
1442889240
Python
Python3
py
Accepted
30
7812
393
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import defaultdict S = input() S = sorted(S) S = list(map(ord, S)) ans = 0 while len(S) > 0: mn = S[0] S.remove(mn) nxt = mn + 1 succ = 1 while True: if nxt in S: S.remove(nxt) succ += 1 nx...
p01050
<h1>String Compression</h1> <h2>Problem</h2> <p> アルファベットの小文字と数字からなる文字列 <var>S</var> が与えられる。次の手順で文字列 <var>S</var> の長さを圧縮する。 </p> <ol> <li>文字列内の文字の順番を任意の順番に入れ替える。<br> 例: "0ig3he12fz99" &rarr; "efghiz012399"</li> <li>次の操作を任意の回数行う。</li> </ol> <ul style="margin: 0 0 0 2em"> <li>文字列内にある、"abcdefghijklmnopqrstuvwxyz"の連続し...
0ig3he12fz99
9
25,276
s805938970
p01050
u885631908
1442952772
Python
Python3
py
Accepted
70
7556
1,405
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #C s = list(input()) abc = list("-abcdefghijklmnopqrstuvwxyz-") num = list("-0123456789-") abc_cnt = [0]*28 num_cnt = [0]*12 for i in range(len(s)): for j in range(1,27): if s[i] == abc[j]: abc_cnt[j] += 1 for i in range(len(s)): for j in rang...
p01050
<h1>String Compression</h1> <h2>Problem</h2> <p> アルファベットの小文字と数字からなる文字列 <var>S</var> が与えられる。次の手順で文字列 <var>S</var> の長さを圧縮する。 </p> <ol> <li>文字列内の文字の順番を任意の順番に入れ替える。<br> 例: "0ig3he12fz99" &rarr; "efghiz012399"</li> <li>次の操作を任意の回数行う。</li> </ol> <ul style="margin: 0 0 0 2em"> <li>文字列内にある、"abcdefghijklmnopqrstuvwxyz"の連続し...
0ig3he12fz99
9
25,277
s067152610
p01052
u847467233
1531481359
Python
Python3
py
Accepted
20
5600
363
# AOJ 1566 Movie # Python3 2018.7.13 bal4u n = int(input()) tbl = [] for i in range(n): a, b = map(int, input().split()) tbl.append([b, a]) tbl.sort() ans = saw = 0 seen = [0]*101 for i in range(1, 32): for j in range(n): if i < tbl[j][1] or tbl[j][0] < i: continue if seen[j]: continue ans += 100; seen[j] = 1...
p01052
<h1>Movie</h1> <h2>Problem</h2> <p> 太郎君は夏休みの間、毎日1つの映画を近所の映画館で見ることにしました。 (太郎君の夏休みは8月1日から8月31日までの31日間あります。) </p> <p> その映画館では、夏休みの間に<var>n</var> つの映画が上映されることになっています。 それぞれの映画には 1 から <var>n</var> までの番号が割り当てられており、<var>i</var> 番目の映画は8月 <var>a<sub>i</sub></var> 日から8月 <var>b<sub>i</sub></var> 日の間だけ上映されます。 </p> <p> 太郎君は...
4 1 31 2 2 2 3 3 3
1700
25,278
s393189371
p01052
u283783177
1442891641
Python
Python3
py
Accepted
30
7732
860
#!/usr/bin/env python3 # -*- coding: utf-8 -*- N = int(input()) As = [] Bs = [] movies = [[] for x in range(31)] for n in range(N): a, b = map(int, input().split()) a -= 1 b -= 1 As.append(a) Bs.append(b) for day in range(a, b+1): movies[day].append(n) picked = [False] * N ans = 0 for ...
p01052
<h1>Movie</h1> <h2>Problem</h2> <p> 太郎君は夏休みの間、毎日1つの映画を近所の映画館で見ることにしました。 (太郎君の夏休みは8月1日から8月31日までの31日間あります。) </p> <p> その映画館では、夏休みの間に<var>n</var> つの映画が上映されることになっています。 それぞれの映画には 1 から <var>n</var> までの番号が割り当てられており、<var>i</var> 番目の映画は8月 <var>a<sub>i</sub></var> 日から8月 <var>b<sub>i</sub></var> 日の間だけ上映されます。 </p> <p> 太郎君は...
4 1 31 2 2 2 3 3 3
1700
25,279
s471740299
p01052
u997314882
1549178006
Python
Python3
py
Accepted
20
5680
973
# coding:utf-8 import sys import heapq # from collections import Counter, defaultdict INF = float('inf') 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 LS(): return sys.stdin.readline().split() def II(): retur...
p01052
<h1>Movie</h1> <h2>Problem</h2> <p> 太郎君は夏休みの間、毎日1つの映画を近所の映画館で見ることにしました。 (太郎君の夏休みは8月1日から8月31日までの31日間あります。) </p> <p> その映画館では、夏休みの間に<var>n</var> つの映画が上映されることになっています。 それぞれの映画には 1 から <var>n</var> までの番号が割り当てられており、<var>i</var> 番目の映画は8月 <var>a<sub>i</sub></var> 日から8月 <var>b<sub>i</sub></var> 日の間だけ上映されます。 </p> <p> 太郎君は...
4 1 31 2 2 2 3 3 3
1700
25,280
s522767476
p01054
u283783177
1442897106
Python
Python3
py
Accepted
80
9068
590
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import defaultdict N = int(input()) s1 = input() s2 = input() def make_appears(s): chars = list(map(ord, s)) hist = defaultdict(int) for ch in chars: hist[ch] += 1 appears = list(hist.values()) appears.sort() appears.reve...
p01054
<h1>String Conversion</h1> <h2>Problem</h2> <p> ジェニファーとマリアンはカーラに文字列<var>S</var>をプレゼントしました。<br> しかし、カーラは文字列<var>S</var>をもらっても嬉しくありません。<br> 文字列<var>T</var>が欲しかったのです。<br> 3人は協力して文字列<var>S</var>を文字列<var>T</var>に変えることにしました。<br> </p> <p> 最初にジェニファーが文字を任意の順番に並び替えます。 </p> <p> 次にマリアンが2種類のアルファベットの小文字を交換することを任意の回数行います。<br> この...
3 abc xyz
0
25,281
s891521727
p01054
u352394527
1547662261
Python
Python3
py
Accepted
50
6208
299
from collections import Counter n = int(input()) counter1 = Counter(input()) counter2 = Counter(input()) values1 = [0] * (26 - len(counter1)) + sorted(counter1.values()) values2 = [0] * (26 - len(counter2)) + sorted(counter2.values()) print(sum([abs(i - j) for i, j in zip(values1, values2)]) // 2)
p01054
<h1>String Conversion</h1> <h2>Problem</h2> <p> ジェニファーとマリアンはカーラに文字列<var>S</var>をプレゼントしました。<br> しかし、カーラは文字列<var>S</var>をもらっても嬉しくありません。<br> 文字列<var>T</var>が欲しかったのです。<br> 3人は協力して文字列<var>S</var>を文字列<var>T</var>に変えることにしました。<br> </p> <p> 最初にジェニファーが文字を任意の順番に並び替えます。 </p> <p> 次にマリアンが2種類のアルファベットの小文字を交換することを任意の回数行います。<br> この...
3 abc xyz
0
25,282
s119702946
p01059
u847467233
1531483106
Python
Python3
py
Accepted
60
9404
214
# AOJ 1574: Gossip # Python3 2018.7.13 bal4u n, m = map(int, input().split()) a = list(map(int, input().split())) pre = a[0]; d = 0 for x in a[1:]: d = max(d, x-pre) pre = x print(max(n-pre, max(d>>1, a[0]-1)))
p01059
<h1>Gossip</h1> <!-- <p> 12プロこと会津プロダクションは有名芸能プロダクションである。12プロには多くのアイドルが在籍している。 </p> --> <h2>Problem</h2> <p> 1から<var>n</var>までの番号が順番に割り当てられている<var>n</var>人のアイドルが横一列に並んでいる。<br> アイドル<var>i</var>は単位時間でアイドル<var>i</var>-1とアイドル<var>i</var>+1に情報を伝達することができる。ただし、アイドル1はアイドル2にしか情報を伝達できず、アイドル<var>n</var>はアイドル<var>n</var>-1に...
3 2 1 3
1
25,283
s352637491
p01059
u777704299
1457317168
Python
Python3
py
Accepted
40
11096
205
# -*- coding: utf-8 -*- n, m = map(int, input().split()) a = list(map(int, input().split())) ma = a[0] - 1 for i in range(m-1): ma = max(ma, (a[i + 1] - a[i]) // 2) ma = max(ma, n - a[-1]) print(ma)
p01059
<h1>Gossip</h1> <!-- <p> 12プロこと会津プロダクションは有名芸能プロダクションである。12プロには多くのアイドルが在籍している。 </p> --> <h2>Problem</h2> <p> 1から<var>n</var>までの番号が順番に割り当てられている<var>n</var>人のアイドルが横一列に並んでいる。<br> アイドル<var>i</var>は単位時間でアイドル<var>i</var>-1とアイドル<var>i</var>+1に情報を伝達することができる。ただし、アイドル1はアイドル2にしか情報を伝達できず、アイドル<var>n</var>はアイドル<var>n</var>-1に...
3 2 1 3
1
25,284
s909865932
p01059
u724548524
1526726202
Python
Python3
py
Accepted
60
9400
162
n, m = map(int, input().split()) a =list(map(int, input().split())) t = max(a[0] - 1, n - a[-1]) for i in range(1, m):t = max(t, (a[i] - a[i - 1]) // 2) print(t)
p01059
<h1>Gossip</h1> <!-- <p> 12プロこと会津プロダクションは有名芸能プロダクションである。12プロには多くのアイドルが在籍している。 </p> --> <h2>Problem</h2> <p> 1から<var>n</var>までの番号が順番に割り当てられている<var>n</var>人のアイドルが横一列に並んでいる。<br> アイドル<var>i</var>は単位時間でアイドル<var>i</var>-1とアイドル<var>i</var>+1に情報を伝達することができる。ただし、アイドル1はアイドル2にしか情報を伝達できず、アイドル<var>n</var>はアイドル<var>n</var>-1に...
3 2 1 3
1
25,285
s381770014
p01059
u829695570
1579084158
Python
Python3
py
Accepted
60
9408
156
n,m = map(int,input().split()) a = list(map(int,input().split())) c = [a[0]-1, n-a[m-1]] for i in range(m-1): c.append((a[i+1]-a[i])//2) print(max(c))
p01059
<h1>Gossip</h1> <!-- <p> 12プロこと会津プロダクションは有名芸能プロダクションである。12プロには多くのアイドルが在籍している。 </p> --> <h2>Problem</h2> <p> 1から<var>n</var>までの番号が順番に割り当てられている<var>n</var>人のアイドルが横一列に並んでいる。<br> アイドル<var>i</var>は単位時間でアイドル<var>i</var>-1とアイドル<var>i</var>+1に情報を伝達することができる。ただし、アイドル1はアイドル2にしか情報を伝達できず、アイドル<var>n</var>はアイドル<var>n</var>-1に...
3 2 1 3
1
25,286
s013705001
p01059
u813675766
1552022718
Python
Python3
py
Accepted
20
9412
143
n, m = map(int, input().split()) li = list(map(int, input().split())) print(max(li[0]-1, n-li[-1], *[(li[i]-li[i-1])//2 for i in range(1,m)]))
p01059
<h1>Gossip</h1> <!-- <p> 12プロこと会津プロダクションは有名芸能プロダクションである。12プロには多くのアイドルが在籍している。 </p> --> <h2>Problem</h2> <p> 1から<var>n</var>までの番号が順番に割り当てられている<var>n</var>人のアイドルが横一列に並んでいる。<br> アイドル<var>i</var>は単位時間でアイドル<var>i</var>-1とアイドル<var>i</var>+1に情報を伝達することができる。ただし、アイドル1はアイドル2にしか情報を伝達できず、アイドル<var>n</var>はアイドル<var>n</var>-1に...
3 2 1 3
1
25,287
s684129964
p01059
u539753516
1534064383
Python
Python3
py
Accepted
40
9416
135
n,m=map(int,input().split(" ")) a=list(map(int,input().split(" "))) print(max(a[0]-1,n-a[-1],*[(a[i+1]-a[i])//2 for i in range(m-1)]))
p01059
<h1>Gossip</h1> <!-- <p> 12プロこと会津プロダクションは有名芸能プロダクションである。12プロには多くのアイドルが在籍している。 </p> --> <h2>Problem</h2> <p> 1から<var>n</var>までの番号が順番に割り当てられている<var>n</var>人のアイドルが横一列に並んでいる。<br> アイドル<var>i</var>は単位時間でアイドル<var>i</var>-1とアイドル<var>i</var>+1に情報を伝達することができる。ただし、アイドル1はアイドル2にしか情報を伝達できず、アイドル<var>n</var>はアイドル<var>n</var>-1に...
3 2 1 3
1
25,288
s216514758
p01060
u847467233
1531483776
Python
Python3
py
Accepted
20
5596
367
# AOJ 1575: Product Sale Lines # Python3 2018.7.13 bal4u W, H = map(int, input().split()) N = int(input()) P = list(map(int, input().split())) ans = x = y = 0 for p in P: if p == 0: x += 1 else: y += 1 if x < W-1: if x == y: ans += 1 elif x == W-1: pass elif x < W+H-2: if x == y+2: ans += 1 elif x == W+H-2: ...
p01060
<h1>Product Sale Lines</h1> <h2>Problem</h2> <p> ウニクロ卯月さんと目黒凛さんはSEARIGHT LIVE FESの物販に来ている。下図のように、物販列は二列からなり、横に<var>W</var>人、縦に<var>H</var>人並べる大きさでコの字の形をしている。列の先頭の人は買い物をした後に列からはけ、同じ列の後ろの人々はそれぞれ一人分ずつ列を詰める。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE3_UAPC2016Spring_B1" alt="picture o...
11 11 5 0 0 0 0 0
0
25,289
s834775581
p01060
u829695570
1579271160
Python
Python3
py
Accepted
20
5596
378
w,h = map(int, input().split()) n = int(input()) p = list(map(int, input().split())) u = m = cnt = 0 for i in range(n): if p[i] == 0: u += 1 else: m += 1 if u <= w-2: if u == m: cnt += 1 elif w <= u <= w+h-3: if u == m+2: cnt += 1 elif h+h-1 <=...
p01060
<h1>Product Sale Lines</h1> <h2>Problem</h2> <p> ウニクロ卯月さんと目黒凛さんはSEARIGHT LIVE FESの物販に来ている。下図のように、物販列は二列からなり、横に<var>W</var>人、縦に<var>H</var>人並べる大きさでコの字の形をしている。列の先頭の人は買い物をした後に列からはけ、同じ列の後ろの人々はそれぞれ一人分ずつ列を詰める。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE3_UAPC2016Spring_B1" alt="picture o...
11 11 5 0 0 0 0 0
0
25,290
s525734107
p01060
u813675766
1552024224
Python
Python3
py
Accepted
20
5608
682
pos = [[0,0], [1,0]] way = [[0,1], [0,1]] ans = 0 w, h = map(int, input().split()) n = int(input()) li = list(map(int, input().split())) for p in li: ni = pos[p][0]+way[p][0] nj = pos[p][1]+way[p][1] if p == 0: if nj >= w or ni >= h: way[p][0],way[p][1]=way[p][1],-way[p][0] n...
p01060
<h1>Product Sale Lines</h1> <h2>Problem</h2> <p> ウニクロ卯月さんと目黒凛さんはSEARIGHT LIVE FESの物販に来ている。下図のように、物販列は二列からなり、横に<var>W</var>人、縦に<var>H</var>人並べる大きさでコの字の形をしている。列の先頭の人は買い物をした後に列からはけ、同じ列の後ろの人々はそれぞれ一人分ずつ列を詰める。 </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE3_UAPC2016Spring_B1" alt="picture o...
11 11 5 0 0 0 0 0
0
25,291
s511700890
p01061
u847467233
1531484311
Python
Python3
py
Accepted
30
5632
875
# AOJ 1576: Community Integration # Python3 2018.7.13 bal4u # UNION-FIND library class UnionSet: def __init__(self, nmax): self.size = [1]*nmax self.id = [i for i in range(nmax+1)] def root(self, i): while i != self.id[i]: self.id[i] = self.id[self.id[i]] i = self.id[i] return i def connected(self, p,...
p01061
<h1>Community Integration</h1> <!-- <p>安倍拾菜々「えぇっ!生まれ故郷のあの村、○○市に合併されてたんですか!? 20年前に!?」</p> --> <h2>Problem</h2> <p> <var>N</var>個の村がある。それぞれの村には1から<var>N</var>までの番号がついている。昨今の合併ブームにより、いくつかの村が合併されることになった。合併された2つ以上の村は新しい1つの市となり、どの村とも合併されない村は村のままである。 </p> <p> あなたは、ある2つの村が合併後に同じ市になる、という情報を複数与えられる。その情報の組み合わせによって、3つ以上の村が1つの...
3 1 1 2
0
25,292
s537771937
p01061
u766163292
1457321069
Python
Python3
py
Accepted
30
7908
1,506
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array class UnionFind(object): def __init__(self, number_of_nodes, typecode="L"): self.typecode = typecode self.par = array.array(typecode, range(number_of_nodes)) self.rank = array.array(typecode, (0 for i in range(number_of_nodes)))...
p01061
<h1>Community Integration</h1> <!-- <p>安倍拾菜々「えぇっ!生まれ故郷のあの村、○○市に合併されてたんですか!? 20年前に!?」</p> --> <h2>Problem</h2> <p> <var>N</var>個の村がある。それぞれの村には1から<var>N</var>までの番号がついている。昨今の合併ブームにより、いくつかの村が合併されることになった。合併された2つ以上の村は新しい1つの市となり、どの村とも合併されない村は村のままである。 </p> <p> あなたは、ある2つの村が合併後に同じ市になる、という情報を複数与えられる。その情報の組み合わせによって、3つ以上の村が1つの...
3 1 1 2
0
25,293
s117217226
p01061
u133119785
1525514268
Python
Python3
py
Accepted
20
5600
498
[m,n] = map(int,input().split()) def find(v,cs): for c in cities: if v in c: return (True,c) return (False,set([v])) cities = [] for _ in range(n): [a,b] = map(int,input().split()) (ra,fa) = find(a,cities) (rb,fb) = find(b,cities) mg = fa | fb if ra: cities.r...
p01061
<h1>Community Integration</h1> <!-- <p>安倍拾菜々「えぇっ!生まれ故郷のあの村、○○市に合併されてたんですか!? 20年前に!?」</p> --> <h2>Problem</h2> <p> <var>N</var>個の村がある。それぞれの村には1から<var>N</var>までの番号がついている。昨今の合併ブームにより、いくつかの村が合併されることになった。合併された2つ以上の村は新しい1つの市となり、どの村とも合併されない村は村のままである。 </p> <p> あなたは、ある2つの村が合併後に同じ市になる、という情報を複数与えられる。その情報の組み合わせによって、3つ以上の村が1つの...
3 1 1 2
0
25,294
s345922662
p01061
u724548524
1526732790
Python
Python3
py
Accepted
30
5616
602
n, m = map(int, input().split()) q = [] for _ in range(m): a, b = map(int, input().split()) i, j = -1, -1 for k in range(len(q)): if i == -1: if a in q[k]: i = k if j == -1: if b in q[k]: j = k if i >= 0 and j >= 0: ...
p01061
<h1>Community Integration</h1> <!-- <p>安倍拾菜々「えぇっ!生まれ故郷のあの村、○○市に合併されてたんですか!? 20年前に!?」</p> --> <h2>Problem</h2> <p> <var>N</var>個の村がある。それぞれの村には1から<var>N</var>までの番号がついている。昨今の合併ブームにより、いくつかの村が合併されることになった。合併された2つ以上の村は新しい1つの市となり、どの村とも合併されない村は村のままである。 </p> <p> あなたは、ある2つの村が合併後に同じ市になる、という情報を複数与えられる。その情報の組み合わせによって、3つ以上の村が1つの...
3 1 1 2
0
25,295
s857313325
p01061
u352394527
1547807962
Python
Python3
py
Accepted
30
5612
479
n, m = map(int, input().split()) parent = [i for i in range(n)] def get_par(x): if x == parent[x]:return x parent[x] = get_par(parent[x]) return parent[x] for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 pa, pb = get_par(a), get_par(b) parent[pb] = pa city_dic = set()...
p01061
<h1>Community Integration</h1> <!-- <p>安倍拾菜々「えぇっ!生まれ故郷のあの村、○○市に合併されてたんですか!? 20年前に!?」</p> --> <h2>Problem</h2> <p> <var>N</var>個の村がある。それぞれの村には1から<var>N</var>までの番号がついている。昨今の合併ブームにより、いくつかの村が合併されることになった。合併された2つ以上の村は新しい1つの市となり、どの村とも合併されない村は村のままである。 </p> <p> あなたは、ある2つの村が合併後に同じ市になる、という情報を複数与えられる。その情報の組み合わせによって、3つ以上の村が1つの...
3 1 1 2
0
25,296
s264529020
p01072
u847467233
1531485049
Python
Python3
py
Accepted
20
5608
342
# AOJ 1587: Plants # Python3 2018.7.13 bal4u hi = [[0 for j in range(51)] for i in range(51)] W, H, T = map(int, input().split()) P = int(input()) for i in range(P): x, y, t = map(int, input().split()) hi[x][y] += 1 ans = 0; for y in range(H): v = list(map(int, input().split())) for x in range(W): if v[x]: ans +...
p01072
<h1>Problem A: Plants</h1> <h2>Problem</h2> <p>がっちょ君は横<var>W</var>個&times;縦<var>H</var>個のマスで区切られた畑を所有している。<var>x</var>列目<var>y</var>行目のマスをマス <var>(x, y)</var> と呼ぶことにする。いくつかのマスの土地には高さ0cmの植物が1本だけ植えてあり、その他のマスの土地には何も植えられていない。 </p> <p> がっちょ君はある時刻に畑に肥料をまく。肥料がまかれたマスに植物が植えられているとき、その植物の高さが1cm伸びる。植物が植えられていないときは、何もおこらない。植物が伸...
3 3 3 5 2 0 0 0 1 0 1 1 1 1 2 1 2 2 0 0 0 0 0 1 0 0 0 0
1
25,297
s990380799
p01072
u766163292
1474170242
Python
Python3
py
Accepted
30
7880
662
#!/usr/bin/env python3 import itertools import math def main(): w, h, t = map(int, input().split()) p = int(input()) fert = [] for _ in range(p): x, y, _ = map(int, input().split()) fert.append((y, x)) stage = [list(map(int, input().split())) for _ in range(h)] for r, c in ite...
p01072
<h1>Problem A: Plants</h1> <h2>Problem</h2> <p>がっちょ君は横<var>W</var>個&times;縦<var>H</var>個のマスで区切られた畑を所有している。<var>x</var>列目<var>y</var>行目のマスをマス <var>(x, y)</var> と呼ぶことにする。いくつかのマスの土地には高さ0cmの植物が1本だけ植えてあり、その他のマスの土地には何も植えられていない。 </p> <p> がっちょ君はある時刻に畑に肥料をまく。肥料がまかれたマスに植物が植えられているとき、その植物の高さが1cm伸びる。植物が植えられていないときは、何もおこらない。植物が伸...
3 3 3 5 2 0 0 0 1 0 1 1 1 1 2 1 2 2 0 0 0 0 0 1 0 0 0 0
1
25,298
s922717375
p01072
u879226672
1474179045
Python
Python3
py
Accepted
30
7808
601
w, h, t = map(int, input().split()) p = int(input()) hiryo = [] for i in range(p): x, y, t = list(map(int, input().split())) hiryo.append([x, y, t]) hatake = [[0 for i in range(w)] for j in range(h)] hatake_boolean = [] for i in range(h): row = list(map(int, input().split())) row_boolean = [] for j ...
p01072
<h1>Problem A: Plants</h1> <h2>Problem</h2> <p>がっちょ君は横<var>W</var>個&times;縦<var>H</var>個のマスで区切られた畑を所有している。<var>x</var>列目<var>y</var>行目のマスをマス <var>(x, y)</var> と呼ぶことにする。いくつかのマスの土地には高さ0cmの植物が1本だけ植えてあり、その他のマスの土地には何も植えられていない。 </p> <p> がっちょ君はある時刻に畑に肥料をまく。肥料がまかれたマスに植物が植えられているとき、その植物の高さが1cm伸びる。植物が植えられていないときは、何もおこらない。植物が伸...
3 3 3 5 2 0 0 0 1 0 1 1 1 1 2 1 2 2 0 0 0 0 0 1 0 0 0 0
1
25,299
s997841583
p01072
u724548524
1526733204
Python
Python3
py
Accepted
20
5628
212
w, h, t = map(int, input().split()) p = int(input()) c = [tuple(map(int, input().split())) for _ in range(p)] area = [tuple(map(int, input().split())) for _ in range(h)] print(sum([area[i[1]][i[0]] for i in c]))
p01072
<h1>Problem A: Plants</h1> <h2>Problem</h2> <p>がっちょ君は横<var>W</var>個&times;縦<var>H</var>個のマスで区切られた畑を所有している。<var>x</var>列目<var>y</var>行目のマスをマス <var>(x, y)</var> と呼ぶことにする。いくつかのマスの土地には高さ0cmの植物が1本だけ植えてあり、その他のマスの土地には何も植えられていない。 </p> <p> がっちょ君はある時刻に畑に肥料をまく。肥料がまかれたマスに植物が植えられているとき、その植物の高さが1cm伸びる。植物が植えられていないときは、何もおこらない。植物が伸...
3 3 3 5 2 0 0 0 1 0 1 1 1 1 2 1 2 2 0 0 0 0 0 1 0 0 0 0
1
25,300
s303529214
p01072
u724548524
1526733258
Python
Python3
py
Accepted
20
5628
206
w, h, t = map(int, input().split()) c = [tuple(map(int, input().split())) for _ in range(int(input()))] area = [tuple(map(int, input().split())) for _ in range(h)] print(sum([area[i[1]][i[0]] for i in c]))
p01072
<h1>Problem A: Plants</h1> <h2>Problem</h2> <p>がっちょ君は横<var>W</var>個&times;縦<var>H</var>個のマスで区切られた畑を所有している。<var>x</var>列目<var>y</var>行目のマスをマス <var>(x, y)</var> と呼ぶことにする。いくつかのマスの土地には高さ0cmの植物が1本だけ植えてあり、その他のマスの土地には何も植えられていない。 </p> <p> がっちょ君はある時刻に畑に肥料をまく。肥料がまかれたマスに植物が植えられているとき、その植物の高さが1cm伸びる。植物が植えられていないときは、何もおこらない。植物が伸...
3 3 3 5 2 0 0 0 1 0 1 1 1 1 2 1 2 2 0 0 0 0 0 1 0 0 0 0
1
25,301
s078807385
p01074
u847467233
1531488183
Python
Python3
py
Accepted
20
5608
455
# AOJ 1589 Unhappy Class # Python3 2018.7.13 bal4u N, M, L = map(int, input().split()) tbl = [[] for i in range(45)] for i in range(M): d, a, k, t = map(int, input().split()) tbl[d*N+a-1].append((k, t)) dp = [[0 for i in range(45)] for j in range(45)] for da in range(5*N): for i in range(L+1): if i < L: for k,...
p01074
<h1>Problem C: Unhappy Class</h1> <h2>Problem</h2> <p> 山之御船学園の1年G組は、不幸を背負った女子生徒たちが集まるクラスである。 彼女たちは、幸福になることを目標に、日々様々な試練に立ち向かう。 </p> <p> 彼女たちのクラスでは、幸福になるための試練の一環として、幸福実技科目を受講することができる。<br> 月曜から金曜のそれぞれ1限から<var>N</var>限までに授業科目の枠があり、<var>M</var>個の受講可能な科目がある。 </p> <p> 科目<var>i</var>は、曜日<var>d<sub>i</sub></v...
3 7 3 0 1 1 1 0 1 1 2 1 1 3 4 1 1 1 1 1 2 1 2 2 1 1 3 2 2 2 1
9
25,302
s412528865
p01076
u847467233
1531485699
Python
Python3
py
Accepted
30
5596
163
# AOJ 1591 Graph Making # Python3 2018.7.13 bal4u n, d = map(int, input().split()) if d == 1: print(n*(n-1)//2) else: print((n-1)+(n-d-1)*n-((n-d-1)*(n+d-2)//2))
p01076
<h1>Problem E: Graph Making</h1> <h2>Problem</h2> <p> どの頂点とも連結でない<var>n</var>個の頂点がある。<br> 各頂点間に無向辺を張っていく。<br> 直径が<var>d</var>になるようにしたとき、最大何本の辺を張ることができるか求めよ。<br> <!-- 直径とは各頂点と連結の頂点との最短距離のうち最大を表す。<br> --> 直径とは、2つの頂点間の最短距離のうち最大のものを表す。<br> ここで、最短距離は頂点間を移動するために必要な辺の数の最小値である。<br> 多重辺、自己ループは認めない。 </p> <h2>Input</h2> <pre...
4 3
3
25,303
s519454996
p01076
u525395303
1564719453
Python
Python3
py
Accepted
20
5596
164
# AOJ 1591 Graph Making # Python3 2018.7.13 bal4u n, d = map(int, input().split()) if d == 1: print(n*(n-1)//2) else: print((n-1)+(n-d-1)*n-((n-d-1)*(n+d-2)//2))
p01076
<h1>Problem E: Graph Making</h1> <h2>Problem</h2> <p> どの頂点とも連結でない<var>n</var>個の頂点がある。<br> 各頂点間に無向辺を張っていく。<br> 直径が<var>d</var>になるようにしたとき、最大何本の辺を張ることができるか求めよ。<br> <!-- 直径とは各頂点と連結の頂点との最短距離のうち最大を表す。<br> --> 直径とは、2つの頂点間の最短距離のうち最大のものを表す。<br> ここで、最短距離は頂点間を移動するために必要な辺の数の最小値である。<br> 多重辺、自己ループは認めない。 </p> <h2>Input</h2> <pre...
4 3
3
25,304
s782338681
p01078
u847467233
1531485371
Python
Python3
py
Accepted
20
5692
258
# AOJ 1593: Star # Python3 2018.7.13 bal4u import math PI = 3.1415926535897932384626433832795 # area = n*r^2*sin(180/n)*cos(180k/n)*sec(180(k-1)/n), for n/k star N, K = map(int, input().split()) print(N*math.sin(PI/N)*math.cos(K*PI/N)/math.cos((K-1)*PI/N))
p01078
<h1>Problem G: Star</h1> <h2>Problem</h2> <p> 半径1の円に内接する正<var>N</var>/<var>K</var>角形の面積を求めよ。 </p> <p> ただし、正<var>N</var>/<var>K</var>角形を 「円周上に等間隔に<var>N</var>個の点を取り、 <var>K</var>-1個おきにそれぞれの点を結んだ一番外側の図形」 と定義する。 </p> <p> 例えば、5/2角形は次のように描くことができる。 まず、半径1の円周上に等間隔に5つの点を取る。<br /><br/> <img src="https://judgeapi.u-ai...
5 2
1.12256994
25,305
s657634448
p01085
u685815919
1481250316
Python
Python
py
Accepted
60
6324
300
while True: m,nMin,nMax=map(int,raw_input().split()) if m==0: break p=[] for _ in xrange(m): p.append(int(raw_input())) maxN=0 maxD=0 for i in xrange(nMin-1,nMax): if maxD <= p[i]-p[i+1]: maxD = p[i]-p[i+1] maxN = i+1 print maxN
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0
3 4 2 2 3 2
25,306
s361102955
p01085
u260980560
1482769588
Python
Python
py
Accepted
60
6344
296
while 1: m, n1, n2 = map(int, raw_input().split()) if m==0: break P = [int(raw_input()) for i in xrange(m)] P.sort() m = 0 idx = -1 for i in xrange(n2, n1-1, -1): v = P[-i] - P[-i-1] if m < v: m = v idx = i print idx
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0
3 4 2 2 3 2
25,307
s514029543
p01085
u120360464
1483653409
Python
Python
py
Accepted
70
6328
404
#!usr/bin/env python #-*- coding: utf-8 -*- while True: (m, nmin, nmax) = map(int, raw_input().split()) if m == 0: break scores = [] for i in range(m): scores.append(int(raw_input())) submax = 0 for i in range(nmin, nmax+1): subtmp = scores[i-1] - scores[i] ...
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0
3 4 2 2 3 2
25,308
s442020875
p01085
u078042885
1483680190
Python
Python3
py
Accepted
100
7616
217
while 1: a,b,c=map(int,input().split()) if a==0:break d=[int(input()) for i in range(a)] e=0 for i in range(b,c+1): if d[i-1]-d[i]>=e: e=d[i-1]-d[i] f=i print(f)
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0
3 4 2 2 3 2
25,309
s496332409
p01085
u546285759
1486805926
Python
Python3
py
Accepted
100
7572
217
while 1: m,nn,nx= map(int,input().split()) if m==0: break s=[int(input()) for _ in range(m)] v=k=0 for i in range(nn-1,nx): t=s[i]-s[i+1] if v<=t: k,v=i+1,t print(k)
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0
3 4 2 2 3 2
25,310
s619031119
p01085
u342462782
1499683628
Python
Python3
py
Accepted
100
7760
490
def solver(): m, nmin, nmax = map(int, input().split()) if m == 0 and nmin == 0 and nmax == 0: return None p = [int(input()) for _ in range(m)] ans = 0 maxdelta = 0 for a in range(nmin, nmax+1): delta = p[a-1] - p[a] if delta >= maxdelta: maxdelta = delta ...
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0
3 4 2 2 3 2
25,311
s567411300
p01085
u942982291
1513854967
Python
Python
py
Accepted
60
4668
258
#!/usr/bin/python while True: m,a,b = map(int, raw_input().split(' ')) if m == 0: break P = [int(raw_input()) for i in range(0,m)] x,ans = -1,0 for i in range(a,b+1): sub = P[i-1] - P[i] if x < sub: x = sub if x == sub: ans = i print ans
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0
3 4 2 2 3 2
25,312
s413455482
p01085
u146816547
1524333601
Python
Python
py
Accepted
60
4656
322
while True: m, n_min, n_max = map(int, raw_input().split()) if m == 0 and n_min == 0 and n_max == 0: break P = [int(raw_input()) for _ in range(m)] ans, t = 0, 0 for i in range(n_min, n_max+1): if t <= P[i-1] - P[i]: ans = i t = P[i-1] - P[i] print ans...
p01085
<h2>Entrance Examination</h2> <p> The International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination. </p> <p> The successful applicants of the examination are chosen as follows. </p> <ul> <li>The s...
5 2 4 100 90 82 70 65 5 2 4 100 90 80 75 65 3 1 2 5000 4000 3000 4 2 3 10000 10000 8000 8000 4 2 3 10000 10000 10000 8000 5 2 3 100 80 68 60 45 0 0 0
3 4 2 2 3 2
25,313
s301624731
p01086
u467175809
1531284483
Python
Python
py
Accepted
20
5028
532
#!/usr/bin/env python import sys import math import itertools as it from collections import deque sys.setrecursionlimit(10000000) while True: N = input() if N == 0: break lst = [] for i in range(N): S = raw_input() lst.append(len(S)) for i in range(N): S = 0 ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,314
s255982093
p01086
u847467233
1531428427
Python
Python3
py
Accepted
30
5612
353
# AOJ 1601: Short Phrase # Python3 2018.7.13 bal4u a = [5,7,5,7,7] while True: n = int(input()) if n == 0: break ans = 0 w = [len(input()) for i in range(n)] for i in range(n): k = s = 0 for j in range(i, n): s += w[j] if s == a[k]: s, k = 0, k+1 if k == 5: ans = i+1; break elif s > a[k]: br...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,315
s907024160
p01086
u328199937
1556025557
Python
Python3
py
Accepted
30
5620
1,172
ans_list = [] def make_tanka(num, w_list, i): #print(num, w_list, i) cnt = 0 while cnt < num: cnt += len(w_list[i]) i += 1 return [cnt, i] while True: n = int(input()) if n == 0: break w_list = [] for i in range(n): w_list.append(input()) f1 = 0 ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,316
s432217441
p01086
u191474223
1559124538
Python
Python3
py
Accepted
70
7460
963
from collections import defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue,datetime sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 def inpl(): return list(map(int, input().split())) def inpl_str(): return list(input().split()) while True: n = int(input()) if n == ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,317
s349723324
p01086
u037441960
1559541491
Python
Python3
py
Accepted
40
5616
455
while True : n = int(input()) if(n == 0) : break else : A = [5, 7, 5, 7, 7] ans = 0 w = [len(input()) for i in range(n)] for i in range(n) : k = 0 s = 0 for j in range(i, n) : s += w[j] if(s == A[k]) : s = 0 k += 1 if(k == 5) : ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,318
s080225217
p01086
u260980560
1482769953
Python
Python
py
Accepted
20
6448
478
while 1: n = input() if n==0:break L = map(len, [raw_input() for i in xrange(n)]) pair = [5, 7, 5, 7, 7] for i in xrange(n): idx = 0 cnt = 0 for j in xrange(i, n): cnt += L[j] if cnt == pair[idx]: idx += 1 cnt = 0 ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,319
s620676266
p01086
u408260374
1492945815
Python
Python3
py
Accepted
30
7744
459
while True: N = int(input()) if N == 0: break words = [len(input()) for _ in range(N)] for i in range(N): now = i tanku = [5, 7, 5, 7, 7][::-1] while tanku: while tanku[-1] > 0: tanku[-1] -= words[now] now += 1 if t...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,320
s245343030
p01086
u650459696
1497274033
Python
Python3
py
Accepted
30
7652
401
r = [5, 7, 5, 7, 7] while True: n = int(input()) if n == 0: break w = [] for _ in range(n): w.append(len(input())) for j in range(n): i = j for k in r: s = 0 while s < k: s = s + w[i] i = i + 1 if s !...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,321
s497802874
p01086
u667806071
1499941790
Python
Python3
py
Accepted
30
7732
523
def solve(): n = int(input()) if n == 0: return False ok = [5, 7, 5, 7, 7] inputs = [input() for x in range(n)] for i in range(n): target = 0 cnt = i for v in ok: while target < v: s = inputs[cnt] target += len(s) ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,322
s063749022
p01086
u506554532
1513353565
Python
Python3
py
Accepted
30
5612
530
target = [5,7,5,7,7] while True: N = int(input()) if N == 0: break src = [len(input()) for i in range(N)] ans = -1 for i in range(N): j = i _t = target[::-1] while True: if src[j] > _t[-1]: break if src[j] == _t[-1]: _t.pop() ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,323
s221338670
p01086
u546285759
1516581238
Python
Python3
py
Accepted
30
5620
728
p = [5, 7, 5, 7, 7] while True: n = int(input()) if n == 0: break word = [input() for _ in range(n)] flag = False for i in range(len(word)): ip = 0 phrase = ["" for _ in range(len(p))] if flag: break for j in range(i, len(word)): if len...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,324
s989231943
p01086
u881891940
1522017967
Python
Python3
py
Accepted
30
5612
340
def inp(): global n n = int(input()) return n def pos(p, l): global w if p < 0: return -1 while l > 0 and p < n: l -= w[p] p += 1 if l == 0: return p return -1 while inp() > 0: w = [] for i in range(n): w.append(len(input())) for i in range(n): if pos(pos(pos(pos(pos(i,5),7),5),7),7) >= 0: p...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,325
s829100784
p01086
u023471147
1527155866
Python
Python3
py
Accepted
30
5616
493
tanka = (5, 7, 5, 7, 7, 0) words = list() n = int() def rec(step, itr, word): if step == 5: return True if word == 0: return rec(step + 1, itr, tanka[step + 1]) elif word < 0: return False return rec(step, itr + 1, word - words[itr]) while True: n = int(input()) i...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,326
s134128499
p01086
u572046143
1527957045
Python
Python3
py
Accepted
30
5608
885
def main(): while True: n = int(input().strip()) if n == 0: break phrases = [] for _ in range(n): word = input().strip() phrases.append(word) PHRASE_LEN = [5,7,5,7,7] found_flag = False for i in range(n): acc...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,327
s680798629
p01086
u509278866
1528091847
Python
Python3
py
Accepted
60
9040
1,259
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 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...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,328
s583303231
p01086
u591052358
1528803962
Python
Python3
py
Accepted
40
5612
1,043
def set(n): #n = int(input()) #if n == 0: # return False lis = [] for i in range(n): lis.append(len(input())) return lis def solve(lis , n): ans = 0 while ans < 5: ans += lis[n] n +=1 # print(n) if not(ans == 5): return False ans = 0 ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,329
s732966864
p01086
u284260266
1528856779
Python
Python3
py
Accepted
30
5608
1,396
while True: n = int(input())#文字列の量 if n == 0: break w = list()#文字用 for i in range(0, n):#入力 w.append(input()) for j in range(1, n+1):#始めの文字の場所 ck = 0 co = 0 p = 0 t = "" for k in range(j-1,50):#57577チェック用 #print(k) if c...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,330
s941757291
p01086
u531592024
1529570519
Python
Python3
py
Accepted
30
5616
631
while True: n = int(input()) if n == 0: break short = [5, 7, 5, 7, 7] phase = 0 res = -1 arr = [0 for i in range(n)] for i in range(n): arr[i] = len(list(input())) for i in range(n): tmpsum = 0 phase = 0 for j in range(i, n): tmpsum += ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,331
s068215297
p01086
u001668877
1529573818
Python
Python3
py
Accepted
30
5608
588
fs = [5, 7, 5, 7, 7] while True: flag = 0 n = int(input()) if n == 0: quit() w = [] for i in range(n): w.append(len(input())) for i in range(len(w)): k, temp = 0, 0 for j in range(i, len(w)): temp += w[j] if temp > fs[k]: br...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,332
s187079727
p01086
u958378108
1529574053
Python
Python3
py
Accepted
30
5608
739
while True: n = int(input()) if n == 0: break else: words = [] for i in range(n): w = input() words.append(w) check = [5, 7, 5, 7, 7] flag = 0 count = 1 while True: w_len = 0 for i in range(count-1, n): ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,333
s119785381
p01086
u011621222
1529985171
Python
Python3
py
Accepted
50
5620
1,256
while True: n = int(input()) if n == 0: break else: phlist=[] phflag=0 for i in range(n): phlist.append(input()) for i in range(len(phlist)-4): cur=0 state=0 for j in range(i, len(phlist)): s = phlist[j]...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,334
s588991147
p01086
u986045679
1530259789
Python
Python3
py
Accepted
40
5612
459
while True: n = int(input()) if n == 0: break haiku=[5,7,5,7,7] mojicnt=0 iti=0 s=[] for i in range(n): s.append(input()) for i in range(n): for j in range(i,n): mojicnt += len(s[j]) if mojicnt > haiku[iti]: continue elif mojicnt == haiku[iti]: iti+=1 ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,335
s610241662
p01086
u136916346
1530517217
Python
Python3
py
Accepted
30
5656
439
from itertools import count q=(5,7,5,7,7) while 1: l=[len(input()) for _ in range(int(input()))] for st in range(len(l)-4): c=0 s=st for i in count(st): if c==5:break if sum(l[s:i])==q[c]: c+=1 s=i elif sum(l[s:i])>q[c]:...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,336
s981905569
p01086
u309196579
1596626823
Python
Python3
py
Accepted
30
5612
726
p = [5, 7, 5, 7, 7] while True: n = int(input()) if n == 0: break word = [input() for _ in range(n)] flag = False for i in range(len(word)): ip = 0 phrase = ["" for _ in range(len(p))] if flag: break for j in range(i, len(word)): if len...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,337
s556768659
p01086
u994684803
1595223614
Python
Python3
py
Accepted
30
5604
689
tanku=[5,7,5,7,7] while True: n = int(input()) if n == 0: break b = 0 l = [] wlen = 0 for i in range(n): w = str(input()) wlen = len(w) l.append(wlen) for i in range(len(l)): a = 0 tan = 0 for j in range(i,len(l)): ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,338
s983611612
p01086
u583252243
1581834562
Python
Python3
py
Accepted
30
5612
1,524
while True: n = int(input()) if n == 0: break a = [] for i in range(n): p = list(input()) a.append(len(p)) def solve(a): N = len(a) for i in range(N): judge = 0 rest = 5 for j in range(i,N): if judg...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,339
s281421007
p01086
u037441960
1570779976
Python
Python3
py
Accepted
30
5616
773
while True : n = int(input()) if(n == 0) : break else : S = [len(input()) for i in range(n)] T = [5, 7, 5, 7, 7] ans = 0 for i in range(n) : s = 0 w = 0 for j in range(i, n) : s += S[j] ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,340
s256364568
p01086
u314166831
1562936798
Python
Python3
py
Accepted
60
5700
2,790
# coding=utf-8 ### ### for atcorder program ### import sys import math # math class class mymath: ### pi pi = 3.14159265358979323846264338 ### Prime Number def pnum_eratosthenes(self, n): ptable = [0 for i in range(n+1)] plist = [] for i in range(2, n+1): if ptab...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,341
s093705170
p01086
u851513436
1562833701
Python
Python3
py
Accepted
30
5612
464
s = [5,7,5,7,7] def solve(n): num = [len(input()) for _ in range(n)] for i in range(n): c = 0 k = 0 for j in range(i,n): c+= num[j] if c==s[k]: k+=1 c = 0 if k == 5: print(i+1) ...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,342
s645577980
p01086
u788553535
1562746249
Python
Python3
py
Accepted
40
5616
417
while True: n = int(input()) if n==0: break w = [len(input()) for i in range(n)] a = [5,7,5,7,7] ans = n+1 for i in range(n): k,s = 0,0 for j in range(i,n): s += w[j] if s==a[k]: s,k=0,k+1 elif s>a[k]: br...
p01086
<h2>Short Phrase</h2> <p> A <em>Short Phrase</em> (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following condition: </p> <blockquote> (The Condition for a Short Phrase)<br> The sequence o...
9 do the best and enjoy today at acm icpc 14 oh yes by far it is wow so bad to me you know hey 15 abcde fghijkl mnopq rstuvwx yzz abcde fghijkl mnopq rstuvwx yz abcde fghijkl mnopq rstuvwx yz 0
1 2 6
25,343