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
s836343457
p00102
u051789695
1562764408
Python
Python3
py
Accepted
30
5620
487
while True: n=int(input()) if n==0: break ts=[0]*n ys=0 a=[] for i in range(n): b=list(map(int,input().split())) s=sum(b) a.append(b+[s]) for i in range(n): ts[i]+=b[i] ys+=s t=sum(ts) for i in range(n): for j in ra...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,387
s937556317
p00102
u647694976
1561379039
Python
Python3
py
Accepted
30
5620
540
while 1: try: N=int(input()) if N==0:break matrix = [list(map(int,input().split())) for i in range(N)] matrix.append([]) for i in range(N):matrix[i].append(sum(matrix[i])) for j in range(len(matrix)): pointer=0 for k in range(N): ...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,388
s598985056
p00102
u548252256
1560947470
Python
Python3
py
Accepted
30
5616
508
if __name__ == '__main__': while True: n = int(input()) if n == 0: break A = [[0 for _ in range(n+1)]for _ in range(n)] B = [0 for _ in range(n+1)] for i in range(n): tmp = list(map(int,input().split())) for j,k in enumerate(tmp): A[i][j] += k B[j] += k A[i][n] = sum(A[i]) ...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,389
s814237700
p00102
u990228206
1551701751
Python
Python3
py
Accepted
30
5632
532
while 1: n=int(input()) if n==0:break ans=[0]*(n+1)**2 for i in range(0,n): keep=list(map(int,input().split())) s_keep=0 for j in range(n): ans[i*(n+1)+j]=keep[j] s_keep+=keep[j] ans[(i+1)*(n+1)-1]=s_keep for i in range(n+1): s_keep=0 ...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,390
s165817685
p00102
u717526540
1543219092
Python
Python3
py
Accepted
20
5604
621
while 1: n = int(input()) if n == 0: break mat = [[0 for i in range(n)] for j in range(n)] for i in range(n): mat[i] = list(map(int, input().split())) for i in range(n): tmp = 0 for j in range(n): tmp += mat[i][j] mat[i].append(tmp) col = [0...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,391
s654986155
p00102
u024715419
1542253344
Python
Python3
py
Accepted
30
5628
430
while True: n = int(input()) if n == 0: break ans = [] sum_c = [0 for i in range(n + 1)] for i in range(n): r = list(map(int, input().split())) r.append(sum(r)) ans.append(r) for j in range(n + 1): sum_c[j] += r[j] ans.append(sum_c) for i i...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,392
s493083124
p00102
u219940997
1539002418
Python
Python3
py
Accepted
30
5624
403
while True: n = int(input()) if n == 0: break table = [] for _ in range(n): num = list(map(int, input().split())) num.append(sum(num)) table.append(num) vertical = [] for t in zip(*table): vertical.append(sum(t)) table.append(vertical) for tab in table: ...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,393
s516884059
p00102
u525366883
1538192809
Python
Python3
py
Accepted
30
5616
410
while True: n = int(input()) if n == 0: break mat = [] for i in range(n): mat.append(list(map(int, input().split()))) mat[i].append(sum(mat[i])) mat.append([0]*(n+1)) for i in range(n+1): for j in range(n): mat[n][i]+=mat[j][i] for i in mat: ...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,394
s795444576
p00102
u316584871
1537082032
Python
Python3
py
Accepted
30
5616
649
n = int(input()) while (n != 0): nlist = [] for i in range(n): nn = list(map(int, input().split())) nn.append(sum(nn)) nlist.append(nn) lastn = [] for i in range(n+1): last = 0 for k in range(n): last += nlist[k][i] lastn.append(last) nlist...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,395
s108964665
p00102
u319725914
1533966456
Python
Python3
py
Accepted
30
5624
401
while(True): n = int(input()) if n == 0: break arr = [] for i in range(n): arr.append(list(map(int, input().split()))) arr = [ l+[sum(l)] for l in arr] brr = [0]*(n+1) for i in range(n): for j in range(n+1): brr[j] += arr[i][j] crr = arr+[brr] for...
p00102
<H1>Matrix-like Computation</H1> <p> Your task is to develop a tiny little part of spreadsheet software. </p> <p> Write a program which adds up columns and rows of given table as shown in the following figure: </p> <center> <img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_matrixLike" width="640"> <...
4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 4 52 96 15 20 86 22 35 45 45 78 54 36 16 86 74 55 0
52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815 52 96 15 20 183 86 22 35 45 188 45 78 54 36 213 16 86 74 55 231 199 282 178 156 815
13,396
s086810236
p00103
u314832372
1551253209
Python
Python3
py
Accepted
20
5588
683
var1 = int(input()) for m in range(0, var1): OutCount = 0 BaseCount = 0 PointCount = 0 for i in range(0, 100): try: str1 = input() if str1 == 'HIT': BaseCount = BaseCount + 1 if BaseCount == 4: PointCount = PointCount + ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,397
s923816475
p00103
u899060994
1409295661
Python
Python
py
Accepted
20
4216
459
n = int(raw_input()) runner = 0 run = 0 out = 0 inning = 0 while inning < n: event = raw_input() if event == 'HIT': if runner == 3: run += 1 else: runner += 1 elif event == 'HOMERUN': run += (runner+1) runner = 0 else: if out == 2: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,398
s017850908
p00103
u912237403
1414582582
Python
Python
py
Accepted
20
4228
217
n=input() for _ in [0]*n: i=0 B=[0]*3 c=0 while i<3: s=raw_input()[1] if s=='I': if B[2]==1:c+=1 B=[1]+B[0:2] elif s=='O': c+=sum(B)+1 B=[0]*3 elif s=='U':i+=1 print c
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,399
s331798007
p00103
u912237403
1414583248
Python
Python
py
Accepted
20
4212
199
n=input() for _ in [0]*n: i=0 b=0 c=0 while i<3: s=raw_input()[1] if s=='I': if b==3:c+=1 else: b+=1 elif s=='O': c+=b+1 b=0 elif s=='U':i+=1 print c
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,400
s289950062
p00103
u912237403
1414588737
Python
Python
py
Accepted
10
4208
204
n=input() for _ in [0]*n: i,b,c=0,0,0 while i<3: s="IOU".index(raw_input()[1]) if s==0: if b==3: c+=1 else: b+=1 elif s==1: c+=b+1 b=0 elif s==2: i+=1 print c
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,401
s350700767
p00103
u846356981
1419216086
Python
Python3
py
Accepted
30
6748
1,167
import sys import sys N = int(input()) turn = 0 point = 0 out = 0 base = [0, 0, 0] point_list = [] for idx, line in enumerate(sys.stdin): if line == 'HOMERUN\n': # print('homerun') cnt = 1 if base[0] == 1: cnt += 1 if base[1] == 1: cnt += 1 if base[2...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,402
s429082948
p00103
u014849532
1420127008
Python
Python3
py
Accepted
30
6724
549
#!/usr/bin/python3 n = int(input()) def solve(): o = 0 s = 0 b = [False, False, False] while o < 3: inst = input() if inst == 'OUT': o += 1 elif inst == 'HIT': if b[2]: s += 1 b2 = [True] b2.extend(b[0:2]) ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,403
s599267177
p00103
u586434734
1421476432
Python
Python
py
Accepted
10
4248
980
#!/usr/bin/python # -*- coding: utf-8 -*- def main(): # 入力 N = int(raw_input()) for i in range(N): data = {} b = Baseball() while(b.out < 3): event = raw_input() b.decisionScore(event) print(b.score) class Baseball(): def __init__(self): ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,404
s404712534
p00103
u040533857
1426051390
Python
Python3
py
Accepted
30
6728
548
SCORE=[] preSCORE=0 OUTcount=0 BASE=[False]*3 n=int(input()) for i in range(n): while OUTcount<3: spam=input() if 'HIT' in spam: if BASE[2]==True: preSCORE+=1 BASE[2]=BASE[1] BASE[1]=BASE[0] BASE[0]=True elif 'OUT' in spam: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,405
s033291350
p00103
u040533857
1426051817
Python
Python3
py
Accepted
30
6720
511
SCORE=[] n=int(input()) for i in range(n): BASE=[False]*3 OUTcount=0 preSCORE=0 while OUTcount<3: spam=input() if 'HIT' in spam: if BASE[2]==True: preSCORE+=1 BASE[2]=BASE[1] BASE[1]=BASE[0] BASE[0]=True elif 'OUT' i...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,406
s598050931
p00103
u744114948
1426494368
Python
Python3
py
Accepted
30
6724
502
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright : @Huki_Hara # Created : 2015-03-16 for _ in range(int(input())): ans = 0 out = 0 hit = 0 while True: w = input() if w == "OUT": out += 1 if out == 3: break elif w == "HIT": ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,407
s266923200
p00103
u266872031
1428058622
Python
Python
py
Accepted
20
4212
374
n=int(raw_input()) game=0 while game<n: run=0 score=0 out=0 while out<3: ev=raw_input() if ev=='OUT': out=out+1 elif ev=='HIT': run=run+1 if run>3: run=3 score=score+1 else: score=score+run+1 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,408
s318896480
p00103
u879226672
1428596567
Python
Python
py
Accepted
10
4220
679
while True: try: n = int(raw_input()) except EOFError: break for i in range(n): base = [False,False,False] # first, second, third point = 0 out = 0 while out <3: order = raw_input() if order =='HIT': base.insert(0,True)...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,409
s171355042
p00103
u162387221
1431521848
Python
Python
py
Accepted
20
4228
412
n = input() base, out, score = [0]*3, 0, 0 while True: if n == 0: break event = raw_input() if event == 'OUT': out += 1 if out == 3: print score base, out, score = [0]*3, 0, 0 n -= 1 elif event == 'HIT': score += base.pop() ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,410
s849117555
p00103
u379499530
1432103353
Python
Python
py
Accepted
20
4600
508
from collections import deque inning = 0 point = 0 out = 0 base = deque([0] * 3) n = input() while True: event = raw_input() if event == "HIT": point += base.pop() base.appendleft(1) elif event == "HOMERUN": point += base.count(1) + 1 base = deque([0] * 3) else: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,411
s406877799
p00103
u873482706
1435148905
Python
Python
py
Accepted
10
4232
480
N = int(raw_input()) p = 0 b = [0,0,0] o = 0 while True: try: e = raw_input() if e == 'HIT': if b[-1] == 1: p += 1 b[0],b[1],b[2] = 1,b[0],b[1] elif e == 'HOMERUN': p += sum(b)+1 b = [0,0,0] elif e == 'OUT': ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,412
s472780606
p00103
u985046243
1437042592
Python
Python3
py
Accepted
30
6724
554
N = int(input()) base = [0] * 3 out = 0 point = 0 inning = 0 while True: event = input() if event == "HIT": if base[2] == 1: point += 1 base[2] = base[1] base[1] = base[0] base[0] = 1 elif event == "HOMERUN": point += sum(base) + 1 base = [0] *...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,413
s425351392
p00103
u472944603
1441373132
Python
Python
py
Accepted
10
6480
863
n = int(input()) for i in range(n): first = False second = False third = False out = 0 points = 0 while (out != 3): event = raw_input() if event == "HIT": if first == True: if second == True: if third == True: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,414
s722265787
p00103
u775586391
1451497620
Python
Python3
py
Accepted
30
7608
397
n = int(input()) for i in range(n): l = [1,0,0,0] c = 0 o_c = 0 while True: s = input() if s == 'HIT': if l[3] == 1: c += 1 for i in range(4): if i == 3: l[3-i] == 1 else: l[3-i] = l[2-i] elif s == 'HOMERUN': c += sum(l) l = [1,0,0,...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,415
s541199283
p00103
u873482706
1452007527
Python
Python3
py
Accepted
20
7560
668
for i in range(int(input())): point = 0 out = 0 runner = [0, 0, 0] while True: event = input() if event == 'HIT': if runner[2] == 1: point += 1 runner[2] = 0 if runner[1] == 1: runner[2] = 1 runner[1]...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,416
s487502132
p00103
u873482706
1452007602
Python
Python3
py
Accepted
30
7708
638
for i in range(int(input())): point = 0 out = 0 runner = [0, 0, 0] while True: event = input() if event == 'HIT': if runner[2] == 1: point += 1 runner[2] = 0 if runner[1] == 1: runner[2] = 1 runner[1]...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,417
s458579989
p00103
u797673668
1452308096
Python
Python3
py
Accepted
20
7768
595
def hit(point, base, out_count): new_base = (base << 1) + 1 return point + (new_base > 0b111), new_base & 0b111, out_count def homerun(point, base, out_count): return point + (bin(base & 0b111).count('1') + 1), 0, out_count def out(point, base, out_count): return point, base, out_count - 1 F = {'H...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,418
s685208881
p00103
u210684432
1453792164
Python
Python
py
Accepted
10
6376
475
import sys n = input() events = [] for line in sys.stdin: events.append(line.strip()) out = 0 score = 0 runner = 0 for event in events: if event == 'OUT': out += 1 if out == 3: print score out = 0 score = 0 runner = 0 elif event == 'HIT': ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,419
s442875737
p00103
u140201022
1461517118
Python
Python
py
Accepted
10
6304
466
def game(): score=out=0 runner=[0]*3 while 1: t=raw_input() if t=='OUT': out+=1 if out==3: return score elif t=='HOMERUN': score+=(1+runner.count(1)) runner=[0]*3 elif t=='HIT': if runner[2]==1: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,420
s066645937
p00103
u203261375
1466238430
Python
Python3
py
Accepted
20
7604
690
n = int(input()) score = [0 for i in range(n)] inning = 1 runner = [0 for i in range(3)] outCount = 0 inningScore = 0 while inning <= n: str = input() if str == "OUT": outCount += 1 elif str == "HIT": runner.insert(0, 1) inningScore += runner[3] runner.pop() elif str == "...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,421
s624923991
p00103
u755162050
1468833147
Python
Python3
py
Accepted
20
7660
590
def init_state(): return 0, 0, 0 def main(): n = int(input()) point, hit, out = init_state() while True: if n == 0: break event = input() if event == 'HIT': if hit >= 3: point += 1 else: hit += 1 el...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,422
s137571224
p00103
u500396695
1477974798
Python
Python3
py
Accepted
20
7572
445
n = int(input()) score = 0 outcount = 0 first = 0 second = 0 third = 0 for i in range(n): while outcount < 3: event = input() if event == 'HIT': if third == 1: score += 1 third = second second = first first = 1 if event == 'HOMERUN': score = score + first + second + third + 1 first = second...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,423
s791900608
p00103
u546285759
1479382021
Python
Python3
py
Accepted
20
7448
500
n = int(input()) for i in range(n): out_count = 0 score = 0 runner = [] while True: if out_count == 3: print(score) break events = input() if events == "HIT": if len(runner) == 3: score += 1 else: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,424
s888278881
p00103
u123687446
1481291877
Python
Python3
py
Accepted
20
7516
324
n = int(input()) for i in range(n): r = 0 p = 0 o = 0 while o < 3: e = input() if e == "OUT": o += 1 elif e == "HIT": if r == 3: p += 1 else: r += 1 else: p += r + 1 r = 0 prin...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,425
s602553067
p00103
u919202930
1481606613
Python
Python3
py
Accepted
20
7556
346
for Panzerlied in range(0,int(input())): runners = 0 outs = 0 points = 0 while outs<3: command=input() if command == "HIT": runners+=1 if runners > 3: runners=3 points+=1 elif command == "HOMERUN": points+=(runners+1) runners=0 else: # command == "OUT" ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,426
s203194298
p00103
u301729341
1481763555
Python
Python3
py
Accepted
30
7540
499
n = int(input()) for i in range(n): hit_cou = 0 out_cou = 0 poi = 0 while True: eve = input() if eve == "HIT": if hit_cou == 3: poi += 1 else: hit_cou += 1 elif eve == "OUT": if out_cou == 2: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,427
s996565471
p00103
u078042885
1486141086
Python
Python3
py
Accepted
20
7564
214
n=int(input()) b=[0]*3;s=o=0 while n: e=input() if len(e)>3:s+=sum(b)+1;b=[0]*3 elif e[0]=='H': if b.pop():s+=1 b=[1]+b else: o+=1 if o==3:n-=1;b=[0]*3;print(s);o=s=0
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,428
s632958272
p00103
u661290476
1487314275
Python
Python3
py
Accepted
20
7612
577
n = int(input()) for _ in range(n): runners = [] outs = 0 score = 0 while True: s = input() if s == "HIT": runners.append(0) for i in range(len(runners)): runners[i] += 1 if runners[i] == 4: score += 1 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,429
s244509736
p00103
u148101999
1491992252
Python
Python
py
Accepted
10
6104
578
def main(): kai, wo = 0, [] kai = input() while(True): try: wo.append(raw_input()) except EOFError: break R, S, O = 0, 0, 0 for i in wo: if i == "HIT": if R < 3: R += 1 else: S += 1 elif ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,430
s690894530
p00103
u957680575
1492170524
Python
Python3
py
Accepted
20
7544
428
N = int(input()) for i in range(N): out = 0 hit = 0 point = 0 while out < 3 : a = input() if a == "HIT": if hit < 3: hit = hit + 1 else: point = point + 1 elif a == "HOMERUN": point += hit + 1 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,431
s424631696
p00103
u462831976
1494161870
Python
Python3
py
Accepted
20
7548
558
# -*- coding: utf-8 -*- import sys import os n = int(input()) for i in range(n): base = [0, 0, 0] score = 0 out_count = 0 while True: s = input().strip() if s == 'HIT': if base[2] == 1: score += 1 base[2] = base[1] base[1] = base[0] ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,432
s337162717
p00103
u844704750
1498785486
Python
Python3
py
Accepted
20
7592
501
n = int(input()) out_count = 0 score = 0 runners = [0, 0, 0] while n: event = input() if event == "HIT": if runners.pop(): score+=1 runners = [1] + runners if event == "HOMERUN": score += 1 + sum(runners) runners = [0, 0, 0] if event == "OUT"...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,433
s285315935
p00103
u546285759
1502083886
Python
Python3
py
Accepted
20
7616
462
n = int(input()) score = [0] * n for i in range(n): out_count = 0 runner = 0 while True: data = input() if data == "OUT": out_count += 1 if out_count == 3: break elif data == "HIT": runner += 1 if runner == 4: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,434
s895845985
p00103
u922489088
1503910449
Python
Python3
py
Accepted
20
7516
413
import sys n = int(sys.stdin.readline().rstrip()) for i in range(n): out = score = 0 runner = [0] * 3 while out < 3: st = sys.stdin.readline().rstrip() if st == 'HIT': score += runner[2] runner = [1] + runner[:-1] elif st == 'HOMERUN': score += sum...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,435
s845411212
p00103
u922489088
1503910484
Python
Python
py
Accepted
10
6224
413
import sys n = int(sys.stdin.readline().rstrip()) for i in range(n): out = score = 0 runner = [0] * 3 while out < 3: st = sys.stdin.readline().rstrip() if st == 'HIT': score += runner[2] runner = [1] + runner[:-1] elif st == 'HOMERUN': score += sum...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,436
s339298032
p00103
u811733736
1504187213
Python
Python3
py
Accepted
20
7624
841
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0103&lang=jp """ import sys class Baseball(): def __init__(self): self.score = 0 self.out_count = 0 self.base = [0, 0, 0] def event(self, e): if e == 'HIT': self.base.insert(0, 1)...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,437
s801032932
p00103
u957021183
1505293450
Python
Python3
py
Accepted
20
7632
597
# Aizu Problem 0103: Baseball Simulation # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") N = int(input()) for n in range(N): bases = [0, 0, 0] outs = 0 score = 0 while outs < 3: event = input().strip() ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,438
s679016594
p00103
u742505495
1510045843
Python
Python3
py
Accepted
30
7628
313
n = int(input()) for i in range(n): o_count = 0 h_count = 0 score = 0 while True: site = input() if site == 'OUT': o_count += 1 if o_count == 3: print(score) break elif site == 'HIT': if h_count == 3: score += 1 else: h_count += 1 else: score += h_count+1 h_count = 0
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,439
s276539747
p00103
u742178809
1511512858
Python
Python3
py
Accepted
20
7768
563
import sys #from me.io import dup_file_stdin #@dup_file_stdin def solve(): n = int(sys.stdin.readline())*3 s = 0 p = 0 while n>0: log = sys.stdin.readline() if "HIT" in log: if p >= 3: s += 1 else: p += 1 elif "OUT" in log...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,440
s176443546
p00103
u829501316
1511817497
Python
Python3
py
Accepted
20
7568
386
n = int(input()) for _ in range(n): n_out, n_run, score = 0, 0, 0 while n_out < 3: evt = input() if evt == 'HIT': if n_run < 3: n_run += 1 else: score += 1 elif evt == 'HOMERUN': score += n_run + 1 n_run = 0 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,441
s532587460
p00103
u546285759
1515902244
Python
Python3
py
Accepted
20
5596
479
n = int(input()) inning = 0 while inning != n: score = 0 info = [0, 0, 0] out_count = 0 while True: event = input() if event == "OUT": out_count += 1 if out_count == 3: inning += 1 print(score) break if event == "HIT": ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,442
s996420556
p00103
u808429775
1516356603
Python
Python3
py
Accepted
20
5592
512
gameCount = int(input()) output = [] for lp in range(gameCount): hitCount = 0 outCount = 0 score = 0 while outCount < 3: content = input() if content == "HIT": if hitCount < 3: hitCount += 1 else: score += 1 elif conten...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,443
s892521190
p00103
u150984829
1517479078
Python
Python3
py
Accepted
20
5600
170
for _ in[0]*int(input()): r=o=s=0 while 1: a=input()[1] if'I'==a: if r<3:r+=1 else:s+=1 elif'O'==a:s+=r+1;r=0 else: if o<2:o+=1 else:print(s);break
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,444
s119176038
p00103
u150984829
1517479156
Python
Python3
py
Accepted
20
5596
172
for _ in[0]*int(input()): r=o=s=0 while 1: a=input()[1] if'I'==a: if r<3:r+=1 else:s+=1 if'O'==a:s+=r+1;r=0 if'U'==a: if o<2:o+=1 else:print(s);break
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,445
s345518084
p00103
u150984829
1517479390
Python
Python3
py
Accepted
20
5588
156
n=int(input()) r=o=s=0 while n: a=input()[1] if'I'==a: if r<3:r+=1 else:s+=1 elif'O'==a:s+=r+1;r=0 else: if o<2:o+=1 else:print(s);n-=1;r=o=s=0
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,446
s662331846
p00103
u043254318
1521211057
Python
Python3
py
Accepted
20
5592
465
N = int(input()) for l in range(N): outCount = 0 score = 0 bases = 0 while True: action = input() if action == "HIT": if bases == 3: score += 1 else: bases += 1 elif action == "HOMERUN": score += bases + 1 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,447
s931615725
p00103
u428982301
1527584692
Python
Python3
py
Accepted
20
5600
885
event = [] inning = int(input()) NONE = 0b000 FIRST = 0b001 SECOND = 0b010 THIRD = 0b100 runner = NONE currentInning = 0 score = 0 outCount = 0 inningScore = [] while currentInning < inning: data = input() if data == "HIT": if (runner & THIRD) == THIRD: score += 1 runner ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,448
s040523025
p00103
u352394527
1527642310
Python
Python3
py
Accepted
20
5584
341
n = int(input()) for _ in range(n): out_cnt = 0 runner = 0 point = 0 while out_cnt < 3: event = input() if event == "HIT": runner += 1 if runner >= 4: point += 1 runner = 3 elif event == "HOMERUN": point += (runner + 1) runner = 0 else: out_cnt +=...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,449
s623293135
p00103
u136916346
1528349299
Python
Python3
py
Accepted
20
5596
359
inn=int(input()) o=0 i=0 s=[] sc=0 ba=[] while i<inn: b=input() if b == "OUT": o+=1 if o%3 == 0 and o>0: s.append(sc) sc=0 i+=1 o=0 ba=[] elif b == "HIT": ba.append(1) if len(ba)>=4: sc+=1 ba=[1,1,1] elif b == "HOMERUN": ba.append(1) sc+=l...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,450
s050763277
p00103
u847467233
1529186322
Python
Python3
py
Accepted
20
5600
337
# AOJ 0103: Baseball Simulation # Python3 2018.6.17 bal4u for i in range(int(input())): p1 = p2 = p3 = out = cnt = 0; while True: s = input() if s == 'HIT': if p3 > 0: cnt += 1 p3, p2, p1 = p2, p1, 1 elif s == 'HOMERUN': cnt += p1 + p2 + p3 + 1 p1 = p2 = p3 = 0 else: out += 1 if out == 3: b...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,451
s632515550
p00103
u724947062
1347273076
Python
Python
py
Accepted
20
5396
578
import sys base = [0, 0, 0] out = 0 N = int(sys.stdin.readline()) point = 0 inning = list() def choice(event): global base, out, point if event == "HIT": point += base.pop() base = [1] + base elif event == "HOMERUN": point += sum(base) + 1 base = [0, 0, 0] elif event ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,452
s101458220
p00103
u881567576
1350212339
Python
Python
py
Accepted
20
4240
447
line_num = int(raw_input()) out_all = line_num * 3 out_now = 0 out_inning = 0 score = 0 runner = 0 while out_all > out_now: if out_inning > 2: print score out_inning = 0 score = 0 runner = 0 EVENT = raw_input() if EVENT.find("HOMERUN") > -1: score += 1 + runner runner = 0 if EVENT.find("HIT") > -1: ru...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,453
s701497866
p00103
u779627195
1354645527
Python
Python
py
Accepted
10
4236
389
import sys R = lambda:map(int,raw_input().split()) n = int(raw_input()) for i in xrange(n): run = [] cnt = 0 score = 0 while cnt < 3: s = raw_input() if s == 'OUT': cnt += 1 elif s == 'HIT': if len(run) is 3: score += 1 else: run.append(1) else: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,454
s446523555
p00103
u647766105
1357448994
Python
Python
py
Accepted
10
4224
293
for unused in xrange(input()): out,stack,p=0,0,0 while out<3: ev=raw_input() if ev=="OUT": out+=1 if ev=="HIT": stack+=1 if ev=="HOMERUN": p+=stack+1 stack=0 if stack>=4: p+=stack-3 print p
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,455
s006449695
p00103
u665962315
1357528328
Python
Python
py
Accepted
10
4248
652
def hit(bases): got_point = False if bases[2]: got_point = True bases[0], bases[1], bases[2] = 1, bases[0], bases[1] if got_point: return 1 else: return 0 def homerun(bases): num_runner = bases.count(1) bases[0], bases[1], bases[2] = 0, 0, 0 return num_runner + 1...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,456
s253834148
p00103
u577457452
1361546047
Python
Python
py
Accepted
10
4224
430
for i in range(int(raw_input())): out = hit = score = 0 while 1: event = raw_input() if event == 'OUT': if out < 2: out += 1 else: print score break elif event == 'HIT': if hit < 3: hit +=...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,457
s805245646
p00103
u310759044
1363865923
Python
Python
py
Accepted
10
4184
44
print "7\n0\n0\n1\n0\n5\n9\n16\n10\n3\n4\n3"
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,458
s311888608
p00103
u542421762
1370157395
Python
Python
py
Accepted
10
4256
823
import sys class Baseball: def __init__(self): self.runner = 0 self.out_count = 0 self.score = 0 def hit(self): if self.runner == 3: self.score += 1 else: self.runner += 1 def homerun(self): self.score = self.score + self.runner +...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,459
s686057259
p00103
u147801965
1372060973
Python
Python
py
Accepted
10
4220
365
for i in range(input()): I = 0 H = 0 o = 0 while 1: s = raw_input() if s=="OUT": o+=1 if o == 3: o=0 break elif s=="HIT": I+=1 if I == 4: I-=1 H +=1 elif s=="HOMERUN":...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,460
s118022840
p00103
u782850731
1382358139
Python
Python
py
Accepted
10
4228
669
#!/usr/bin/env python from __future__ import division, print_function from sys import stdin, exit def main(readline=stdin.readline): for _ in range(int(readline())): first = second = third = out = point = 0 while out < 3: event = readline()[1] if event == 'I': ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,461
s470634682
p00103
u350508326
1382627075
Python
Python
py
Accepted
20
4240
1,022
hit = 'HIT' homerun = 'HOMERUN' out = 'OUT' class Runer: def __init__(self): self.ini() def ini(self): self.runner = [] self.score = 0 def mhit(self): if len(self.runner) < 3: self.runner.append(1) # print self.runner, len(self.runner) else...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,462
s511522805
p00103
u633068244
1394003939
Python
Python
py
Accepted
10
4228
533
n = int(raw_input()) ining, out, score = 0, 0, 0; runner = [0,0,0] while ining < n: event = raw_input() if event == "HIT": if runner[2] == 1: score += 1 runner[2] = 0 runner[2] = runner[1] runner[1] = runner[0] runner[0] = 1 elif event == "HOMERUN": ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,463
s205530716
p00103
u193025715
1397814600
Python
Python
py
Accepted
20
4208
381
for i in range(input()): base = 0 result = 0 out = 0 while out != 3: cmd = raw_input() if cmd == "HIT": if base == 3: result += 1 else: base += 1 elif cmd == "HOMERUN": result += base + 1 base = 0 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,464
s575520478
p00103
u193025715
1397814738
Python
Python
py
Accepted
20
4208
360
for i in range(input()): base, result, out = 0, 0, 0 while out != 3: cmd = raw_input() if cmd == "HIT": if base == 3: result += 1 else: base += 1 elif cmd == "HOMERUN": result += base + 1 base = 0 els...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,465
s742597822
p00103
u193025715
1397814987
Python
Python
py
Accepted
10
4204
361
for i in xrange(input()): base, result, out = 0, 0, 0 while out != 3: cmd = raw_input() if cmd == "HIT": if base == 3: result += 1 else: base += 1 elif cmd == "HOMERUN": result += base + 1 base = 0 el...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,466
s835759550
p00103
u770042163
1596273549
Python
Python3
py
Accepted
20
5596
910
n = int(input()) for i in range(n): out_cnt = 0 score = 0 runner = [0,0,0,0] while True: event = input() if event=="OUT": out_cnt += 1 if out_cnt == 3: break elif event=="HIT": if 1 in runner: for ind in range(...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,467
s699346760
p00103
u819143290
1594741801
Python
Python3
py
Accepted
20
5592
1,010
#演習1-14 sys_a = [0]*2 #aの攻撃システム[ランナー,アウト]  sys_b = [0]*2 #bの攻撃システム[ランナー,アウト] score_a = 0 #socre of a score_b = 0 #score of b outs = 0 #total number of outs (1 ining = 6 outs) inings = int(input()) #number of inings while outs <= 3*inings: if outs == 3*inings: #outsが3回×イニング数 個たまったらおわり break ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,468
s745772270
p00103
u108874716
1593246188
Python
Python3
py
Accepted
20
5592
478
n = int(input()) inning = 0 while inning != n: score = 0 info = [0, 0, 0] out_count = 0 while True: event = input() if event == "OUT": out_count += 1 if out_count == 3: inning += 1 print(score) break if event == "HIT": ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,469
s974900958
p00103
u678942053
1592895540
Python
Python3
py
Accepted
20
5584
414
N = int(input()) for i in range(N): run = out = point = 0 while True: result = input() if result == "HIT": run += 1 if run >= 4: point += 1 run = 3 elif result == "HOMERUN": point += (run + 1) run = 0 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,470
s248250953
p00103
u611293015
1592881753
Python
Python3
py
Accepted
30
5596
462
ininng = int(input()) for i in range(ininng): base=[0,0,0] out=0 score=0 while out<3: event=input() if event=="HIT": if base[2]==1: base[2]=0 score+=1 if base[1]==1: base[2]=1 base[1]=0 if base[0] ==1: base[0]=0 base[1]...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,471
s163658922
p00103
u240091169
1591336520
Python
Python3
py
Accepted
20
5584
952
n = int(input()) for i in range(n) : first = "OFF" second = "OFF" third = "OFF" score = 0 out = 0 while True : event = input() if event == "HIT" : if first == "OFF" : first = "ON" else : if second == "OFF" : ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,472
s943126211
p00103
u722264914
1591249694
Python
Python3
py
Accepted
20
5584
528
#import random #basball ineng = int(input()) #ivent_list = [random.randint(0,3) for _ in range(ineng)] for _ in range(ineng): out_count = 0 runner =0 score = 0 while out_count <3: event = input() if event == "HIT": runner +=1 if runner >=4: score +...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,473
s575177900
p00103
u260980560
1588637241
Python
Python3
py
Accepted
20
5596
402
N = int(input()) bc = [0, 1, 1, 2, 1, 2, 2, 3] for i in range(N): ans = 0 b = 0 rest = 3 while rest: s = input() if s == "OUT": rest -= 1 continue if s == "HIT": b = (b << 1) | 1 if b & 8: ans += 1 b...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,474
s043022615
p00103
u630911389
1587090925
Python
Python3
py
Accepted
20
5584
353
n = int(input()) hit = out = score = 0 while(n): d = input() if d == "HIT": hit += 1 if hit == 4: hit = 3 score += 1 elif d == "OUT": out += 1 if out == 3: n -= 1 print(score) hit = score = out = 0 else: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,475
s365154115
p00103
u606731189
1576758353
Python
Python3
py
Accepted
20
5592
725
n=int(input()) g=1 while g<=n: out=0 #0ランナーなし、1ランナーあり,4番目得点 runner=[0,0,0,0] #3アウトまで while out<3: batter=str(input()) #アウト if batter=="OUT": out+=1 #ヒット if batter=="HIT": for i in range(3): if i==0: runner[0]...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,476
s812636742
p00103
u932448709
1575287544
Python
Python3
py
Accepted
20
5588
332
a=0 while 1: OUT=0 R=0 P=0 SET=0 if a==0: b=int(input()) a+=1 if b==0: break while OUT<=2: n=input() if n=='HIT': R+=1 if R>3: P+=1 R=3 if n=='OUT': OUT+=1 if n=='HOMERUN': P+=R+1 R=0 b-=1 p...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,477
s606388457
p00103
u004929098
1574148089
Python
Python3
py
Accepted
20
5596
451
A = ['HIT','HOMERUN','OUT'] n = int(input()) for i in range(n): r = [] o = 3 s = 0 while o > 0: a = input() if a == A[0]: r = [1]+r if len(r) >= 4: S,r[3:] = r[3:],[] for i in S: s += i elif a == A[1]: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,478
s382990502
p00103
u803862921
1572093836
Python
Python3
py
Accepted
20
5592
494
num = int(input()) for _ in range(num): P = 0 B = [0] * 3 O = 0 while True: s = input() if s == "OUT": O += 1 if O > 2: break elif s == "HIT": P += B[2] B[2] = B[1] B[1] = B[0] B[0] = 1 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,479
s548414948
p00103
u314166831
1563979439
Python
Python3
py
Accepted
20
5648
3,158
# coding=utf-8 ### ### for python 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 ptable...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,480
s707793730
p00103
u090921599
1563715686
Python
Python3
py
Accepted
20
5596
394
for i in range(int(input())): p1 = p2 = p3 = out = cnt = 0 while True: s = input() if s =="HIT": if p3 > 0: cnt += 1 p3, p2, p1 = p2, p1, 1 elif s == "HOMERUN": cnt += p1 + p2 + p3 +1 p1 = p2 = p3 = 0 else: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,481
s321782988
p00103
u051789695
1562765281
Python
Python3
py
Accepted
30
6000
366
from collections import deque n=int(input()) for i in range(n): out,res=0,0 q=deque([]) while out<3: s=input() if s=='OUT': out+=1 elif s=='HIT': if len(q)==3: res+=1 else: q.append(0) else: res+=...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,482
s965684253
p00103
u051394180
1561541035
Python
Python3
py
Accepted
20
5600
1,432
class Baseball: def __init__(self, score = 0): self.inning = Inning() self.game_score = score # def get_game_score(self): # return self.game_score def change(self): del self.inning self.inning = Inning() def batting(self, event): if event == 'HIT': self.inning.hit() elif event == 'HOMERUN': ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,483
s577392643
p00103
u647694976
1561380221
Python
Python3
py
Accepted
20
5592
436
N=int(input()) count = 0 point = 0 runner = 0 out = 0 while 1: n = input() if n=="HIT": runner +=1 if runner==4: point +=1 runner -=1 elif n=="OUT": out +=1 if out==3: count +=1 print(point) point = runner = out = 0 ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,484
s534794380
p00103
u990459103
1561009591
Python
Python3
py
Accepted
20
5588
896
class Point(): def __init__(self,base,score,out): self.base=base self.score=score self.out=out def hit(self): if self.base < 3: self.base = self.base + 1 else: self.score = self.score + 1 def home(self): ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,485
s861473154
p00103
u555040407
1561001803
Python
Python3
py
Accepted
20
5596
669
class Baseball(): def __init__(self, runner, score, out): self.runner = runner self.score = score self.out = out for i in range(int(input())): inning = Baseball(0,0,0) while True: event = input() if event == 'HIT': if inning.runner == 3: ...
p00103
<H1>Baseball Simulation</H1> <p> Ichiro likes baseball and has decided to write a program which simulates baseball.</p> <p> The program reads events in an inning and prints score in that inning. There are only three events as follows: </p> <p>Single hit</p> <ul> <li>put a runner on the first base.</li> <li>the runn...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
13,486