submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s878429214
p00149
Accepted
a1,a2,b1,b2,c1,c2,d1,d2 =0,0,0,0,0,0,0,0 while True: try: q,w = map(float,raw_input().split()) if q >= 1.1: a1+=1 if w >= 1.1: a2+=1 if 1.1 > q >= 0.6: b1+=1 if 1.1 > w >= 0.6: b2+=1 if 0.6 > q >= 0.2: c1+=1 if 0.6 > w >= 0.2: c2+=1 if q < 0.2:d1+=1 if w < 0.2:d2+=1 except EOFErr...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s913052311
p00149
Accepted
result = {"left": [0] * 4, "right": [0] * 4} def update(value, dest): if value >= 1.1: dest[0] += 1 elif value >= 0.6: dest[1] += 1 elif value >= 0.2: dest[2] += 1 else: dest[3] += 1 while True: try: left, right = map(float, raw_input().split()) update(left, result["left"]) ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s894342798
p00149
Accepted
al,ar,bl,br,cl,cr,dl,dr=0,0,0,0,0,0,0,0 while 1: try: l,r=map(float,raw_input().split()) if l>=1.1:al+=1 elif 0.6<=l<1.1:bl+=1 elif 0.2<=l<0.6:cl+=1 else:dl+=1 if r>=1.1:ar+=1 elif 0.6<=r<1.1:br+=1 elif 0.2<=r<0.6:cr+=1 else:dr+=1 except E...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s361382215
p00149
Accepted
def Judge(i,A): if i<0.2:A[3]+=1 elif i<0.6:A[2]+=1 elif i<1.1:A[1]+=1 else:A[0]+=1 L,R=[0]*4,[0]*4 while True: try: l,r=map(float,raw_input().split()) except EOFError: break Judge(l,L) Judge(r,R) for i in range(4): print L[i],R[i]
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s470531137
p00149
Accepted
from bisect import bisect D = [0.2,0.6,1.1] L = [0,0,0,0] R = [0,0,0,0] while True: try: left,right = map(float,raw_input().split()) except: break L[bisect(D,left)] += 1 R[bisect(D,right)] += 1 for left,right in zip(L,R)[::-1]: print left,right
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s067459842
p00149
Accepted
from bisect import bisect D = [0.2,0.6,1.1] L = [0]*4 R = [0]*4 while True: try: left,right = map(float,raw_input().split()) except: break L[bisect(D,left)] += 1 R[bisect(D,right)] += 1 for left,right in zip(L,R)[::-1]: print left,right
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s785775537
p00149
Accepted
left = [0]*4; right = [0]*4; while 1: try: l,r = map(float, raw_input().split()) if l>0.7: l-=0.1 if r>0.7: r-=0.1 left[min(15,2+int(10*l))/4]+=1 right[min(15,2+int(10*r))/4]+=1 except EOFError: break for i in xrange(3,-1,-1): print left[i],right[i]
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s642904776
p00149
Accepted
rank = [[0,0] for i in range(4)] while True: try: eye = map(float, raw_input().split()) for i in range(2): if eye[i] >= 1.1: rank[0][i] += 1 elif eye[i] >= 0.6: rank[1][i] += 1 elif eye[i] >= 0.2: rank[2][i] += 1 else: rank[3][i] +=...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s658669150
p00149
Accepted
c = [1.1,0.6,0.2,0.0] r = [[0,0] for i in range(4)] while True: try: e = map(float, raw_input().split()) for i in range(2): for j in range(4): if e[i] >= c[j]: r[j][i] += 1 break except: break for i in range(4): print r[i][0]...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s016610512
p00149
Accepted
c = [1.1,0.6,0.2,0.0] r = [0,0,0,0,0,0,0,0] while 1: try: e = map(float, raw_input().split()) for i in range(2): for j in range(4): if e[i] >= c[j]: r[i+2*j] += 1 break except: break for i in range(0,8,2): print r[i],r[i+1]
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s156930379
p00149
Accepted
c = [1.1,0.6,0.2,0.0] r = [0 for i in range(8)] while 1: try: e = map(float, raw_input().split()) for i in range(2): for j in range(4): if e[i] >= c[j]: r[i+2*j] += 1 break except: break for i in range(0,8,2): print r[i],r[i+...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s674377866
p00149
Accepted
from bisect import bisect ref = [0.2,0.6,1.1] l,r = [0]*4,[0]*4 while 1: try: le,re = map(float, raw_input().split()) l[bisect(ref,le)] += 1 r[bisect(ref,re)] += 1 except: break for i in range(1,5): print l[-i],r[-i]
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s734559688
p00149
Accepted
from bisect import bisect ref = [0.2,0.6,1.1] l,r = [0]*4,[0]*4 while 1: try: le,re = map(float, raw_input().split()) except: break l[bisect(ref,le)] += 1 r[bisect(ref,re)] += 1 for i in range(1,5): print l[-i],r[-i]
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s474389243
p00149
Accepted
import sys LA = RA = 0 LB = RB = 0 LC = RC = 0 LD = RD = 0 for i in sys.stdin: l,r = map(float,i.split()) if l >= 1.1: LA += 1 elif 0.6 <= l <1.1: LB += 1 elif 0.2 <= l < 0.6: LC += 1 else: LD += 1 if r >= 1.1: RA += 1 elif 0.6 <= r <1.1: RB ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s698700662
p00149
Accepted
r_A = 0 r_B = 0 r_C = 0 r_D = 0 l_A = 0 l_B = 0 l_C = 0 l_D = 0 while True : try : l, r = map(float, input().split()) except EOFError : break if l >= 1.1 : l_A += 1 elif l >= 0.6 : l_B += 1 elif l >= 0.2 : l_C += 1 else : l_D += 1 if r >=...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s368168316
p00149
Accepted
import sys import math al=0 bl=0 cl=0 dl=0 ar=0 br=0 cr=0 dr=0 try: while True: l,r=map(float,input().split()) if(l>=1.1): al=al+1 elif(l>=0.6 and l<1.1): bl=bl+1 elif(l>=0.2 and l<0.6): cl=cl+1 else: dl=dl+1 if(r>=1.1):...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s148587542
p00149
Accepted
lr = [0 for i in range(8)] while True: try: a,b = map(float,input().split()) except: break if a >= 1.1: lr[0] += 1 elif a >= 0.6: lr[2] += 1 elif a >= 0.2: lr[4] += 1 else: lr[6] += 1 if b >= 1.1: lr[1] += 1 elif b >= 0.6: l...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s775903814
p00149
Accepted
L = [[0 for x in range(4)] for y in range(2)] while True: try: E = [ float(x) for x in input().split()] for i in range(2): if E[i] >= 1.1: L[i][0] += 1 elif E[i] >= 0.6: L[i][1] += 1 elif E[i] >= 0.2: L[i][2] += 1 ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s177593599
p00149
Accepted
li, ri = [0, 0, 0, 0], [0, 0, 0, 0] while True: try: l, r = map(float, input().split()) except: break if l < 0.2: li[3] += 1 elif l < 0.6: li[2] += 1 elif l < 1.1: li[1] += 1 else: li[0] += 1 if r < 0.2: ri[3] += 1 elif r < 0...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s166307105
p00149
Accepted
E=[[0 for j in range(4)]for i in range(2)] while True: try: p =list(map(float,input().split())) except: break for i in range(2): if p[i]>=1.1: E[i][0]+=1 elif p[i]>=0.6: E[i][1]+=1 elif p[i]>=0.2: E[i][2]+=1 else: E[i][3]+=1 for i in range(4): print(E[0][i]...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s762753877
p00149
Accepted
tbl = [[0 for j in range(4)] for i in range(2)] while True: try: p = list(map(float, input().split())) except: break for i in range(2): if p[i] >= 1.1: tbl[i][0] += 1 elif p[i] >= 0.6: tbl[i][1] += 1 elif p[i] >= 0.2: tbl[i][2] += 1 else: tbl[i][3] += 1 for i in range(4): ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s445175684
p00149
Accepted
def f(a): if a>1.0:return 0 elif a>0.5:return 1 elif a>0.1:return 2 else:return 3 b=[0]*8 while 1: try:l,r=map(float,input().split()) except:break b[f(l)]+=1 b[4+f(r)]+=1 for i in range(4):print(b[i],b[4+i])
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s828723733
p00149
Accepted
def check(n, array): if 1.1 <= n: array[0] += 1 elif 0.6 <= n < 1.1: array[1] += 1 elif 0.2 <= n < 0.6: array[2] += 1 else: array[3] += 1 left = [0] * 4 right = [0] * 4 while 1: try: l, r = map(float, input().split()) except: break check(l, ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s800221574
p00149
Accepted
la, lb, lc, ld = 0, 0, 0, 0 ra, rb, rc, rd = 0, 0, 0, 0 while True: try: n = input() except: break l, r = map(float, n.split()) if 1.1 <= l: la += 1 elif 0.6 <= l < 1.1: lb += 1 elif 0.2 <= l < 0.6: lc += 1 elif l < 0.2: ld += 1 if 1.1 <= r: ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s883531993
p00149
Accepted
eyes = [[0 for i in range(2)] for j in range(4)] while True: try: a = list(map(float, input().split())) except: break for i in range(2): if a[i] >= 1.1: eyes[0][i]+=1 elif a[i] >= 0.6: eyes[1][i]+=1 elif a[i] >= 0.2: eyes[2][i]+=1 else: eyes[3][i]+=1 for i in ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s260604318
p00149
Runtime Error
def hantei(l): if l >= 1.1: return 'A' elif 0.6 <= l < 1.1: return 'B' elif 0.2 <= l < 0.6: return 'C' elif 0.2 < l: return 'D' ldic = {'A':0, 'B':0, 'C':0, 'D':0} rdic = {'A':0, 'B':0, 'C':0, 'D':0} ls = [] while True: try: l,r = map(float,raw_input().split(...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s074284244
p00149
Runtime Error
def hantei(l): if l >= 1.1: return 'A' elif 0.6 <= l < 1.1: return 'B' elif 0.2 <= l < 0.6: return 'C' elif 0.2 < l: return 'D' ldic = {'A':0, 'B':0, 'C':0, 'D':0} rdic = {'A':0, 'B':0, 'C':0, 'D':0} ls = [] while True: try: l,r = map(float,raw_input().split(...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s878780104
p00149
Runtime Error
ld, rd = [0, 0, 0, 0]. [0, 0, 0, 0] while True: try: l, r = map(float, input().split()) if l < 0.2: ld[3] += 1 elif l < 0.6: ld[2] += 1 elif l < 1.1: ld[1] += 1 else: ld[0] += 1 if r < 0.2: rd[3] += 1 ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s886882147
p00149
Runtime Error
ref = [1.1,0.6,0.2,0.0] rank = [[0,0] for i in range(4)] while True: try: eye = map(float, raw_input().split()) for i in range(2): for j in range(4): if eye[i] >= ref[j]: rank[j][i] += 1 break except: break print " ".join(map(str, rank[i]...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s538500473
p00149
WA: Presentation Error
lvl = [1.1, 0.6, 0.2, 0.0] rst = [[0]*4 for _ in range(2)] eyes = [] while True: try: l,r = map(float,input().strip().split()) eyes.append([l,r]) except EOFError: break for e in eyes: for lr in range(2): for l in range(len(lvl)): if e[lr]>=lvl[l]: ...
1.0 1.2 0.8 1.5 1.2 0.7 2.0 2.0
2 3 2 1 0 0 0 0
<H1>視力検査</H1> <p> 視力検査の検査結果データを入力とし、下記の視力判定表に基づいて各判定に当てはまる人数を、左右の視力別に出力するプログラムを作成してください。 </p> <center> <table> <tr><td width="80">判定</td><td>視力</td></tr> <tr><td>A</td><td>1.1 以上</td></tr> <tr><td>B</td><td>0.6 以上 1.1 未満</td></tr> <tr><td>C</td><td>0.2 以上 0.6 未満</td></tr> <tr><td>D</td><td>0.2 未満</td></tr> </table...
s608343901
p00150
Wrong Answer
import bisect as bs def prime(m): N = range(1,m+1, 2) N[0] = 2 for i in range(1, int(m**.5)+1): x = N[i] if x: N[i+x::x] = [0] * len(N[i+x::x]) return filter(None, N) P = prime(10000) x = [P[i] for i in range(1,len(P)) if P[i] - P[i-1]==2] while 1: n = input() if n==0: break i = bs.bisect_right(x...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s128337997
p00150
Wrong Answer
from itertools import takewhile pnum, tmp = [], [i for i in range(2, 10000)] while tmp[0] < 101: v = tmp.pop(0) pnum.append(v) tmp = list(filter(lambda x: x%v!=0, tmp)) for t in tmp: pnum.append(t) del pnum[0:2] while True: n = int(input()) if n==0: break prime = list(takewhile(lambda x: x<=n, p...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s401674016
p00150
Wrong Answer
from itertools import takewhile pnum, tmp = [], [i for i in range(2, 10000)] while tmp[0] < 101: v = tmp.pop(0) pnum.append(v) tmp = list(filter(lambda x: x%v!=0, tmp)) for t in tmp: pnum.append(t) del pnum[0:2] while True: n = int(input()) if n==0: break prime = list(takewhile(lambda x: x<n, pn...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s045606928
p00150
Wrong Answer
from itertools import takewhile pnum, tmp = [], [int(i) for i in range(2, 10000)] while tmp[0] < 101: v = tmp.pop(0) pnum.append(v) tmp = list(filter(lambda x: x%v!=0, tmp)) for t in tmp: pnum.append(t) del pnum[0:2] while True: n = int(input()) if n==0: break prime = list(takewhile(lambda x: x<...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s851276991
p00150
Wrong Answer
from itertools import takewhile pnum, tmp = [], [int(i) for i in range(2, 10000)] while tmp[0] < 101: v = tmp.pop(0) pnum.append(v) tmp = list(filter(lambda x: x%v!=0, tmp)) for t in tmp: pnum.append(t) del pnum[0:2] while True: n = int(input()) if n==0: break prime = list(takewhile(lambda x: x<...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s571035654
p00150
Wrong Answer
# -*- coding: utf-8 -*- """ """ import sys from sys import stdin from bisect import bisect_left input = stdin.readline def create_prime_list(limit): """ ??¨??????????????????????????§limit?????§????´???°?????????????±??????? https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D%...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s981383605
p00150
Wrong Answer
# Aizu Problem 00150: Twin Prime # import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def primes2(n): """ Input n>=6, Returns a list of primes, 2 <= p < n """ n, correction = n-n%6+6, 2-(n%6>1) sieve = [True] * (n//3...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s489430291
p00150
Wrong Answer
from bisect import bisect_left MAXN = 10000 P = [True]*MAXN P[0] = P[1] = False for i in xrange(int(MAXN**0.5)+1): if P[i]: for j in xrange(i+i,MAXN,i): P[j] = False TP = filter(lambda i:P[i] and P[i-2], xrange(2,MAXN)) while True: n = int(raw_input()) if n == 0: break m = TP...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s315759965
p00150
Wrong Answer
r = 10001 sqrt = int(r**0.5) p = [1]*r twin = [0]*r p[0] = 0 p[1::2] = [0 for x in range(1,r,2)] for i in range(2,r,2): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] if p[i-2]: twin[i] = 1
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s796431850
p00150
Wrong Answer
r = 10001 sqrt = int(r**0.5) p = [1]*r twin = [0]*r p[0] = 0 p[1::2] = [0 for x in range(1,r,2)] for i in range(2,r,2): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] if p[i-2]: twin[i:i+100] = [i+1 for x in range(i,i+100)] while True: n = int(raw_input()) if n == 0: break print twin[n-1]-2,twin...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s733397750
p00150
Wrong Answer
r = 10001 sqrt = int(r**0.5) p = [1]*r twin = [0]*r p[0] = 0 p[1::2] = [0 for x in range(1,r,2)] for i in range(2,r,2): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] if p[i-2]: twin[i:i+200] = [i+1 for x in range(i,i+200)] while True: n = int(raw_input()) if n == 0: break print twin[n-1]-2,twin...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s870812879
p00150
Wrong Answer
MN = 10000 tp = [] op = -5 mem = [False * 2] + [True] * MN for i in range(2, MN): if not mem[i]: continue if i - op == 2: tp.append((op, i)) op = i for j in range(i + i, MN, i): mem[j] = False while True: N = input() if not N: break for i, p in enumerate(tp): if p[1] > N: print(...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s559981693
p00150
Time Limit Exceeded
while True: N = input() if N == 0: break L = ['' for i in range(N-1)] L.insert(0, '*') for i, v in enumerate(L): n = i+1 if v == '': for i in range(n*2-1, len(L), n): L[i] = '*' prime = [] for i, v in enumerate(L): if v == '': p...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s890274653
p00150
Time Limit Exceeded
def primes(n): tf = [True] * (n + 1) tf[0] = tf[1] = False for i in range(2, int(n ** (1 / 2)) + 1): if tf[i]: for j in range(i ** 2, n + 1, i): tf[j] = False return [i for i in range(n, -1, -1) if tf[i]] def search_twin(prime_lst): prime_lst2 = prime_lst[1:] for x, y in zip(prime_lst, pr...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s456468150
p00150
Accepted
def prime(m): N = range(1,m+2, 2) r = int(m**.5) h = len(N) N[0] = 0 for i in range(h): x = N[i] if x>r: break if x and i+x<h: N[i+x:h:x]=[0] * ((h-1-i-x)/x+1) N[0] = 2 return filter(None, N) P = prime(10000) x = [a for a,b in zip(P[1:],P[:-2]) if a-b==2] while 1: n = input() if n==0: bre...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s303061355
p00150
Accepted
import bisect as bs def prime(m): N = range(1,m+1, 2) N[0] = 2 for i in range(1, int(m**.5)+1): x = N[i] if x: N[i+x::x] = [0] * len(N[i+x::x]) return filter(None, N) P = prime(10000) x = [P[i] for i in range(1,len(P)) if P[i] - P[i-1]==2] while 1: n = input() if n==0: break a = x[bs.bisect_right...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s779918801
p00150
Accepted
import bisect as bs def prime(m): N = range(1,m+1, 2) N[0] = 2 for i in range(1, int(m**.5)+1): x = N[i] if x: N[i+x::x] = [0] * len(N[i+x::x]) return filter(None, N) P = prime(10000) x = [a for a,b in zip(P[1:],P[:-1]) if a-b==2] while 1: n = input() if n==0: break a = x[bs.bisect_right(x, n)-1]...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s637886311
p00150
Accepted
import bisect as bs def prime(m): N = range(1,m+1, 2) N[0] = 2 n = len(N) for i in range(1, n): x = N[i] if x: N[i+x::x] = [0]*len(N[i+x::x]) return filter(None, N) P = prime(10000) x = [] a = P[0] for b in P[1:]: if b-a==2: x.append(b) a=b while 1: n = int(raw_input()) if n==0: break a = x...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s199041981
p00150
Accepted
import bisect as bs def prime(m): N = range(1,m+1, 2) N[0] = 2 for i in range(1, len(N)): x = N[i] if x: N[i+x::x] = [0]*len(N[i+x::x]) return filter(None, N) P = prime(10000) x = [] a = P[0] for b in P[1:]: if b-a==2: x.append(b) a=b while 1: n = int(raw_input()) if n==0: break a = x[bs.bis...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s392586291
p00150
Accepted
import bisect as bs def prime(m): N = range(1,m+1, 2) N[0] = 2 for i in range(1, len(N)): x = N[i] if x: N[i+x::x] = [0]*len(N[i+x::x]) return filter(None, N) P = prime(10000) x = [] a = P[0] x = [a for a,b in zip(P[1:],P[:-1]) if a-b==2] while 1: n = int(raw_input()) if n==0: break a = x[bs.bis...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s033399640
p00150
Accepted
n=1000000 p=[1]*(n+1) p[0],p[1]=0,0 for i in range(2,int(n**0.5)+1): if p[i]: for j in range(i*i,n+1,i): p[j]=0 #p=[i for i in range(n+1) if p[i]==1] while 1: n=int(input()) if n==0: break for i in range(n,2,-1): if (p[i],p[i-2])==(1,1): print(i-2,i) ...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s691686367
p00150
Accepted
primes = [0, 0] + [1]*9999 for i in range(2, 100): for j in range(i*i, 10001, i): primes[j] = 0 while True: n = int(input()) if n == 0: break for i in range(2, n+1)[::-1]: if primes[i-2] and primes[i]: print(i-2, i) break
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s767859153
p00150
Accepted
# -*- coding: utf-8 -*- """ """ import sys from sys import stdin from bisect import bisect_right input = stdin.readline def create_prime_list(limit): """ ??¨??????????????????????????§limit?????§????´???°?????????????±??????? https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s026295077
p00150
Accepted
# -*- coding: utf-8 -*- """ """ import sys from sys import stdin from bisect import bisect_right input = stdin.readline def create_prime_list(limit): """ ??¨??????????????????????????§limit?????§????´???°?????????????±??????? https://ja.wikipedia.org/wiki/%E3%82%A8%E3%83%A9%E3%83%88%E3%82%B9%E3%83%86%E3%83%8D...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s756226738
p00150
Accepted
# Aizu Problem 00150: Twin Prime # import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def primes2(n): """ Input n>=6, Returns a list of primes, 2 <= p < n """ n, correction = n-n%6+6, 2-(n%6>1) sieve = [True] * (n//3...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s169504862
p00150
Accepted
import math MAX = 10000 def is_prime_number(num): for divisor in range(3, int(math.sqrt(num) + 1), 2): if num % divisor == 0: return False return True def create_prime_number_list(max): prime_number_list = list(range(0, max + 1)) prime_number_list[0] = False prime_number_l...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s200014011
p00150
Accepted
import math m = 10000 s = [1 for i in range(m+1)] s[0] = 0 for i in range(2, int(math.sqrt(m))+1): if s[i] != 0: for j in range(i*2, m, i): s[j] = 0 ss = [] for i in range(m+1): if s[i] == 1: ss.append(i) ss.reverse() while True: n = int(input()) if n == 0: quit() ...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s708509771
p00150
Accepted
def get_input(): while True: try: yield ''.join(input()) except EOFError: break MAX = 10001 primes = list() for i in range(MAX): primes.append(True) primes[0] = False primes[1] = False tprimes = [False for i in range(MAX)] for i in range(2, MAX): j = i + i whil...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s293565645
p00150
Accepted
# AOJ 0150 Twin Prime # Python3 2018.6.17 bal4u MAX = 10000 SQRT = 100 # sqrt(MAX) prime = [True for i in range(MAX)] def sieve(): for i in range(4, MAX, 2): prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i*i, MAX, i): prime[j] = False sieve() while True: n = int(in...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s095138945
p00150
Accepted
# AOJ 0150 Twin Prime # Python3 2018.6.17 bal4u MAX = 10001 SQRT = 100 # sqrt(MAX) prime = [True for i in range(MAX)] def sieve(): for i in range(4, MAX, 2): prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i*i, MAX, i): prime[j] = False sieve() tbl = [0]*MAX ans = 0 f...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s756022013
p00150
Accepted
# AOJ 0150 Twin Prime # Python3 2018.6.17 bal4u MAX = 10001 SQRT = 100 # sqrt(MAX) prime = [True]*MAX def sieve(): # for i in range(4, MAX, 2): # prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i*i, MAX, i): prime[j] = False sieve() tbl, ans = [0]*MAX, 0 for i in range(...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s072826237
p00150
Accepted
def primes(n): tf = [True] * (n + 1) tf[0] = tf[1] = False for i in range(2, int(n ** (1 / 2)) + 1): if tf[i]: for j in range(i ** 2, n + 1, i): tf[j] = False return [i for i in range(n + 1) if tf[i]] def add_twin(prime_lst, twin_lst): prime_lst2 = prime_lst[1:] for x, y in zip(prime_lst,...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s578766180
p00150
Accepted
import math N=10000 prime=[1]*(N+1) prime[0],prime[1]=0,0 for i in range(2,int(math.sqrt(N))): if prime[i]==1: j=i while i*j<=N: prime[i*j]=0 j+=1 while True: n=input() if n==0:break for i in range(n,2,-1): if prime[i]==prime[i-2]==1: print i-...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s727466499
p00150
Accepted
from bisect import bisect MAXN = 10000 P = [True]*MAXN P[0] = P[1] = False for i in xrange(int(MAXN**0.5)+1): if P[i]: for j in xrange(i+i,MAXN,i): P[j] = False TP = filter(lambda i:P[i] and P[i-2], xrange(2,MAXN)) while True: n = int(raw_input()) if n == 0: break m = TP[bise...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s736666709
p00150
Accepted
M = 10**4+1 p = [1]*M; a = [0,0]; prm = 0 p[0],p[1] = 0,0 for i in xrange(2,M): if p[i]: if p[i-2]: prm = i for j in xrange(i*i,M,i): p[j] = 0 a.append(prm) while 1: n = input() if n==0: break print a[n]-2,a[n]
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s309519410
p00150
Accepted
r = 10001 sqrt = int(r**0.5) p = [1]*r p[0] = 0 for i in range(1,sqrt): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] while True: n = int(raw_input()) if n == 0: break for i in range(n,1,-1): if p[i-1] and p[i-3]: print i-2,i break
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s433862361
p00150
Accepted
r = 10001 sqrt = int(r**0.5) p = [1]*r twin = [0]*r p[0] = 0 p[1::2] = [0 for x in range(1,r,2)] for i in range(2,r,2): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] if p[i-2]: twin[i] = 1 while True: n = int(raw_input()) if n == 0: break i = n - twin[:n][::-1].index(1) print i-2,i
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s774954957
p00150
Accepted
r = 10001 sqrt = int(r**0.5) p = [1]*r twin = [0]*r p[0] = 0 p[1::2] = [0 for x in range(1,r,2)] for i in range(2,r,2): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] if p[i-2]: twin[i:i+300] = [i+1 for x in range(i,i+300)] while True: n = int(raw_input()) if n == 0: break print twin[n-1]-2,twin...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s321694643
p00150
Accepted
r = 10001 sqrt = int(r**0.5) p = [1]*r twin = [0]*r p[0] = 0 p[1::2] = [0 for x in range(1,r,2)] for i in range(2,r,2): if p[i]: p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] if p[i-2]: twin[i:i+250] = [i+1 for x in range(i,i+250)] while True: n = int(raw_input()) if n == 0: break print twin[n-1]-2,twin...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s167478043
p00150
Accepted
MN = 10000 tp = [] op = -5 mem = [False * 2] + [True] * MN for i in range(2, MN): if not mem[i]: continue if i - op == 2: tp.append((op, i)) op = i for j in range(i + i, MN, i): mem[j] = False tp.append((MN + 1, MN + 1)) while True: N = input() if not N: break for i, p in enumerate(tp): ...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s767345671
p00150
Accepted
P = [] for n in range(10000): p = 3 c = 0 if n % 2 == 0: c += 1 else: while p < int(n**0.5) + 1: if n % p != 0: p += 2 else: c += 1 break if c == 0: P.append(n) P.reverse() while 1: j = 0 ...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s879414751
p00150
Accepted
import math isPrime = [True] * 10001 primes = [] def eratos(n): isPrime[0] = isPrime[1] = False for i in range(2,int(math.sqrt(n))): if isPrime[i]: j = 2 * i while j <= n: isPrime[j] = False j = j + i for i in range(2,10000): if isPrim...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s344145752
p00150
Accepted
def prime(N): first=[True for i in range(N+1)] first[0],first[1]=False,False for i in range(2,int((N+1)**0.5)): if not first[i]:continue for j in range(i*2,N+1,i):first[j]=False return [i for i in range(N+1) if first[i]] prime_number=prime(10000) while 1: n=int(input()) if n==0:...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s212367786
p00150
Accepted
dplist = [(5, 3), (7, 5), (13, 11), (19, 17), (31, 29), (43, 41), (61, 59), (73, 71), (103, 101), (109, 107), (139, 137), (151, 149), (181, 179), (193, 191), (199, 197), (229, 227), (241, 239), (271, 269), (283, 281), (313, 311), (349, 347), (421, 419), (433, 431), (463, 461), (523, 521), (571, 569), (601, 599), (619, ...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s608493717
p00150
Accepted
import math def prime(n): for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False else: return True while 1: n = int(input()) if n == 0: break if n % 2 == 0: n -= 1 for i in range(n, 3, -2): if prime(i) and prime(i-2): ...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s712973603
p00150
Accepted
def isPrime(n): for i in range(2,int(n**.5+1)): if n%i==0: return False return True while 1: n=int(input()) if not n:break for i in range(n,1,-1): if isPrime(i) and isPrime(i-2): print(i-2,i) break
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s190543105
p00150
Runtime Error
# Aizu Problem 00150: Twin Prime # import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def primes2(n): """ Input n>=6, Returns a list of primes, 2 <= p < n """ n, correction = n-n%6+6, 2-(n%6>1) sieve = [True] * (n//3...
12 100 200 300 0
5 7 71 73 197 199 281 283
<H1>Twin Prime</H1> <p> Prime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs. </p> <p> In this problem, we call the greater number of a twin prime "size of the...
s334201845
p00151
Wrong Answer
def f(x): a = 0 b = 0 for e in x: b = [0, b+1][e] a = max(a, b) return a def d(M): n = len(M) X=[] for i in range(-n+1,n): x=[] for j in range(n): if 0<=i+j<n: a=M[j][i+j] else: a=0 x.append(a) X.append(x) return X while 1: n = input() if n==0: break A = [] ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s592838552
p00151
Wrong Answer
def f(): max_c = 0 c = 0 for h in range(n): for w in range(n): if grid[h][w] == 1: c += 1 else: if max_c < c: max_c = c c = 0 else: if max_c < c: max_c = c ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s098570074
p00151
Wrong Answer
def f(): max_c = 0 c = 0 for h in range(n): for w in range(n): if grid[h][w] == 1: c += 1 else: if max_c < c: max_c = c c = 0 else: if max_c < c: max_c = c ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s616286053
p00151
Wrong Answer
def f(): max_c = 0 c = 0 for h in range(n): for w in range(n): if grid[h][w] == 1: c += 1 else: if max_c < c: max_c = c c = 0 else: if max_c < c: max_c = c ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s307457658
p00151
Wrong Answer
def f(): max_c = 0 c = 0 for h in range(n): for w in range(n): if grid[h][w] == 1: c += 1 else: if max_c < c: max_c = c c = 0 else: if max_c < c: max_c = c ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s738659639
p00151
Wrong Answer
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0151&lang=jp """ import sys from sys import stdin input = stdin.readline def main(args): while True: n = int(input()) if n == 0: break data = [list(map(int, list(input().strip()))) for _ in ra...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s132126791
p00151
Wrong Answer
while True: n=input() if n==0:break L=[map(int,list(raw_input())) for i in range(n)] Q=[[] for i in range(2*n-1)] for i in range(n): for j in range(n): Q[i+j].append((i,j)) P=[[] for i in range(2*n-1)] for i in range(n): for j in range(n-1,-1,-1): P[(...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s551537080
p00151
Wrong Answer
while True: n=input() if n==0:break L=[map(int,list(raw_input())) for i in range(n)] Q=[[] for i in range(2*n-1)] for i in range(n): for j in range(n): Q[i+j].append((i,j)) P=[[] for i in range(2*n-1)] for i in range(n): for j in range(n-1,-1,-1): P[(...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s843684887
p00151
Wrong Answer
while True: n=input() if n==0:break L=[map(int,list(raw_input())) for i in range(n)] Q=[[] for i in range(2*n-1)] for i in range(n): for j in range(n): Q[i+j].append((i,j)) P=[[] for i in range(2*n-1)] for i in range(n): for j in range(n-1,-1,-1): P[(...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s008666446
p00151
Wrong Answer
def ge(n): for i in xrange(n): yield [(i,j) for j in xrange(n)] yield [(j,i) for j in xrange(n)] yield [(i-j,j) for j in xrange(i+1)] yield [(n-i+j-1,n-j-1) for j in xrange(i+1)] while True: n = input() if n == 0: break A = [map(int,list(raw_input())) for _ in xr...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s100076891
p00151
Wrong Answer
def ge(n): for i in xrange(n): yield [(i,j) for j in xrange(n)] yield [(j,i) for j in xrange(n)] yield [(i-j,j) for j in xrange(i+1)] yield [(n-i+j-1,n-j-1) for j in xrange(i+1)] yield [(j,n-i+j-1) for j in xrange(i+1)] yield [(n-j-1,i-j) for j in xrange(i+1)] while ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s862572825
p00151
Wrong Answer
def ge(n): for i in xrange(n): yield [(i,j) for j in xrange(n)] yield [(j,i) for j in xrange(n)] yield [(i-j,j) for j in xrange(i+1)] yield [(n-i+j-1,n-j-1) for j in xrange(i+1)] yield [(j,n-i+j-1) for j in xrange(i+1)] yield [(i-j,n-j-1) for j in xrange(i+1)] while ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s299581596
p00151
Wrong Answer
def ge(n): for i in xrange(n): yield [(i,j) for j in xrange(n)] yield [(j,i) for j in xrange(n)] yield [(j,i-j) for j in xrange(i+1)] yield [(n-1-i+j,n-1-j) for j in xrange(i+1)] yield [(j,n-1-i+j) for j in xrange(i+1)] yield [(n-1-i+j,j) for j in xrange(i+1)] while ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s323639374
p00151
Accepted
def f(x): a = 0 b = 0 for e in x: b = [0, b+1][e] a = max(a, b) return a def d(M): n = len(M) X=[] for i in range(-n+1,n): x = [0]*n for j in range(n): if 0<=i+j<n: x[j] = M[j][i+j] X.append(x) return X while 1: n = input() if n==0: break A = [] B = [] for _ in [0]*n...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s640171046
p00151
Accepted
def f(x): a = 0 b = 0 for e in x: b = [0, b+1][e] a = max(a, b) return a def d(M): n = len(M) X=[] for i in range(-n+1,n): x = [0]*n for j in range(n): if 0<=i+j<n: x[j] = M[j][i+j] X.append(x) return X while 1: n = input() if n==0: break A = [map(int, list(raw_input()))...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s091641768
p00151
Accepted
def f(): max_c = 0 c = 0 for h in range(n): for w in range(n): if grid[h][w] == 1: c += 1 else: if max_c < c: max_c = c c = 0 else: if max_c < c: max_c = c ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s666335031
p00151
Accepted
while 1: n = int(input()) if n == 0: break L = [input() for i in range(n)] ans = 0 for i in range(n): cnt = 0 for j in range(n): if L[i][j] == '1': cnt += 1 else: if ans < cnt: ans = cnt ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s181240229
p00151
Accepted
# Aizu Problem 00151: Grid # import sys, math, os, bisect # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def grid_length(n, grid): L = 0 for row in grid: L = max(L, max([len(_) for _ in row.split('0')])) for c in range(n): co...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s517334477
p00151
Accepted
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0151&lang=jp """ import sys from sys import stdin input = stdin.readline def main(args): while True: n = int(input()) if n == 0: break data = [list(map(int, list(input().strip('\n')))) for _ i...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s038368900
p00151
Accepted
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0151&lang=jp """ import sys from sys import stdin input = stdin.readline def main(args): while True: n = int(input()) if n == 0: break data = [list(map(int, list(input().strip('\n')))) for _ i...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s545069974
p00151
Accepted
def scanning_area(grid, length, point_list, stride_x, stride_y): area = [[0 for _ in range(length + 1)] for __ in range(length + 1)] max_length = 0 for row, col in point_list: if grid[row][col] == "1": area[row + stride_y][col + stride_x] = area[row][col] + 1 max_length = ma...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s195071909
p00151
Accepted
def main(): while True: n = int(input()) if n == 0: break mp = ["0" + input() + "0" for _ in range(n)] mp.insert(0, "0" * (n + 2)) mp.append("0" * (n + 2)) score = [[[0] * 4 for _ in range(n + 2)] for _ in range(n + 2)] max_score = 0 for i in range(1, n + 1): for j in range...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...
s142473957
p00151
Accepted
def main(): while True: n = int(input()) if n == 0: break mp = ["0" + input() + "0" for _ in range(n)] mp.insert(0, "0" * (n + 2)) mp.append("0" * (n + 2)) score = [[[0] * 4 for _ in range(n + 2)] for _ in range(n + 2)] max_score = 0 for i in range(1, n + 1): for ...
5 00011 00101 01000 10101 00010 8 11000001 10110111 01100111 01111010 11111111 01011010 10100010 10000001 2 01 00 3 000 000 000 0
4 8 1 0
<H1>Grid</H1> <p> There is a n &times; n grid D where each cell contains either 1 or 0. </p> <p> Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. </p> <p> For example, the consecutive 1s with g...