submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s690894530
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s424631696
p00103
Accepted
# -*- 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] ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s337162717
p00103
Accepted
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"...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s285315935
p00103
Accepted
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: ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s895845985
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s339298032
p00103
Accepted
# -*- 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)...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s801032932
p00103
Accepted
# 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() ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s679016594
p00103
Accepted
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
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s276539747
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s176443546
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s532587460
p00103
Accepted
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": ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s996420556
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s892521190
p00103
Accepted
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
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s119176038
p00103
Accepted
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
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s345518084
p00103
Accepted
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
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s662331846
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s931615725
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s040523025
p00103
Accepted
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 +=...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s623293135
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s050763277
p00103
Accepted
# 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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s632515550
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s101458220
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s701497866
p00103
Accepted
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: ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s446523555
p00103
Accepted
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
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s006449695
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s253834148
p00103
Accepted
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 +=...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s805245646
p00103
Accepted
print "7\n0\n0\n1\n0\n5\n9\n16\n10\n3\n4\n3"
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s311888608
p00103
Accepted
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 +...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s686057259
p00103
Accepted
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":...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s118022840
p00103
Accepted
#!/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': ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s470634682
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s511522805
p00103
Accepted
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": ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s205530716
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s575520478
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s742597822
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s835759550
p00103
Accepted
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(...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s699346760
p00103
Accepted
#演習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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s745772270
p00103
Accepted
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": ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s974900958
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s248250953
p00103
Accepted
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]...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s163658922
p00103
Accepted
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" : ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s943126211
p00103
Accepted
#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 +...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s575177900
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s043022615
p00103
Accepted
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: ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s365154115
p00103
Accepted
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]...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s812636742
p00103
Accepted
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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s606388457
p00103
Accepted
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]: ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s382990502
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s548414948
p00103
Accepted
# 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...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s707793730
p00103
Accepted
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: ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s321782988
p00103
Accepted
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+=...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s965684253
p00103
Accepted
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': ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s577392643
p00103
Accepted
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 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s534794380
p00103
Accepted
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): ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s861473154
p00103
Accepted
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: ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s058412156
p00103
Accepted
if __name__ == '__main__': n = int(input()) ocnt = 0 hcnt = 0 score = 0 while n > 0: line = input() if line == "HOMERUN": score += hcnt score += 1 hcnt = 0 elif line == "HIT": hcnt += 1 if hcnt == 4: score += 1 hcnt = 3 else: ocnt += 1 if ocnt == 3: print(score) ocnt...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s076930949
p00103
Accepted
# -*- coding: utf-8 -*- class Baseball: def __init__(self, score, first, second, third, out_counter): self.score = score self.first = first self.second = second self.third = third self.out_counter = out_counter def hit(self): if self.third == 1: self.score += 1 if self.second == ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s932007650
p00103
Accepted
n = int(raw_input()) ining = 0 out = 0 score = 0 fst = sec = thr = 0, 0, 0 while ining < n: val = raw_input() if val == 'HIT': if thr == 1: score += 1 thr = 0 thr = sec sec = fst fst = 1 if val == 'HOMERUN': if thr == 1: score += 1 if sec == 1: score += 1 if...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s560030837
p00103
Accepted
n=int(input()) for i in range(n): runner=0 out=0 score=0 while 1: state=input() if state=="HIT": if runner<3: runner+=1 else: score+=1 elif state=="HOMERUN": score+=runner+1 runner=0 else: ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s503009854
p00103
Accepted
def get_event(event, ranner, o_cnt): s_cnt = 0 if event == 'HIT': s_cnt = ranner.pop(0) # [1 1 0 ] to [1 0 1] ranner.append(1) elif event == 'HOMERUN': s_cnt = sum(ranner) + 1 ranner = [0, 0, 0] elif event == 'OUT': o_cnt += 1 return (s_cnt, o_cnt, ranner) ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s065142407
p00103
Accepted
for i in range(int(input())): b1 = b2 = b3 = out = score = 0 while 1: n = input() if n == "HIT": if b3 > 0 : score += 1; b3 = b2; b2 = b1; b1 = 1; elif n == "HOMERUN": score += b1 + b2 + b3 + 1; b1 = b2 = b3 = 0 elif n == "OUT": out += 1; if out >=3: break print(score)
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s484412842
p00103
Accepted
n = int(input()) cnt = 0 while 1: if cnt == n: break runner = [0] * 3 score = 0 outcount = 0 while outcount != 3: event = input() if event == "HIT": if runner[2]: score += 1 runner[2] = 0 if runner[1]: ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s701356429
p00103
Accepted
n = int(input()) for i in range(n): b = [False,False,False] o = 0 p = 0 while o < 3: e = input() if e == "HIT": if b[2]: p += 1 b[1], b[2] = b[0], b[1] b[0] = True elif e == "HOMERUN": p += b.count(True) + 1 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s335048073
p00103
Accepted
n = int(input()) cnt, hit, out = 0, 0, 0 while n != 0: s = input() if s == 'HIT': hit += 1 if hit == 4: cnt += 1 hit -= 1 elif s == 'HOMERUN': cnt += hit + 1 hit = 0 else: out += 1 if out == 3: print(cnt) cnt, hit, out =...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s336854412
p00103
Accepted
A = B = 0 team = "A" n = int(input()) for i in range(n): cnt = b1 = b2 = b3 = out = 0 while out != 3: s = input() if s == "HIT": if b3 == 1: cnt+=1 b1,b2,b3 = 1,b1,b2 elif s == "HOMERUN": cnt+=b1+b2+b3+1 b1 = b2 = b3 = 0 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s979013275
p00103
Accepted
n = int(input()) for i in range(n): out = 0 cnt = 0 ro = [0for i in range(3)] while True: o = str(input()) if (o == 'HIT'): cnt += ro[2] ro = [1] + ro[:2] elif (o == 'OUT'): out += 1 elif (o == 'HOMERUN'): cnt += (sum(ro)+1)...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s498369590
p00103
Accepted
n = int(input()) for i in range(n): p = 0 out = 0 x = i % 2 state = [0,0,0] while True: s = str(input()) if s == "HIT": if state[0] == 1: p += 1 state[0],state[1],state[2] = state[1],state[2],1 elif s == "HOMERUN": point = ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s793733001
p00103
Accepted
n = int(input()) for i in range(n): no = 0 np = 0 tm = 0 while(True): s = input() if s == "HIT": tm += 1 if tm >= 4: np += 1 tm = 3 if s == "HOMERUN": np += tm +1 tm = 0 if s == "OUT": ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s467508025
p00103
Accepted
for inning in range(int(input())): out=0 runner=[0]*4 while out<3: event=input() if event=="HIT": for i in range(3,0,-1): runner[i]+=runner[i-1] runner[i-1]=0 runner[0]=1 elif event=="HOMERUN": runner[3]+=1 ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s031284883
p00103
Runtime Error
while True: try: N = int(raw_input()) p = 0 b = [0,0,0] o = 0 for i in range(N): 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': ...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s040802265
p00103
Runtime Error
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 if runner[1] == 1: runner[2] = 1 if runner[0] == 1: runner[1...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s860247564
p00103
Runtime Error
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"...
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s670294269
p00103
Runtime Error
a = int(input().rstrip()) b = 0 while a > b: c = 0 runner = 0 point = 0 while c < 3: x = input().rstrip() if x == HIT: if runner == 3: point += 1 else: runner += 1 elif x == HOMERUN: point = point + runner + 1 runner = 0 else: c += 1 print(point)
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s971234213
p00103
Runtime Error
a = int(input().rstrip()) b = 0 while a > b: c = 0 runner = 0 point = 0 while c < 3: x = input().rstrip() if x == ???HIT???: if runner == 3: point += 1 else: runner += 1 elif x == ???HOMERUN???: point = point + runner + 1 runner = 0 else: c += 1 print(point)
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s087038211
p00103
Runtime Error
a = int(input().rstrip()) b = 0 while a > b: c = 0 runner = 0 point = 0 while c < 3: x = input().rstrip() if x == "HIT": if runner == 3: point += 1 else: runner += 1 elif x == "HOMERUN": point = point + runner + 1 runner = 0 else: c += 1 print(point)
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s142480475
p00103
Runtime Error
a = int(input().rstrip()) b = 0 while a > b: c = 0 runner = 0 point = 0 while c < 3: x = str(input().rstrip()) if x == ???HIT???: if runner == 3: point += 1 else: runner += 1 elif x == ???HOMERUN???: point = point + runner + 1 runner = 0 else: c += 1 print(point)
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s537841875
p00103
Runtime Error
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 r<3:o+=1 else:print(s);break
2 HIT OUT HOMERUN HIT HIT HOMERUN HIT OUT HIT HIT HIT HIT OUT HIT HIT OUT HIT OUT OUT
7 0
<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...
s648399153
p00105
Wrong Answer
dic = {} while True: try: word,PageNum = raw_input().split() if word not in dic: ls = [] ls.append(PageNum) dic[word] = ls else: dic[word].append(PageNum) except: break for k,v in sorted(dic.items()): print k print " ".jo...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s047581274
p00105
Wrong Answer
dic = {} while True: try: word,PageNum = raw_input().split() if word not in dic: dic[word] = [] dic[word].append(PageNum) else: dic[word].append(PageNum) except: break for k,v in sorted(dic.items()): print k print " ".join(map(str,so...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s707937477
p00105
Wrong Answer
dic = {} while True: try: word, pgn = input().split() except: break if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] for k, v in dic.items(): print(k) print(' '.join(map(str, sorted(v))))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s300834605
p00105
Wrong Answer
dic = {} while True: try: word, pgn = input().split() if word in dic.keys(): dic[word].append(int(pgn)) else: dic[word] = [int(pgn)] except: break for k, v in dic.items(): print(k) print(' '.join(map(str, sorted(v))))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s291222451
p00105
Wrong Answer
import sys a={} for i in sys.stdin: b,c=i.split() a.setdefault(b, []).append(c) if c=='18':break for a,b in sorted(a.items(), key=lambda x: x[0]): print(a) print(*b)
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s237168239
p00105
Wrong Answer
import sys a={} for i in sys.stdin: b,c=i.split() a.setdefault(b, []).append(c) if c=='18':break for a,b in sorted(a.items(), key=lambda x: x[0]): print(a) print(*sorted(map(int,b)))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s089447684
p00105
Wrong Answer
d = {} while True: try: word, page = input().split() except: break d[word] = [page] if word not in d else d[word] + [page] for word, pages in sorted(d.items(), key=lambda x: x[0]): print(word) print(*sorted(pages))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s924694875
p00105
Wrong Answer
import sys l=[i.split() for i in sys.stdin] d={} for i in l: if i[0] not in d: d[i[0]]=[i[1]] else: d[i[0]].append(i[1]) for i in sorted(d.keys()): print(i) print(" ".join(d[i]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s872772345
p00105
Wrong Answer
index = {} while True: try: w, p = map(str, raw_input().split()) index.setdefault(w,[]).append(int(p)) except: break for k,v in sorted(index.items()): print k print " ".join(map(str, v))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s909382766
p00105
Wrong Answer
dic = {} while True: try: word, page = raw_input().split() if word in dic.keys(): dic[word] += " " + page else: dic[word] = page except: dic = sorted(dic.items(), key=lambda x: x[0]) for d in dic: print d[0] print d[1] break
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s215784169
p00105
Accepted
dic = {} while True: try: word, page = map(str,raw_input().split()) if word in dic: dic[word].append(int(page)) else: dic[word] = [int(page)] except: for word in sorted(dic): print word for page in sorted(dic[word]): ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s667127590
p00105
Accepted
import sys d={} for s in sys.stdin: w,p=s.split() if w in d: d[w].append(int(p)) else: d[w]=[int(p)] for w in sorted(d.keys()): print w print " ".join(map(str,sorted(d[w])))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s209266455
p00105
Accepted
import sys d={} for s in sys.stdin: w,p=s.split() if w in d: d[w].append(int(p)) else: d[w]=[int(p)] for w,x in sorted(d.items()): print w print " ".join(map(str,sorted(x)))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s383688403
p00105
Accepted
d = {} while True: try: w, n = input().split() n = int(n) temp = d.get(w, []) temp.append(n) d[w] = temp except: key = list(d.keys()) key.sort() for k in key: print(k) d[k].sort() for n in range(len(d[k])): ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s465127195
p00105
Accepted
d = {} while True: try: w, n = input().split() n = int(n) if w in d: d[w].append(n) else: d[w] = [n] except: for k in sorted(d): print(k) print(" ".join(map(str,sorted(d[k])))) break
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s827302839
p00105
Accepted
dic = {} while True: try: word,PageNum = raw_input().split() if word not in dic: dic[word] = [] dic[word].append(int(PageNum)) else: dic[word].append(int(PageNum)) except: break for k,v in sorted(dic.items()): print k print " ".join(...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s628294792
p00105
Accepted
#!/usr/bin/env python3 d = {} while True: try: w, p = input().split() except: break try: d[w].add(int(p)) except: d[w] = set() d[w].add(int(p)) l = list(d.keys()) l.sort() for i in l: print(i) a = list(d[i]) a.sort() print(" ".join(map(str, a)))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s428307148
p00105
Accepted
dic = {} while 1: try: name, page = raw_input().split() page = int(page) if dic.get(name): dic[name] += [page] else: dic[name] = [page] except: break dic = sorted(dic.items()) for name, page in dic: page.sort() print name for i in range(len(page) - 1): print page[i], print page[-1]
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s407294841
p00105
Accepted
dict = {} while True: try: word, page = raw_input().split() if dict.has_key(word): dict[word].append(int(page)) else: dict[word] = [int(page)] except: break for k, v in sorted(dict.items()): print k print " ".join(map(str, sorted(v)))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s077254344
p00105
Accepted
import sys dic = {} for line in sys.stdin: s, p = line.rstrip().split(' ') if not s in dic: dic[s] = [p] else: dic[s].append(p) else: for k, v in sorted(dic.items()): v.sort(key=int) print k print ' '.join(v)
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s395451447
p00105
Accepted
dict = {} while True: try: a,b = map(str,raw_input().split()) except EOFError: break if a in dict: dict[a].append(int(b)) else: dict[a] = [int(b)] for var in dict: dict[var].sort() dic = list(dict.keys()) dic.sort() for var in dic: print var for i in xrange(len(dict[var])): print dict[var][i], ...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s115345905
p00105
Accepted
d = {} l = [] while True: try: s,n = input().split() if s in d: d[s].append(int(n)) else: d[s] = [int(n)] l.append(s) except: break l.sort() for s in l: print(s) d[s].sort() d[s] = [str(s) for s in d[s]] print(' '.join(d[s]))
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...
s933717980
p00105
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array import bisect import collections import sys if __name__ == "__main__": pre_dict = collections.defaultdict(lambda: array.array("I")) for line in sys.stdin: [word, page0] = line.split() page = int(page0) bisect.insort(pre_dict[...
style 12 even 25 introduction 3 easy 9 style 7 document 13 style 21 even 18
document 13 easy 9 even 18 25 introduction 3 style 7 12 21
<H1>Book Index</H1> <p> Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers. </p> <p> You can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of...