s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1 value | original_language stringclasses 11 values | filename_ext stringclasses 1 value | status stringclasses 1 value | cpu_time int64 0 100 | memory stringlengths 4 6 | code_size int64 15 14.7k | code stringlengths 15 14.7k | problem_id stringlengths 6 6 | problem_description stringlengths 358 9.83k | input stringlengths 2 4.87k | output stringclasses 807 values | __index_level_0__ int64 1.1k 1.22M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s989421525 | p00024 | u491763171 | 1400482441 | Python | Python | py | Accepted | 10 | 4240 | 157 | while 1:
try:
speed = input()
except EOFError:
break
height = 4.9 * (speed / 9.8) ** 2
print int(round(height / 5 + 0.5)) + 1 | p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,702 |
s146856237 | p00024 | u436634575 | 1401164960 | Python | Python3 | py | Accepted | 30 | 6836 | 134 | from math import ceil
import sys
for s in sys.stdin:
v = float(s)
y = 4.9*(v / 9.8)**2
n = ceil((y + 5) / 5)
print(n) | p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,703 |
s431009200 | p00024 | u747915832 | 1597133809 | Python | Python3 | py | Accepted | 20 | 5588 | 177 | while True:
try:
v = float(input())
except:
break
H = 4.9*((v/9.8)**2)
if H%5==0:
print(int(H/5)+1)
else:
print(int(H//5)+2)
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,704 |
s352886723 | p00024 | u240091169 | 1594887570 | Python | Python3 | py | Accepted | 20 | 5588 | 236 | while True :
try :
v = float(input())
except EOFError :
break
y = v**2/19.6
i = 1
while True :
height = 5 * (i - 1)
if height >= y :
break
i += 1
print(i)
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,705 |
s389763672 | p00024 | u630911389 | 1584900714 | Python | Python3 | py | Accepted | 20 | 5576 | 200 | while(1):
try:
toV = float(input())
t = toV / 9.8
needHeight = 4.9 * (t ** 2)
floor = (needHeight + 5) / 5
print(int(floor) + 1)
except:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,706 |
s121678206 | p00024 | u350155409 | 1575092368 | Python | Python3 | py | Accepted | 20 | 5640 | 159 | import sys
import math
for s in sys.stdin:
v = float(s)
t = v/9.8
h = 4.9*v*v/(9.8*9.8)
print(math.ceil((h+5)/5))
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,707 |
s814994646 | p00024 | u803862921 | 1571827458 | Python | Python3 | py | Accepted | 20 | 5584 | 191 | while True:
try:
v = float(input())
except:
break
y = (v/9.8) ** 2 * 4.9
f = int(y/5)
if y > f * 5:
f += 1
print(f+1)
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,708 |
s691322698 | p00024 | u595265835 | 1570529480 | Python | Python3 | py | Accepted | 20 | 5584 | 241 | while True:
try:
v = float(input())
h = (v / 9.8) * (v / 9.8) * 4.9
N = (h + 5) / 5
N1 = (h + 5) // 5
if (N - N1 > 0):
N1 += 1
print(int(N1))
except EOFError:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,709 |
s224887626 | p00024 | u472768263 | 1570450112 | Python | Python3 | py | Accepted | 30 | 6424 | 481 | import decimal
import math
while True:
try:
x=float(input())
#print("x",x)
N=1
while True:
h=5*N-5 #h=height
decimal.getcontext().prec=4 #小数点以下を指定
v=decimal.Decimal(9.8*(math.sqrt(h/4.9))) #v=velocity
if v>=x:
print(N)
break
N+=1
except:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,710 |
s104332216 | p00024 | u824708460 | 1566312494 | Python | Python3 | py | Accepted | 20 | 5636 | 162 | import math
while 1:
try:
v = float(input())
t = v / 9.8
y = 4.9 * t * t
print(math.ceil((y+5)/5))
except:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,711 |
s787430611 | p00024 | u313600138 | 1563027866 | Python | Python3 | py | Accepted | 20 | 5568 | 115 | while True:
try:
v = float(input())
print((int)(v**2 / 19.6) // 5+2)
except:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,712 |
s408261777 | p00024 | u804558166 | 1560750988 | Python | Python3 | py | Accepted | 20 | 5644 | 167 | import math
while True:
try:
v = float(input())
t = v/9.8
y = 4.9*t**2
print(math.ceil((y + 5.0)/5.0))
except:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,713 |
s124602309 | p00024 | u548252256 | 1560180388 | Python | Python3 | py | Accepted | 20 | 5640 | 188 | import math
if __name__ == '__main__':
while True:
try:
v = float(input())
y = 4.9 * (v / 9.8)*(v / 9.8)
N = math.ceil((y + 5) / 5)
print(N)
except EOFError:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,714 |
s230223554 | p00024 | u506537276 | 1560150096 | Python | Python3 | py | Accepted | 20 | 5576 | 175 | while True:
try:
v = float(input())
t = v / 9.8
y = 4.9 * t * t
n = 1
while 5 * (n - 1) < y:
n += 1
print(n)
except EOFError:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,715 |
s863239230 | p00024 | u625806423 | 1557134547 | Python | Python3 | py | Accepted | 20 | 5636 | 162 | import math
while True:
try:
v_i = float(input())
except EOFError:
break
t = v_i / 9.8
y = 4.9 * t**2
flr = (y + 5) // 5 + 1
print(int(flr))
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,716 |
s757235714 | p00024 | u563075864 | 1542860372 | Python | Python3 | py | Accepted | 20 | 5640 | 143 | from math import ceil
while(1):
try:
a = float(input())
t = a/9.8
y = 4.9*t**2
n = ceil((y+5)/5)
print(n)
except EOFError:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,717 |
s925337813 | p00024 | u067299340 | 1542186771 | Python | Python3 | py | Accepted | 30 | 5676 | 328 | from bisect import *
n = 1
max_v = 0
v_map = [0.0] * 500
while max_v < 200:
h = 5 * n - 5
t = (h / 4.9)**0.5
v_map[n - 1] = 9.8 * t
#print(n,h,t,v_map[n-1])
max_v = max(v_map)
n += 1
while True:
try:
x = float(input())
print(bisect(v_map, x) + 1)
except EOFError:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,718 |
s095433438 | p00024 | u717526540 | 1541664116 | Python | Python3 | py | Accepted | 20 | 5584 | 158 | while(1):
try:
n = float(input())
except:
break
t = n / 9.8
y = 4.9 * t ** 2
ans = (y + 5) // 5 + 1
print(int(ans))
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,719 |
s662005093 | p00024 | u219940997 | 1537456114 | Python | Python3 | py | Accepted | 20 | 5644 | 196 | import math
def physical(v):
t = v / 9.8
y = 4.9 * t * t
ans = math.ceil(y / 5) + 1
return ans
while True:
try: n = float(input())
except: break
print(physical(n))
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,720 |
s937002457 | p00024 | u252700163 | 1537199685 | Python | Python3 | py | Accepted | 30 | 5640 | 226 | import math
while True:
try:
V = float(input())
for n in range(1, 1000):
height = 5 * n - 5
t = math.sqrt( height/4.9 )
v = 9.8 * t
if v >= V:
break
print(n)
except:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,721 |
s251526139 | p00024 | u319725914 | 1534231293 | Python | Python3 | py | Accepted | 20 | 5580 | 117 | while(True):
try:
v = float(input())
print(int((4.9*(v/9.8)**2)/5)+2)
except:
break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,722 |
s432700318 | p00024 | u539753516 | 1534072893 | Python | Python3 | py | Accepted | 20 | 5636 | 96 | import math
while 1:
try:
print(math.ceil(float(input())**2/98)+1)
except:break
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,723 |
s521950427 | p00024 | u079141094 | 1516620377 | Python | Python3 | py | Accepted | 20 | 5648 | 366 | import sys
import math
def solve():
vs = [float(s) for s in sys.stdin]
for v0 in vs:
N, v = 1, 0.0
while True:
y = 5 * N - 5
v = math.sqrt(2 * 9.8 * y)
if v > v0:
print(N)
break
else:
N += 1
if __name__ == "__main__":
solve()
| p00024 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>Physical Experiments</H1>
<p>
Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:<br/>
<br/>
$ v = 9.8 t $<br/>
$ y = 4.9 t^2 $<br/>
</p>
<!--
<center><img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_physical"></center>
-->
<p>
A person is trying to drop down a glass ball and check whether it will crack. Your task is to write a program to help this experiment.
</p>
<p>
You are given the minimum velocity to crack the ball. Your program should print the lowest possible floor of a building to crack the ball. The height of the $N$ floor of the building is defined by $5 \times N - 5$.
</p>
<H2>Input</H2>
<p>
The input consists of multiple datasets. Each dataset, a line, consists of the minimum velocity <i>v</i> (0 < <i>v</i> < 200) to crack the ball. The value is given by a decimal fraction, with at most 4 digits after the decimal point. 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 lowest possible floor where the ball cracks.
</p>
<H2>Sample Input</H2>
<pre>
25.4
25.4
</pre>
<H2>Output for the Sample Input</H2>
<pre>
8
8
</pre>
| 25.4
25.4
| 8
8
| 7,724 |
s894905979 | p00025 | u525366883 | 1535594785 | Python | Python | py | Accepted | 10 | 4640 | 311 | while True:
try:
a = map(int, raw_input().split())
b = map(int, raw_input().split())
hit = 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
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,725 |
s326950980 | p00025 | u647694976 | 1555927753 | Python | Python3 | py | Accepted | 20 | 5592 | 428 | while True:
try:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
hit,blow=0,0
ac=0
for i in a:
bc=0
ac +=1
for j in b:
bc +=1
if i==j:
if ac==bc:
hit +=1
else:
blow +=1
print(hit,blow)
except:break
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,726 |
s270750161 | p00025 | u555040407 | 1559368010 | Python | Python3 | py | Accepted | 20 | 5568 | 291 | # -*- coding: utf-8 -*-
while True:
try:
A, B = input().split(), input().split()
hit = sum([ 1 for i in range(len(A)) if A[i]==B[i] ])
blow = sum([ 1 for i in range(len(A)) if B[i] in A ]) - hit
print(str(hit) + ' ' +str(blow))
except:
break
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,727 |
s707735152 | p00025 | u555040407 | 1559368035 | Python | Python3 | py | Accepted | 20 | 5572 | 291 | # -*- coding: utf-8 -*-
while True:
try:
A, B = input().split(), input().split()
hit = sum([ 1 for i in range(len(A)) if A[i]==B[i] ])
blow = sum([ 1 for i in range(len(A)) if B[i] in A ]) - hit
print(str(hit) + ' ' +str(blow))
except:
break
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,728 |
s047587043 | p00025 | u560838141 | 1408858587 | Python | Python | py | Accepted | 10 | 4216 | 295 |
while True:
try:
a_list = map(int, raw_input().strip().split(" "));
b_list = map(int, raw_input().strip().split(" "));
except:
break;
hit, blow = 0, 0
for a, b in zip(a_list, b_list):
if (a == b):
hit += 1;
elif(a in b_list):
blow += 1;
print hit, blow | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,729 |
s128981007 | p00025 | u733620181 | 1409854804 | Python | Python | py | Accepted | 20 | 4216 | 270 | while True:
try:
a = map(int, raw_input().split())
b = map(int, raw_input().split())
except:
break
ab = zip(a, b)
hit = 0
blow = 0
for xa, xb in ab:
if xa == xb:
hit += 1
elif xa in b:
blow += 1
print('%d %d' % (hit, blow)) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,730 |
s790237858 | p00025 | u506132575 | 1416135819 | Python | Python | py | Accepted | 10 | 4344 | 347 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import math
tf = True
for s in sys.stdin:
if tf:
a = map(int,s.split())
tf = False
continue
else:
b = map(int,s.split())
tf = True
print sum([ 1 for i in range(4) if a[i]==b[i] ]),
print sum([ 1 for i in range(4) for j in range(4) if i != j and a[i] == b[j] ]) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,731 |
s396259638 | p00025 | u567380442 | 1422623007 | Python | Python3 | py | Accepted | 30 | 6724 | 269 | import sys
lines = [list(map(int, line.split())) for line in sys.stdin]
for i in range(0, len(lines), 2):
a = lines[i]
b = lines[i + 1]
hit = sum(1 for i in range(len(a)) if a[i] == b[i])
blow = sum(1 for bi in b if bi in a) - hit
print(hit, blow) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,732 |
s890121770 | p00025 | u879226672 | 1424681564 | Python | Python | py | Accepted | 20 | 4236 | 640 |
def Hit(an_list,bn_list):
n = 0
for a in enumerate(an_list):
for b in enumerate(bn_list):
if a == b:
n +=1
return n
def Blow(an_list,bn_list):
n = 0
for an in an_list:
for bn in bn_list:
if an == bn:
n +=1
return n
while True:
try:
[a1,a2,a3,a4] = map(int,raw_input().split())
[b1,b2,b3,b4] = map(int,raw_input().split())
except EOFError:
break
an_list = [a1,a2,a3,a4]
bn_list = [b1,b2,b3,b4]
hit = Hit(an_list,bn_list)
blow = Blow(an_list,bn_list)
print "%d %d" % (hit,blow-hit) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,733 |
s755592086 | p00025 | u744114948 | 1425520898 | Python | Python3 | py | Accepted | 30 | 6720 | 463 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright : @Huki_Hara
# Created : 2015-03-05
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):
for j in range(4):
if i != j and a[i] == b[j]: blow += 1
print(str(hit) + " " + str(blow)) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,734 |
s104565020 | p00025 | u540744789 | 1428076617 | Python | Python | py | Accepted | 10 | 4204 | 308 | while True:
try:
L1=map(int,raw_input().split())
L2=map(int,raw_input().split())
hit,blow=0,0
for i in range(4):
blow+=L1.count(L2[i])
if L1[i]==L2[i]:
blow-=1
hit+=1
print hit,blow
except:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,735 |
s262403123 | p00025 | u873482706 | 1434547169 | Python | Python | py | Accepted | 20 | 4216 | 395 | def check():
count1 = 0
for i in range(4):
if A[i] == B[i]:
count1 += 1
count2 = 0
for v in B:
if v in A:
count2 += 1
Hit = count1
Blow = count2 - count1
print Hit, Blow
while True:
try:
A = list(raw_input().split())
B = list(raw_input().split())
check()
except EOFError:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,736 |
s562413057 | p00025 | u379956761 | 1435153205 | Python | Python3 | py | Accepted | 30 | 6720 | 414 | import sys
def hitBlow(a, b):
hit = 0
blow = 0
for i in range(len(a)):
if a[i] == b[i]:
hit += 1
else:
for j in range(len(b)):
if a[i] == b[j]:
blow += 1
return [hit, blow]
for s in sys.stdin:
a = list(map(int, s.split()))
b = list(map(int, input().split()))
hit, blow = hitBlow(a, b)
print(hit, blow) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,737 |
s477121779 | p00025 | u071010747 | 1445312673 | Python | Python3 | py | Accepted | 20 | 7400 | 505 | # -*- coding:utf-8 -*-
def main():
while True:
try:
A=input().split()
B=input().split()
Hit=0
Blow=0
for b in B:
if b in A:
index=B.index(b)
if b==A[index]:
Hit+=1
else:
Blow+=1
print(Hit,Blow)
except:
break
if __name__ == '__main__':
main() | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,738 |
s312297352 | p00025 | u011621222 | 1448049610 | Python | Python | py | Accepted | 20 | 6316 | 365 | while True:
try:
s1 = raw_input()
s2 = raw_input()
a = map(int, s1.split())
b = map(int, s2.split())
hashMap = {}
hit = 0
blow = 0
for i in range(len(a)):
hashMap[a[i]] = i
for i in range(len(b)):
if b[i] in hashMap:
if hashMap[b[i]] == i:
hit += 1
else:
blow += 1
print '%s %s' % (hit, blow)
except (EOFError):
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,739 |
s907919165 | p00025 | u461370825 | 1449743681 | Python | Python | py | Accepted | 10 | 6384 | 328 | from math import *
PI = 3.1415926535898
while True:
try:
a = map(int, raw_input().strip().split(' '))
b = map(int, raw_input().strip().split(' '))
hit = 0
blow = 0
for i in range(len(a)):
if a[i] == b[i]:
hit += 1
elif b.count(a[i]) > 0:
blow += 1
print "%d %d" % (hit, blow)
except EOFError:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,740 |
s686969749 | p00025 | u560214129 | 1450460160 | Python | Python3 | py | Accepted | 20 | 7472 | 752 |
import sys
def hit_blow(num):
hits = 0
blows = 0
emp1 = [0,0,0,0]
emp2 = [0,0,0,0]
num.append(emp1)
num.append(emp2)
for i in range(0,4):
i = i*2
for j in range(0,4):
j = j*2
if num[0][i] == num[1][j] and num[2][int(i/2)] == 0 and num[3][int(j/2)] == 0:
if i ==j :
hits += 1
else:
blows += 1
num[2][int(i/2)] = 1
num[3][int(j/2)] = 1
print(hits,blows)
flag = 0
num = []
for line in sys.stdin.readlines():
if flag == 0:
num.append(line)
flag = 1
elif flag == 1:
num.append(line)
flag = 2
if flag == 2:
flag = 0
hit_blow(num)
del num[:] | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,741 |
s696861977 | p00025 | u560214129 | 1450460225 | Python | Python3 | py | Accepted | 20 | 7468 | 752 |
import sys
def hit_blow(num):
hits = 0
blows = 0
emp1 = [0,0,0,0]
emp2 = [0,0,0,0]
num.append(emp1)
num.append(emp2)
for i in range(0,4):
i = i*2
for j in range(0,4):
j = j*2
if num[0][i] == num[1][j] and num[2][int(i/2)] == 0 and num[3][int(j/2)] == 0:
if i ==j :
hits += 1
else:
blows += 1
num[2][int(i/2)] = 1
num[3][int(j/2)] = 1
print(hits,blows)
flag = 0
num = []
for line in sys.stdin.readlines():
if flag == 0:
num.append(line)
flag = 1
elif flag == 1:
num.append(line)
flag = 2
if flag == 2:
flag = 0
hit_blow(num)
del num[:] | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,742 |
s084381070 | p00025 | u075836834 | 1458250204 | Python | Python3 | py | Accepted | 50 | 7752 | 328 | while True:
try:
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
#Hit
hit=0
for i in range(len(A)):
if A[i]==B[i]:
hit+=1
#Blow
blow=0
for i in range(len(A)):
for j in range(len(A)):
if i!=j:
if A[i]==B[j]:
blow+=1
print(hit,blow)
except EOFError:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,743 |
s045698015 | p00025 | u650459696 | 1458719350 | Python | Python3 | py | Accepted | 20 | 7588 | 270 | while True:
try:
x = list(map(int,input().split()))
except:
break
y = list(map(int,input().split()))
h, b = 0, 0
for i in range(4):
if x[i] == y[i]:
h += 1
elif y[i] in x:
b += 1
print(h, b) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,744 |
s889332917 | p00025 | u148101999 | 1459241020 | Python | Python | py | Accepted | 20 | 6252 | 304 |
import sys
hit, brow = 0, 0
a, b = [], []
for i in sys.stdin:
a.append(map(int, i.split()))
for i in xrange(0,len(a),2):
for j in xrange(4):
if a[i][j] == a[i + 1][j]:
hit += 1
elif a[i + 1][j] in a[i]:
brow += 1
print hit, brow
brow, hit = 0, 0 | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,745 |
s343083433 | p00025 | u966364923 | 1459427003 | Python | Python3 | py | Accepted | 20 | 7532 | 367 | import sys
inputs = []
for line in sys.stdin:
inputs.append(line)
n = len(inputs)
for _ in range(n // 2):
a = list(map(int, inputs[_ * 2].split()))
b = list(map(int, inputs[_ * 2 + 1].split()))
hit = 0
blow = 0
for i in range(4):
if b[i] == a[i]:
hit += 1
elif b[i] in a:
blow += 1
print(hit, blow) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,746 |
s301876723 | p00025 | u130979865 | 1459950833 | Python | Python | py | Accepted | 10 | 6456 | 470 | # -*- coding: utf-8 -*-
import sys
lines = sys.stdin.readlines()
for i in range(len(lines)/2):
line1 = lines[2*i]
line2 = lines[2*i+1]
hit = blow = 0
A = map(int, line1.split())
B = map(int, line2.split())
for i in range(4):
if A[i] == B[i]:
hit += 1
for i in range(4):
for j in range(4):
if A[i] == B[j]:
blow += 1
break
blow -= hit
print "%d %d" %(hit, blow) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,747 |
s435593584 | p00025 | u572790226 | 1460613244 | Python | Python3 | py | Accepted | 20 | 7544 | 353 | import sys
Lines = sys.stdin.readlines()
for i in range(0, len(Lines), 2):
Anumbers = list(map(int, Lines[i].split()))
Bnumbers = list(map(int, Lines[i+1].split()))
Hit = 0
for j in range(len(Anumbers)):
Hit += 1 if (Anumbers[j] == Bnumbers[j]) else 0
Blow = len(set(Anumbers) & set(Bnumbers)) - Hit
print(Hit, Blow) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,748 |
s390599546 | p00025 | u894114233 | 1463041572 | Python | Python | py | Accepted | 10 | 6320 | 404 | while 1:
try:
a=map(int,raw_input().split())
b=map(int,raw_input().split())
hi=0
bl=0
for i in xrange(4):
for j in xrange(4):
if i==j:
if a[i]==b[j]:
hi+=1
else:
if a[i]==b[j]:
bl+=1
print hi,bl
except:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,749 |
s053732939 | p00025 | u203261375 | 1466907688 | Python | Python3 | py | Accepted | 30 | 7548 | 359 | import sys
for line in sys.stdin:
arrA,arrB = [],[]
s = line.split()
for i in s:
arrA.append(int(i))
s = input().split()
for i in s:
arrB.append(int(i))
h,b = 0,0
for i in range(len(arrA)):
if arrA[i] == arrB[i]:
h += 1
elif arrB.count(arrA[i]) > 0:
b += 1
print(h,b) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,750 |
s269762353 | p00025 | u766477342 | 1467155222 | Python | Python3 | py | Accepted | 20 | 7380 | 277 | try:
while 1:
a = input().split()
b = input().split()
s = 0
v = 0
for i in range(len(a)):
if a[i] == b[i]:
s += 1
elif a[i] in b:
v += 1
print(*(s, v))
except:
pass | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,751 |
s098827330 | p00025 | u300946041 | 1468670422 | Python | Python3 | py | Accepted | 30 | 7720 | 374 | # -*- coding: utf-8 -*-
def main(a, b):
hit = 0
blow = 0
for a_e, b_e in zip(a, b):
if a_e == b_e:
hit += 1
elif a_e in b:
blow += 1
print(hit, blow, sep=' ')
while True:
try:
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]
except:
break
main(a, b) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,752 |
s361754074 | p00025 | u896025703 | 1469597594 | Python | Python3 | py | Accepted | 20 | 7588 | 281 | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
hit = blow = 0
for i in range(4):
for j in range(4):
if i == j and a[i] == b[j]: hit += 1
if i != j and a[i] == b[j]: blow += 1
print(hit, blow)
except EOFError:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,753 |
s215748475 | p00025 | u146816547 | 1469983957 | Python | Python | py | Accepted | 10 | 6360 | 275 | while True:
try:
a = map(int, raw_input().split())
b = map(int, raw_input().split())
hit = 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 EOFError:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,754 |
s044817672 | p00025 | u358919705 | 1471989405 | Python | Python3 | py | Accepted | 20 | 7568 | 336 | 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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,755 |
s400242483 | p00025 | u379499530 | 1473135378 | Python | Python | py | Accepted | 20 | 6252 | 306 | while 1:
try:
a = map(int, raw_input().split())
b = map(int, raw_input().split())
for i in xrange(3, -1, -1):
if a[i] == b[i]:
del a[i]
del b[i]
print str(4 - len(a)) + " " + str(len(set(a) & set(b)))
except:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,756 |
s857823115 | p00025 | u862440080 | 1473937872 | Python | Python3 | py | Accepted | 30 | 7568 | 237 | while True:
try:
ansa=input().split()
ansb=input().split()
except:
break
hit = sum((1 for a, b in zip(ansa, ansb) if a == b))
blow = sum((1 for a in ansa if a in ansb))
print(hit, blow - hit) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,757 |
s205529413 | p00025 | u393305246 | 1474364012 | Python | Python | py | Accepted | 10 | 6384 | 405 | import sys
a = []
for line in sys.stdin:
a.append(line)
time=0
for n in a:
if time==0:
Alist=n.split()
time=1
else:
Blist=n.split()
hit=0
blow=0
for i in range(4):
if Blist[i]==Alist[i]:
hit+=1
else:
if Blist[i] in Alist:
blow+=1
time=0
print hit,blow | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,758 |
s520949703 | p00025 | u964040941 | 1479239367 | Python | Python3 | py | Accepted | 60 | 7560 | 417 | 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 = 0
for i in range(len(a)):
if a [i] == b [i]:
hit += 1
blow = -hit
for i in range(10):
blow += min(a.count(i),b.count(i))
print(hit,blow) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,759 |
s888831597 | p00025 | u922871577 | 1479442435 | Python | Python | py | Accepted | 10 | 6360 | 351 | import sys
turn = -1
for line in sys.stdin:
turn += 1
if turn%2 == 0:
A = map(int, line.rstrip().split())
continue
else:
B = map(int, line.rstrip().split())
hit, blow = 0, 0
for i, b in enumerate(B):
if A[i] == b:
hit += 1
elif b in A:
blow += 1
print hit, blow | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,760 |
s312913878 | p00025 | u777299405 | 1479895593 | Python | Python3 | py | Accepted | 20 | 7716 | 312 | import sys
Even = True
for s in sys.stdin:
if Even:
Even = False
a = list(map(int, s.split()))
else:
Even = True
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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,761 |
s070989071 | p00025 | u777299405 | 1479895655 | Python | Python3 | py | Accepted | 20 | 7648 | 312 | import sys
even = True
for s in sys.stdin:
if even:
even = False
a = list(map(int, s.split()))
else:
even = True
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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,762 |
s562130706 | p00025 | u301729341 | 1481041440 | Python | Python3 | py | Accepted | 20 | 7648 | 391 | while True:
try:
hit = 0
brow = 0
Anum = list(map(int,input().split()))
Bnum = list(map(int,input().split()))
for i in range(4):
if Anum[i] == Bnum[i]:
hit += 1
elif Bnum[i] in Anum:
brow +=1
print(hit,brow)
except EOFError:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,763 |
s769754510 | p00025 | u252368621 | 1481342846 | Python | Python3 | py | Accepted | 30 | 7616 | 465 | import sys
while(True):
try:
hit=0
blow=0
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
for i in range(len(a)):
for j in range(len(b)):
if a[i]==b[j]:
if i==j:
hit+=1
else:
blow+=1
break
print(hit,blow)
except EOFError:
sys.exit()
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,764 |
s406680810 | p00025 | u811733736 | 1481617233 | Python | Python3 | py | Accepted | 30 | 7636 | 909 | import sys
if __name__ == '__main__':
data = []
for line in sys.stdin:
data.append([int(x) for x in line.strip().split(' ')])
if len(data) == 2:
choice_a = data[0]
choice_b = data[1]
data = []
#print(choice_a)
#print(choice_b)
# hit&blow?????????
hit = 0
blow = 0
# for i, d in enumerate(choice_a):
# if d in choice_b:
# if choice_a[i] == choice_b[i]:
# hit += 1
# else:
# blow += 1
for i, d in enumerate(choice_a):
if d in choice_b:
if d == choice_b[i]:
hit += 1
else:
blow += 1
# ???????????¨???
print('{0} {1}'.format(hit, blow)) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,765 |
s694480294 | p00025 | u546285759 | 1481795376 | Python | Python3 | py | Accepted | 30 | 7636 | 324 | while True:
try:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
hit = sum(1 for x, y in zip(a, b) if x == y)
hits = [x for x, y in zip(a, b) if x == y]
blow = sum(1 for x in a if x in b and x not in hits)
print(hit, blow)
except:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,766 |
s870219361 | p00025 | u661290476 | 1482233513 | Python | Python3 | py | Accepted | 20 | 7568 | 273 | while True:
try:
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
except:
break
hit,blow=0,0
for i,j in zip(a,b):
if i==j:
hit+=1
elif j in a:
blow+=1
print(hit,blow) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,767 |
s695399465 | p00025 | u711765449 | 1484464448 | Python | Python3 | py | Accepted | 20 | 7664 | 431 | def hit_blow(a,b):
hit = 0
blow = 0
for i in range(4):
if a[i] == b[i]:
hit += 1
for i in range(4):
for j in range(4):
if a[i] == b[j]:
blow += 1
blow -= hit
print(hit,blow)
return 0
while True:
try:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
hit_blow(a,b)
except EOFError:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,768 |
s708504975 | p00025 | u078042885 | 1486066619 | Python | Python3 | py | Accepted | 30 | 7628 | 197 | while 1:
try:a=list(map(int,input().split()))
except:break
b=list(map(int, input().split()))
h=0
for i in range(4):
if a[i]==b[i]: h+=1
print(h,len(set(a)&set(b))-h) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,769 |
s753132340 | p00025 | u078042885 | 1486066780 | Python | Python3 | py | Accepted | 30 | 7516 | 178 | while 1:
try:a=list(map(int,input().split()))
except:break
b=list(map(int, input().split()))
h=0
for i,j in zip(a,b):h+=i==j
print(h,len(set(a)&set(b))-h) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,770 |
s688971948 | p00025 | u252414452 | 1486147724 | Python | Python | py | Accepted | 10 | 6404 | 309 | import sys
while True:
a = sys.stdin.readline()
if not a: break
a = a.rstrip().split(" ")
b = raw_input().rstrip().split(" ")
hit=0
for i in range(len(a)):
if a[i] == b[i]:
hit+=1
a[i] = -1
blow=0
for e in b:
if e in a:
blow+=1
print("{} {}").format(hit, blow) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,771 |
s872929175 | p00025 | u032662562 | 1486645540 | Python | Python3 | py | Accepted | 20 | 7496 | 597 | while True:
try:
hit = 0
blow = 0
hit_idx = []
s = list(map(int, input().split()))
t = list(map(int, input().split()))
for i in range(4):
if s[i] == t[i]:
hit_idx.append(i)
hit = len(hit_idx)
for i in hit_idx[::-1]: # reverse order
s = s[:i] + s[(i+1):]
t = t[:i] + t[(i+1):]
for c in s:
if c in t:
blow += 1
print("%d %d" % (hit,blow))
except:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,772 |
s805779455 | p00025 | u901080241 | 1488971335 | Python | Python3 | py | Accepted | 30 | 7552 | 339 | 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 EOFError:
break | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,773 |
s865520870 | p00025 | u897625141 | 1489974053 | Python | Python3 | py | Accepted | 20 | 7352 | 428 | 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)) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,774 |
s168912256 | p00025 | u518711553 | 1491503466 | Python | Python3 | py | Accepted | 30 | 7156 | 284 | 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() | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,775 |
s953902728 | p00025 | u462831976 | 1492725267 | Python | Python3 | py | Accepted | 20 | 7612 | 439 | # -*- 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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,776 |
s560575133 | p00025 | u868716420 | 1494362482 | Python | Python3 | py | Accepted | 20 | 7568 | 289 | 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 | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,777 |
s950086398 | p00025 | u905313459 | 1496467563 | Python | Python3 | py | Accepted | 30 | 7712 | 270 | 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 | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,778 |
s558869114 | p00025 | u957840591 | 1497918439 | Python | Python3 | py | Accepted | 20 | 7488 | 373 | 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 | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,779 |
s523512976 | p00025 | u350064373 | 1501552940 | Python | Python3 | py | Accepted | 20 | 7568 | 392 | 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 | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,780 |
s860429155 | p00025 | u498511622 | 1501554830 | Python | Python3 | py | Accepted | 20 | 7636 | 264 | 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
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,781 |
s405997279 | p00025 | u354053070 | 1501988023 | Python | Python3 | py | Accepted | 20 | 7640 | 270 | 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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,782 |
s709924697 | p00025 | u546285759 | 1503142503 | Python | Python3 | py | Accepted | 20 | 7712 | 231 | 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))) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,783 |
s271893146 | p00025 | u546285759 | 1503142576 | Python | Python3 | py | Accepted | 20 | 7644 | 230 | 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))) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,784 |
s051437338 | p00025 | u584777171 | 1503150170 | Python | Python3 | py | Accepted | 20 | 7548 | 361 | 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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,785 |
s957034663 | p00025 | u821624310 | 1503707386 | Python | Python3 | py | Accepted | 30 | 7540 | 317 | 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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,786 |
s730465797 | p00025 | u855694108 | 1504180438 | Python | Python3 | py | Accepted | 20 | 7612 | 432 | 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() | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,787 |
s589360086 | p00025 | u957021183 | 1504848306 | Python | Python3 | py | Accepted | 50 | 7672 | 553 | # 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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,788 |
s227949360 | p00025 | u071693485 | 1509198126 | Python | Python3 | py | Accepted | 30 | 7508 | 272 | 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 | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,789 |
s285619056 | p00025 | u548155360 | 1512401543 | Python | Python3 | py | Accepted | 20 | 5604 | 623 | # 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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,790 |
s339850380 | p00025 | u236679854 | 1512514829 | Python | Python3 | py | Accepted | 20 | 5600 | 296 | 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) | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,791 |
s035652310 | p00025 | u299798926 | 1513232859 | Python | Python3 | py | Accepted | 20 | 5604 | 351 | 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 | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,792 |
s993802320 | p00025 | u028347703 | 1514737082 | Python | Python3 | py | Accepted | 20 | 5596 | 314 | 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 | p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,793 |
s667514747 | p00025 | u600263347 | 1514869356 | Python | Python3 | py | Accepted | 20 | 5596 | 610 | 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()
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,794 |
s024886113 | p00025 | u024715419 | 1515644243 | Python | Python3 | py | Accepted | 20 | 5600 | 330 | 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
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,795 |
s423213068 | p00025 | u024715419 | 1515990211 | Python | Python3 | py | Accepted | 20 | 5592 | 330 | 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
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,796 |
s794313713 | p00025 | u764789069 | 1516292981 | Python | Python | py | Accepted | 10 | 4648 | 509 | 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
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,797 |
s905961385 | p00025 | u737311644 | 1516619248 | Python | Python3 | py | Accepted | 20 | 5604 | 388 | 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
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,798 |
s233173552 | p00025 | u043254318 | 1516893315 | Python | Python3 | py | Accepted | 20 | 5596 | 506 | 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)
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,799 |
s119784178 | p00025 | u150984829 | 1516989230 | Python | Python3 | py | Accepted | 20 | 5568 | 155 | 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)
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,800 |
s160302673 | p00025 | u150984829 | 1516989371 | Python | Python3 | py | Accepted | 20 | 5576 | 150 | 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)
| p00025 |
<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>
| 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2
| 1 1
3 0
| 7,801 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.