submission_id string | problem_id string | status string | code string | input string | output string | problem_description string |
|---|---|---|---|---|---|---|
s865520870 | p00025 | Accepted | import sys
array = []
for i in sys.stdin.readlines():
array.append(i.rstrip().split())
for i in range(0,len(array),2):
hit = 0
blow = 0
for i2 in range(4):
if array[i][i2] == array[i+1][i2]:
hit += 1
for i3 in range(4):
if array[i][i2] == array[i+1][i3]:
if i2 == i3:
continue
blow += 1
print(str(hit)+" "+str(blow)) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s168912256 | p00025 | Accepted | import sys
v = None
for i in sys.stdin:
if v:
h = 0
for j, n in enumerate(i.split()):
if n == v[j]:
h += 10
elif n in v:
h += 1
v = None
print(h // 10, h % 10)
else:
v = i.split() | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s953902728 | p00025 | Accepted | # -*- coding: utf-8 -*-
import sys
import os
import math
lines = sys.stdin.readlines()
game_num = len(lines) // 2
for i in range(game_num):
s0 = lines[2 * i].strip()
s1 = lines[2 * i + 1].strip()
A = list(map(int, s0.split()))
B = list(map(int, s1.split()))
hit = 0
blow = 0
for j in range(4):
if A[j] == B[j]:
hit += 1
elif A[j] in B:
blow += 1
print(hit, blow) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s560575133 | p00025 | Accepted | while True :
try :
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
hit, blow = 0, 0
for _ in range(4) :
if a[_] == b[_] : hit += 1
elif b[_] in a : blow += 1
print(hit, blow)
except : break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s950086398 | p00025 | Accepted | while True:
try:
a, b = list(map(int,input().split())), list(map(int, input().split()))
print(sum([1 for i in range(4) if a[i] == b[i]]),
sum([1 for i in range(4) for j in range(4) if i != j and a[i] == b[j]]))
except:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s558869114 | p00025 | Accepted | def HB(A,B):
hit=0
blow=0
for i in range(4):
for j in range(4):
if A[i]==B[j]:
if i==j:
hit+=1
else:
blow+=1
return [hit,blow]
while True:
try:
A=input().split()
B=input().split()
print(HB(A,B)[0] , HB(A,B)[1] )
except:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s523512976 | p00025 | Accepted | try:
while True:
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
hit = blow = 0
for i in l1:
for s in l2:
if i == s:
if l1.index(i) == l2.index(s):
hit += 1
else:
blow += 1
print(hit, blow)
except:
pass | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s860429155 | p00025 | Accepted | try:
while True:
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
hit=blow=0
for i in l1:
for s in l2:
if i==s:
if l1.index(i)==l2.index(s):
hit+=1
else:
blow+=1
print(hit,blow)
except:
pass
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s405997279 | p00025 | Accepted | while True:
try:
A = list(map(int, input().split()))
B = list(map(int, input().split()))
except EOFError:
break
hit = sum(1 for i in range(4) if A[i] == B[i])
blow = sum(1 for i in range(4) if A[i] in B) - hit
print(hit, blow) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s709924697 | p00025 | Accepted | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
print(sum(x == y for x, y in zip(a, b)), sum(a[i] != b[i] and a[i] in b for i in range(4))) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s271893146 | p00025 | Accepted | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
print(sum(x == y for x, y in zip(a, b)), sum(a[i] != b[i] and a[i] in b for i in range(4))) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s051437338 | p00025 | Accepted | import sys
for user in sys.stdin:
hit = 0
blow = 0
a = list(map(int, user.split()))
user = input()
b = list(map(int, user.split()))
for i in range(4):
for j in range(4):
if b[i] == a[j]:
if i == j:
hit += 1
else:
blow += 1
print(hit, blow) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s957034663 | p00025 | Accepted | import sys
for line in sys.stdin:
hit = 0
blow = 0
if line == "\n":
break
A = line.split()
B = [n for n in input().split()]
for i in B:
if i in A:
if A.index(i) == B.index(i):
hit += 1
else:
blow += 1
print(hit, blow) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s730465797 | p00025 | Accepted | import sys
def main():
for line in sys.stdin:
a = list(map(int, line.split()))
b = list(map(int, input().split()))
hi, bl = 0, 0
for x in range(4):
for y in range(4):
if a[x] == b[y]:
if x == y:
hi += 1
else:
bl += 1
print(hi, bl)
if __name__ == "__main__":
main() | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s589360086 | p00025 | Accepted | # Aizu Problem 0025: Hit and Blow
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def hit_and_blow(A, B):
hit, blow = 0, 0
for k in range(4):
if A[k] == B[k]:
hit += 1
elif A[k] in B:
blow += 1
return hit, blow
while True:
try:
A = [int(_) for _ in input().split()]
except EOFError:
break
B = [int(_) for _ in input().split()]
hit, blow = hit_and_blow(A, B)
print(hit, blow) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s227949360 | p00025 | Accepted | def check(collect, answer):
hit = sum(1 for a, c in zip(answer, collect) if a is c)
blow = len(set(collect) & set(answer)) - hit
return (hit, blow)
while True:
try:
print(*check(input().split(), input().split()))
except EOFError:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s285619056 | p00025 | Accepted | # coding=utf-8
def hit_and_blow(answer: list, expect: list) -> tuple:
hit, blow = 0, 0
for (i, j) in zip(answer, expect):
if i == j:
hit += 1
answer_set = set(answer)
expect_set = set(expect)
blow_set = answer_set & expect_set
blow = len(blow_set) - hit
return hit, blow
if __name__ == '__main__':
while True:
try:
answer_number = list(map(int, input().split()))
expected_number = list(map(int, input().split()))
except EOFError:
break
h, b = hit_and_blow(answer_number, expected_number)
print(h, b) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s339850380 | p00025 | Accepted | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
hit = 0
blow = 0
for i, n in enumerate(a):
if b[i] == n:
hit += 1
elif n in b:
blow += 1
print(hit, blow) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s035652310 | p00025 | Accepted | while 1:
try:
a =[int(i) for i in input().split()]
b =[int(i) for i in input().split()]
hit=0
bro=0
for i in range(4):
if a[i]==b[i]:
hit=hit+1
for j in range(4):
if a[i]==b[j]:
bro=bro+1
print(hit,bro-hit)
except:break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s993802320 | p00025 | Accepted | while True:
try:
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
hit = blow = 0
for i in range(len(A)):
if A[i] == B[i]:
hit += 1
print(hit, end=" ")
for b in B:
if A.count(b) > 0:
blow += 1
print(blow - hit)
except:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s667514747 | p00025 | Accepted | def main():
while True:
try:
A = list(map(int,input().split()))
B = list(map(int,input().split()))
hit_count = 0
blow_count = 0
for i in range(4):
for j in range(4):
if A[i] == B[i]:
hit_count += 1
break
if A[i] == B[j]:
blow_count += 1
break
print(str(hit_count)+ " " + str(blow_count))
except EOFError:
break
if __name__ == '__main__':
main()
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s024886113 | p00025 | Accepted | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
hit = 0
blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
elif a[i] in b:
blow += 1
print(hit, blow)
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s794313713 | p00025 | Accepted | while True:
try:
Hflag,Bflag=0,0
a = map(int,raw_input().split())
b = map(int,raw_input().split())
for i in range(4):
if a[i] == b[i]:
Hflag += 1
else:
continue
for j in range(4):
for k in range(4):
if a[j] == b[k]:
Bflag += 1
else:
continue
Bflag = Bflag - Hflag
print Hflag, Bflag
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s905961385 | p00025 | Accepted | while True:
hit=0
bro=0
try:
a = [int(i) for i in input().split()]
b= [int(j) for j in input().split()]
for g in range(4):
for p in range(4):
if a[g]==b[p]:
bro+=1
for l in range(4):
if a[l]==b[l]:
hit+=1
bro-=1
print(hit,bro)
except:break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s233173552 | p00025 | Accepted | def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
N = list(get_input())
for l in range(0,len(N),2):
a = [int(i) for i in N[l].split()]
b = [int(i) for i in N[l+1].split()]
hit = 0
blow = 0
for i in range(len(a)):
for j in range(len(b)):
if a[i] == b[j]:
if i == j:
hit = hit+1
else:
blow = blow+1
print(hit,blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s119784178 | p00025 | Accepted | import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
h=sum([1 for i in range(4)if a[i]==b[i]])
w=4-len(set(a)-set(b))-h
print(h,w)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s160302673 | p00025 | Accepted | import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
h=sum([1 for i in range(4)if a[i]==b[i]])
print(h,4-len(set(a)-set(b))-h)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s361175317 | p00025 | Accepted | import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
h=0
for s,t in zip(a,b):h+=s==t
print(h,4-len(set(a)-set(b))-h)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s592859844 | p00025 | Accepted | import sys
e=iter(sys.stdin)
for a,b in zip(e,e):
a,b,h=a.split(),b.split(),0
for s,t in zip(a,b):h+=s==t
print(h,4-len(set(a)-set(b))-h)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s385941929 | p00025 | Accepted | while True:
try:
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
except:break
hit=sum([1 for i in range(4) if a[i]==b[i]])
blow=8-len(set(a)|set(b))-hit
print("{0} {1}".format(hit,blow))
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s035214841 | p00025 | Accepted | while 1:
hit = blow = 0
try: a = list(map(int,input().split()))
except: break
b = list(map(int,input().split()))
for i in range(4):
if a[i] == b[i]:
hit += 1
elif a[i] in b:
blow += 1
print(hit, blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s305428199 | p00025 | Accepted | import sys
a = []
for line in sys.stdin:
a.append(line.strip())
ita = iter(a)
for a, b in zip(ita, ita):
hit = 0
blow = 0
a = a.split(' ')
b = b.split(' ')
for a_, b_ in zip(a, b):
if a_ == b_:
hit += 1
elif a_ in b:
blow += 1
print(hit, blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s480809804 | p00025 | Accepted | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
hit = 0
blow = 0
for i in range(4):
try:
if i == a.index(b[i]):
hit += 1
else:
blow += 1
except:
pass
print("{} {}".format(hit, blow))
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s165153238 | p00025 | Accepted | import sys
count = 0
for line in sys.stdin:
if count % 2 == 0:
a = list(map(int, line.split()))
else:
b = list(map(int, line.split()))
hit, brow = 0, 0
for i in range(4):
if a[i] == b[i]:
hit += 1
elif a[i] in b:
brow += 1
print(hit, brow)
count += 1
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s717650805 | p00025 | Accepted | import sys
res=[]
for (l,text) in enumerate(sys.stdin):
if not l%2:
a=list(map(int,text.split()))
else:
h=0
b=0
for (i,j) in enumerate(map(int,text.split())):
if a[i]==j:
h=h+1
elif j in a:
b=b+1
res.extend([[h,b]])
[print(i[0],i[1]) for i in res]
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s702426423 | p00025 | Accepted | while True:
try:
alst = input().split()
blst = input().split()
hit = brow = 0
for i in range(4):
for j in range(4):
if alst[i] == blst[j]:
if i == j:
hit += 1
else:
brow += 1
print(hit, brow)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s382744504 | p00025 | Accepted | # AOJ 0025 Hit and Blow
# Python3 2018.6.16 bal4u
while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except: break
hit = blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
b[i] = -1
for i in range(4):
if b[i] >= 0:
if b[i] in a: blow += 1
print(hit, blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s310192054 | p00025 | Accepted | ans = []
while True:
try:
a = map(int,raw_input().split())
except EOFError:
break
b = map(int,raw_input().split())
n = 0
m = 0
for i in range(4):
if a[i] == b[i]:
n += 1
for i in range(0,4):
for j in range(0,4):
if a[i] == b[j]:
m += 1
m -= n
ans.append(str(n)+' '+str(m))
for i in ans:
print i | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s378553302 | p00025 | Accepted | while True:
try:
hit=0
brow=0
a = map(int,raw_input().split())
a1,b1,c1,d1 = a[0],a[1],a[2],a[3]
b = map(int,raw_input().split())
a2,b2,c2,d2 = b[0],b[1],b[2],b[3]
for c in range(4):
if a[c] == b[c]: hit +=1
for d in range(4):
if a[c]==b[d]:
if c == d:
break
brow += 1
print hit,brow
except EOFError:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s137695408 | p00025 | Accepted | while True:
try:
hit=0
blow =0
a,b = raw_input(),raw_input()
for x in range(0,7,2):
for y in range(0,7,2):
if a[x] == b[y]:
if x == y: hit+=1
else: blow +=1
print hit,blow
except EOFError:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s601192502 | p00025 | Accepted | import sys
def calc(listA, listB):
hit = 0
for i, j in zip(listA, listB):
if i == j:
hit += 1
brow = len(set(listA) & set(listB))
return (hit, brow-hit)
listA = list()
listB = list()
for i, line in enumerate(sys.stdin.readlines()):
line = line.strip()
if i % 2 == 0:
listA = map(int, line.split())
else:
listB = map(int, line.split())
print "{0:d} {1:d}".format(*calc(listA, listB)) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s975239913 | p00025 | Accepted | import sys
line=sys.stdin.readlines()
for A,B in zip(line[0::2],line[1::2]):
a=map(int,A.strip().split())
b=map(int,B.strip().split())
hit,blow=0,0
for i in xrange(4):
if a[i]==b[i]:hit+=1
elif a[i] in b : blow+=1
print hit,blow | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s080158742 | p00025 | Accepted |
while True:
try:
listA = map(str,raw_input().split(' '))
listB = map(str,raw_input().split(' '))
hit=0
blw=0
for tB in listB:
if (tB in listA) and (listB.index(tB) == listA.index(tB)):
hit += 1
elif (tB in listA) and (listB.index(tB) != listA.index(tB)):
blw += 1
print hit,blw
except EOFError:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s829768937 | p00025 | Accepted | while True:
try:
a = raw_input().split()
b = raw_input().split()
hit = reduce(lambda x,y:x+y,map(lambda x,y:x==y,a,b))
blow = reduce(lambda x,y:x+y,map(lambda x:x in b,a)) - hit
print hit, blow
except EOFError:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s789939670 | p00025 | Accepted | from __future__ import (division, absolute_import, print_function,
unicode_literals)
from sys import stdin
while True:
a = stdin.readline().strip()
if not a:
break
b = stdin.readline().strip()
if a == b:
print('4 0')
continue
hit = sum(int(a[i] == b[i]) for i in xrange(0, 7, 2))
blow = sum(int(b[i] in a) for i in xrange(0, 7, 2)) - hit
print(hit, blow) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s836431083 | p00025 | Accepted | while True:
try:
a=map(int,raw_input().split())
b=map(int,raw_input().split())
c1=0
c2=0
for i,e in enumerate(b):
if e in a:
if e==a[i]: c1+=1
else: c2+=1
print c1, c2
except:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s109097867 | p00025 | Accepted | while True:
try:
a = map(int, raw_input().split())
b = map(int, raw_input().split())
hit,blow = 0,0
for i in range(4):
if a[i] == b[i]:
hit += 1
else:
for j in range(4):
if a[i] == b[j]:
blow += 1
print hit, blow
except EOFError:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s188693932 | p00025 | Accepted | import sys
while True:
try:
a = map(int, raw_input().strip().split())
b = map(int, raw_input().strip().split())
hit = 0
blow = 0
for i in xrange(len(b)):
if b[i] in a:
blow += 1
if b[i] == a[i]:
hit += 1
blow -= hit
print "%d %d" % (hit, blow)
except EOFError:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s739962527 | p00025 | Accepted | while 1:
try:
a = map(int,raw_input().split())
b = map(int,raw_input().split())
c,d = 0,0
for i in enumerate(b):
if i[1] in a:
if a[i[0]] == i[1]:
c += 1
else:
d += 1
print c,d
except:
exit() | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s667370717 | p00025 | Accepted | while True:
try:
a = map(int, raw_input().split())
b = map(int, raw_input().split())
hit = 0; brow = 0
for i in range(len(b)) :
brow += a.count(b[i])
if a[i] == b[i] :
hit += 1
brow -= 1
print hit, brow
except:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s480718581 | p00025 | Accepted | import sys
f=0
for s in sys.stdin:
f=1-f
b=map(int,s.split())
if f:
a=b
continue
c1=0
c2=0
for i,e in enumerate(b):
if e==a[i]: c1+=1
elif e in a: c2+=1
print c1, c2 | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s509838873 | p00025 | Accepted | import sys
f=1
for s in sys.stdin:
b=map(int,s.split())
if f:
a=b
f=0
continue
c1=0
c2=0
for i,e in enumerate(b):
if e==a[i]: c1+=1
elif e in a: c2+=1
print c1, c2
f=1 | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s509403977 | p00025 | Accepted | while True:
try:
a = map(int, raw_input().split())
b = map(int, raw_input().split())
hit = 0
blow = 0
for na, nb in zip(a, b):
if na == nb: hit += 1
if nb in a: blow += 1
blow = blow - hit
print "{} {}".format(hit, blow)
except EOFError:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s962477521 | p00025 | Accepted | while 1:
try:
A = map(int, raw_input().split())
B = map(int, raw_input().split())
hit = sum(1 for i in range(4) if A[i] == B[i])
blow = len(set(A) & set(B)) - hit
print hit, blow
except:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s628954680 | p00025 | Accepted | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#from __future__ import print_function
import time
import sys
import io
import re
import math
start = time.clock()
while 1:
try:
a=map(int, raw_input().split())
b=map(int, raw_input().split())
j=k=0
for i in range(4):
if b[i]==a[i]:
j+=1
elif b[i] in a:
k+=1
print j,k
except:
break | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s300017033 | p00025 | Accepted | try:
while True:
a = map(int, raw_input().split())
b = map(int, raw_input().split())
p = q = 0
for i in range(len(b)):
if a[i] == b[i]:
p += 1
elif a.count(b[i]) != 0:
q += 1
print p, q
except:
pass | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s384585718 | p00025 | Accepted | import sys
lists=[]
for str in sys.stdin:
lists+=[tuple(str.rstrip().split(' '))]
for i in range(0,len(lists),2):
hit=0
blow=0
for j in range(4):
if lists[i][j]==lists[i+1][j]:
hit+=1
for c in lists[i]:
if c in lists[i+1]:
blow+=1
print '%d %d' % (hit,blow-hit) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s547737796 | p00025 | Accepted | import sys
lists = []
for str in sys.stdin:
lists+=[tuple(str.rstrip().split(' '))]
for i in range(0, len(lists), 2):
hit = brow = 0
for j in range(4):
if lists[i][j] == lists[i+1][j]:
hit += 1
for c in lists[i]:
if c in lists[i+1]:
brow += 1
print "%d %d"%(hit, brow-hit) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s471806877 | p00025 | Accepted | import sys
state = True
for s in sys.stdin:
if state:
state = not state
a = list(map(int, s.split()))
else:
state = not state
b = list(map(int, s.split()))
hit = sum(a[i] == b[i] for i in range(4))
blow = sum(b[i] in a for i in range(4)) - hit
print(hit, blow) | 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s062572233 | p00025 | Accepted | while True:
try:
data1 = list(map(int, input().split()))
#print(data1)
data2 = list(map(int,input().split()))
#print(data2)
except:
break
h = 0
b = 0
for i in range(4):
try:
if i == data1.index(data2[i]):
h = h + 1
else:
b = b + 1
except:
pass
print('{} {}'. format(h, b))
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s840647231 | p00025 | Accepted | while True:
try:
h=0
b=0
a1,a2,a3,a4=map(int,input().split())
b1,b2,b3,b4=map(int,input().split())
if a1==b1:
h+=1
if a2==b2:
h+=1
if a3==b3:
h+=1
if a4==b4:
h+=1
if a1==b2 or a1==b3 or a1==b4:
b+=1
if a2==b1 or a2==b3 or a2==b4:
b+=1
if a3==b1 or a3==b2 or a3==b4:
b+=1
if a4==b1 or a4==b2 or a4==b3:
b+=1
print(h,b)
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s136519606 | p00025 | Accepted | ans = 0
while True:
try:
a = list(int(x) for x in input().split())
b = list(int(x) for x in input().split())
except EOFError:
break
hit = 0
brow =0
for i in range(4):
if a[i] == b[i]:
hit += 1
else:
for j in range(4):
if(i != j and a[i] == b[j]):
brow += 1
print(str(hit)+' '+str(brow))
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s612986771 | p00025 | Accepted | while True:
try:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
except:
break
hit = 0
blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
for i in range(4):
if a[i] != b[i]:
if b[i] in a:
blow += 1
print(hit,blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s749610862 | p00025 | Accepted | while True:
try:
a=0
b=0
e1 =list(map(int,input().split()))
e2 =list(map(int,input().split()))
for i in range(4):
if e1[i]==e2[i]:
a+=1
for j in range(4):
if e1[i]==e2[j]:
b+=1
b = b-a
print(a,b)
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s466147015 | p00025 | Accepted | while True:
try:
A = list(map(int, input().split()));
except EOFError:
break;
B = list(map(int, input().split()));
h = 0;
b = 0;
for i in range(0,4):
if A[i] == B[i]:
h += 1;
else:
for j in range(0,4):
if A[j] == B[i]:
b += 1;
print(h,b);
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s652685724 | p00025 | Accepted | # coding: utf-8
# Your code here!
while True:
try:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
except:
break
hit=blow=0
for i in range(4):
if a[i]==b[i]:
hit+=1
for i in range(4):
if a[i]!=b[i]:
if b[i] in a:
blow+=1
print(hit,blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s393785925 | p00025 | Accepted | while 1:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
hit = 0
blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
for j in range(4):
if a[i] == b[j]:
blow += 1
blow -= hit
print(hit, blow)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s840911017 | p00025 | Accepted | while True:
try:
a=input().split()
b=input().split()
hit=0
blow=0
for i in range(4):
for j in range(4):
if(a[i]==b[i]):
hit+=1
break
if(a[i]==b[j]):
blow+=1
break
print(hit, blow)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s376159648 | p00025 | Accepted | while True:
try:
a=list(map(str,input().split()))
b=list(map(str,input().split()))
except EOFError:
break
c,d=0,0
for i in range(4):
if a[i]==b[i]:
c+=1
elif a[i] in b:
d+=1
print(c,d)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s459911405 | p00025 | Accepted | while 1:
try:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
hit = 0
blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
elif b[i] in a:
blow += 1
print(hit,blow)
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s974328958 | p00025 | Accepted | while True:
try:
a1,a2,a3,a4=map(int,input().split())
b1,b2,b3,b4=map(int,input().split())
A=[a1,a2,a3,a4]
B=[b1,b2,b3,b4]
b=0
h=0
for i in A:
if i in B:
b+=1
else:
continue
for i in range(4):
if A[i]==B[i]:
h+=1
else:
continue
print(h,b-h)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s592544866 | p00025 | Accepted | def x(m,n):
H = 0
B = 0
for i in range(4):
if m[i] == n[i]:
H += 1
else:
if m[i] in n:
B += 1
return(H, B)
while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(*x(a, b))
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s182314438 | p00025 | Accepted | while True:
try:
H=0; B=0;
a=list(map(int,input().split()))
b=list(map(int,input().split()))
except:
break
if a[0]==b[0]:
H+=1
if a[1]==b[1]:
H+=1
if a[2]==b[2]:
H+=1
if a[3]==b[3]:
H+=1
if a[0]==b[1] or a[0]==b[2] or a[0]==b[3]:
B+=1
if a[1]==b[0] or a[1]==b[2] or a[1]==b[3]:
B+=1
if a[2]==b[0] or a[2]==b[1] or a[2]==b[3]:
B+=1
if a[3]==b[0] or a[3]==b[1] or a[3]==b[2]:
B+=1
print(H, B)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s227245544 | p00025 | Accepted | while True:
try:
A=list(map(str,input().split()))
B=list(map(str,input().split()))
h=0
b=0
for i in range(4):
if A[i] in B:
b+=1
if A[i]==B[i]:
h+=1
print(h,b-h)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s785012234 | p00025 | Accepted | try:
while True:
a1,a2,a3,a4=map(int,input().split())
b1,b2,b3,b4=map(int,input().split())
h=0
b=0
if a1==b1:
h+=1
if a2==b2:
h+=1
if a3==b3:
h+=1
if a4==b4:
h+=1
A = [a1,a2,a3,a4]
B = [b1,b2,b3,b4]
for i in A:
for j in B:
if i == j:
b +=1
b = b - h
print(h,b)
except EOFError:
pass
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s856699136 | p00025 | Accepted | while True:
try:
A = input().split()
B = input().split()
h = 0
b = 0
for i in range(4):
for j in range(4):
if A[i] == B[j]:
if i == j:
h += 1
else:
b += 1
else:
pass
print(h, b)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s194351766 | p00025 | Accepted | while True:
try:
A = map(int,input().split())
ls_A = list(A)
B = map(int,input().split())
ls_B = list(B)
h = 0
b = 0
for i in range(len(ls_A)):
if ls_A[i] == ls_B[i]:
h += 1
if ls_A[0] == ls_B[1]:
b += 1
if ls_A[0] == ls_B[2]:
b += 1
if ls_A[0] == ls_B[3]:
b += 1
if ls_A[1] == ls_B[0]:
b += 1
if ls_A[1] == ls_B[2]:
b += 1
if ls_A[1] == ls_B[3]:
b += 1
if ls_A[2] == ls_B[0]:
b += 1
if ls_A[2] == ls_B[1]:
b += 1
if ls_A[2] == ls_B[3]:
b += 1
if ls_A[3] == ls_B[0]:
b += 1
if ls_A[3] == ls_B[1]:
b += 1
if ls_A[3] == ls_B[2]:
b += 1
print(h,b)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s243032583 | p00025 | Accepted | while True:
try:
a=list(input())
b=list(input())
a=[i for i in a if i!=' ']
b=[j for j in b if j!=' ']
hit=blow=0
for i in range(4):
for j in range(4):
if a[i]==b[j]:
if i==j:
hit+=1
else:
blow+=1
print(hit,blow)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s268211413 | p00025 | Accepted | while True:
try:
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = b = 0
for i in range(4):
if A[i] == B[i]:
a+=1
elif B[i] in A:
b+=1
print(a, b)
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s711164657 | p00025 | Accepted | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
hit, blow = 0, 0
for i in range(4):
if a[i] == b[i]:
hit += 1
elif (b[i] in a) == 1:
blow += 1
print(hit, blow)
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s400890701 | p00025 | Accepted | try:
while True:
L=0
M=0
A=list(map(int,input().split()))
B=list(map(int,input().split()))
for i in range(4):
if A[i]==B[i]:
L+=1
C=A.count(B[i])
if C>=1:
M+=1
print(L,M-L)
except EOFError:
pass
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s486480775 | p00025 | Accepted | while True:
try:
a = list(map(int,input().split()))
b = list (map(int,input().split()))
except:
break
hit = blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
for j in range(4):
if i != j and a[i] == b[j]:
blow +=1
print(hit,blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s183829334 | p00025 | Accepted | #0025
while True:
c = 0
d = 0
l = []
m = []
try:
a1,a2,a3,a4 = map(int,input().split())
b1,b2,b3,b4 = map(int,input().split())
except:
break
l.extend([a1,a2,a3,a4])
m.extend([b1,b2,b3,b4])
for i in range(4):
for k in range(4):
if l[i] == m[k]:
if i == k:
c += 1
else:
d += 1
print(c,d)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s550472041 | p00025 | Accepted | while True:
try:
a=input().split()
b=input().split()
except:
break
hit=0
blow=0
for i in range(4):
x=a.count(b[i])
blow+=x
if a[i]==b[i]:
hit+=1
blow-=1
print(hit,blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s335852190 | p00025 | Accepted | # coding: utf-8
# Your code here!
while True:
try:
A = list(input())
B = list(input())
for i in range(A.count(' ')):
A.remove(' ')
for i in range(B.count(' ')):
B.remove(' ')
#print(A, B)
h = 0 #ブロー数
b = 0 #ヒット数
for i in range(4):
for j in range(4):
if A[i] == B[j]:
if i == j:
h += 1
else:
b += 1
print(h, b)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s915954442 | p00025 | Accepted | while True:
try:
Alst = list(map(int, input().split()))
Blst = list(map(int, input().split()))
H = 0
B = 0
for a, anum in enumerate(Alst):
for b, bnum in enumerate(Blst):
if anum == bnum:
if a == b:
H = H + 1
else:
B = B + 1
print(str(H) + ' ' + str(B))
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s283041421 | p00025 | Accepted | while True:
try:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=[]
for i in range(4):
if B[i]==A[i]:
C.append("h")
elif B[i] in A:
C.append("b")
else:
pass
H=C.count("h")
B=C.count("b")
print(H,B)
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s847314304 | p00025 | Accepted | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
h = 0
bl = 0
for i in range(4):
if a[i] == b[i]:
h += 1
b[i] = 51
for i in range(4):
if a[i] in b:
bl += 1
print(h,bl)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s206722517 | p00025 | Accepted | while True:
try:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
except:
break
h=0
for i in range(4):
if A[i]==B[i]:
h+=1
b=0
for i in A:
if i in B:
b+=1
b-=h
print(h,b)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s472836976 | p00025 | Accepted | while True:
try:
a = [a for a in input().split()]
b = [b for b in input().split()]
except:
break
hit = 0
blow = 0
for i in range(4):
if b[i] in a :
blow += 1
if b[i]==a[i]:
hit += 1
blow = blow-hit
print(hit,blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s880380658 | p00025 | Accepted | while True :
try :
A = list(input().split())
B = list(input().split())
hit = 0
blow = 0
for i in range(4) :
if A[i] == B[i] :
hit += 1
elif B[i] in A :
blow += 1
print(hit, blow)
except :
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s413977908 | p00025 | Accepted | import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
*A, = map(int, readline().split())
*B, = map(int, readline().split())
v1 = v2 = 0
for i in range(4):
if A[i] == B[i]:
v1 += 1
for j in range(4):
if i != j and A[i] == B[j]:
v2 += 1
write("%d %d\n" % (v1, v2))
try:
while 1:
solve()
except:
...
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s919338497 | p00025 | Accepted | while True :
try :
a1, a2, a3, a4 = map(int, input().split())
b1, b2, b3, b4 = map(int, input().split())
except EOFError :
break
hit = 0
brow = 0
if a1 == b1 :
hit += 1
if a2 == b2 :
hit += 1
if a3 == b3 :
hit += 1
if a4 == b4 :
hit += 1
if a1 == b2 or a1 == b3 or a1 == b4 :
brow += 1
if a2 == b1 or a2 == b3 or a2 == b4 :
brow += 1
if a3 == b1 or a3 == b2 or a3 == b4 :
brow += 1
if a4 == b1 or a4 == b2 or a4 == b3 :
brow += 1
print(hit, brow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s068462280 | p00025 | Accepted | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except: break
hit = blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
b[i] = -1
for i in range(4):
if b[i] >= 0:
if b[i] in a:
blow += 1
print(hit, blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s515012923 | p00025 | Accepted | try:
while True:
#標準入力
a_line = list(map(int,input().split()))
b_line = list(map(int,input().split()))
num1 = 0
num2 = 0
#場所も番号も同じならnum1数字が同じならnum2にいれる
for num in range(0,4):
if a_line[num] == b_line[num]:
num1 += 1
continue
else:pass
if a_line[num] in b_line:num2 += 1
else:pass
print(str(num1) + " " + str(num2))
#EOFErrorをひろう
except EOFError:
pass
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s570282499 | p00025 | Accepted | while True:
try:
alist = input().split()
blist = input().split()
hit = brow = 0
for i in range(4):
for j in range(4):
if alist[i] == blist[j]:
if i == j:
hit += 1
else:
brow += 1
print(hit,brow)
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s063587487 | p00025 | Accepted | while True:
try:
a = list(int(x) for x in input().split())
b = list(int(x) for x in input().split())
except EOFError:
break
hit = 0
brow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
else:
for j in range(4):
if(i != j and a[i] == b[j]):
brow += 1
print(str(hit) + " " + str(brow))
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s082318304 | p00025 | Accepted | c = 0
while True:
try:
if c % 2 == 0:
A = [int(x) for x in input().split()]
else:
B = [int(x) for x in input().split()]
hit = blow = 0
for i in range(len(B)):
if A[i] == B[i]:
hit += 1
else:
if B[i] in A:
blow += 1
print(hit,blow)
c += 1
except EOFError:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s721617081 | p00025 | Accepted | """while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except: break
hit = blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
b[i] = -1
for i in range(4):
if b[i] >= 0:
if b[i] in a: blow += 1
print(hit, blow)
"""
while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
except:
break
hit = blow = 0
for i in range(4):
if (a[i] == b[i]):
hit += 1
b[i] = -1
for i in range(4):
if b[i] >= 0:
if b[i] in a:
blow += 1
print(hit, blow)
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
s085692196 | p00025 | Accepted | while True:
try:
a=list(map(int, input().split()))
#print("a",a)
b=list(map(int, input().split()))
#print("b",b)
hit=0
blow=0
for i in range(len(b)):
if b[i] in a:
if b[i]==a[i]:
hit+=1
else:
blow+=1
print(hit,blow,)
except:
break
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
|
<H1>Hit and Blow</H1>
<p>
Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers:
</p>
<ul>
<li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li>
<li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li>
</ul>
<p>
For example, if <i>A</i> imagined numbers:
</p>
<pre>
9 1 8 2
</pre>
<p>
and <i>B</i> chose:
</p>
<pre>
4 1 5 9
</pre>
<p>
<i>A</i> should say 1 Hit and 1 Blow.
</p>
<p>
Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset set consists of:
</p>
<pre>
<var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var>
<var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var>
</pre>
<p>
, where <var>a<sub>i</sub></var> (0 ≤ <var>a<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 ≤ <var>b<sub>i</sub></var> ≤ 9) is <var>i</var>-th number <i>B</i> chose.
</p>
<p>
The input ends with EOF. The number of datasets is less than or equal to 50.
</P>
<H2>Output</H2>
<p>
For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
</pre>
<H2>Output for the Sample Input</H2>
<pre>
1 1
3 0
</pre>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.