submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s400435948
p00024
Runtime Error
import math, sys for i in sys.stdin: print(math.ceil(float(input())**2/98+1))
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s752823176
p00024
Runtime Error
from math import ceil while True: v = input() if not v: break v = float(v) print(ceil(v * v / 98 + 1))
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s876438706
p00024
Runtime Error
import math,sys for e in sys.stdin:print(int(float(input())**2/98+2))
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s649584307
p00024
Runtime Error
import math [print(i) for i in [math.ceil(((4.9*(a/9.8)**2)+5)/5) for a in float(input())]]
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s282905525
p00024
Runtime Error
vs = [] while True: v = raw_input() if v == '': break else: vs.append(v) continue for v in vs: y = (float(v))**2 / 19.6 print int(y/5 + 2)
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s215578377
p00024
Runtime Error
while True: try: v = raw_input() y = (float(v))**2 / 19.6 print int(y/5 + 2) except: break
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s609442893
p00024
Runtime Error
#!/usr/bin/env python while 1: n=int(raw_input()) if n==0: break h1=map(int, raw_input().split()) for h in h1: h2=[ x for x in h1 if x!=h ] g=[ h2[i+1]-h2[i] for i in range(n-1) ] if len(set(g))==1: print h break
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s319133460
p00024
Runtime Error
import math while True: try: g = 9.8 l = 4.9 v = float(raw_input()) t = v/g y = l*t*t n = y/5 + 1 print int(math.ceil(n)) except EOFError: break ~ ~ ~ ~
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s916364681
p00024
Runtime Error
import sys,math for v in sys.stdin: print int(math.ceil(v**2/2/9.8/5))+1
25.4 25.4
8 8
<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 &lt; <i>v</i> &lt 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>
s774237417
p00025
Wrong Answer
# -*- 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 ]) print(str(hit) + ' ' +str(blow)) except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s966335261
p00025
Wrong Answer
import sys lists=[] for x in sys.stdin: lists.append(tuple(x.split(" "))) for x in range(0,len(lists),2): hit=0 for e in range(4): if lists[x][e]==lists[x+1][e]: hit+=1 blow=0 for y in lists[x]: if y in lists[x+1]: blow+=1 blow = blow-hit print hit,blow
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s083741101
p00025
Wrong Answer
import sys lists=[] for st in sys.stdin: lists+=[tuple(st.split(' '))] for x in range(0,len(lists),2): hit=0 for e in range(4): if lists[x][e]==lists[x+1][e]: hit+=1 blow=0 for y in lists[x]: if y in lists[x+1]: blow+=1 blow = blow-hit print hit,blow
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s995120446
p00025
Wrong Answer
while True: try: data1=map(int,raw_input().split(" ")) data2=map(int,raw_input().split(" ")) hit=0 for i in range(4): if data1[i]==data2[i]: hit+=1 blow=0 for i in range(4): if data1[i] in data2: blow+=1 print hit,blow-hit except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s821392095
p00025
Wrong Answer
while True: try: L1=map(int,raw_input().split(" ")) L2=map(int,raw_input().split(" ")) blow=0 hit=0 for i in range(4): if L1[i]==L2[i]: hit+=1 for j in L1: print j if j in L2: blow+=1 blow=blow-hit print str(hit)+" "+str(blow) except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s038913994
p00025
Wrong Answer
while True: try: L1=map(int,raw_input().split(" ")) L2=map(int,raw_input().split(" ")) blow=0 hit=0 for i in range(4): if L1[i]==L2[i]: hit+=1 for j in L1: if j in L2: blow+=1 blow=blow-hit print str(hit)+" "+str(blow) except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s883497610
p00025
Wrong Answer
while True: try: L1=map(int,raw_input().split(" ")) L2=map(int,raw_input().split(" ")) blow=0 hit=0 for i in range(4): if L1[i]==L2[i]: hit+=1 elif L1[i] in L2: blow+=1 print hit,blow except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s075314252
p00025
Wrong Answer
while True: try: L1=map(int,raw_input().split(" ")) L2=map(int,raw_input().split(" ")) blow=0 hit=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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s496879251
p00025
Wrong Answer
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s514956499
p00025
Wrong Answer
import sys def hitBlow(a, b): hit = 0 blow = 0 for i in range(len(a)): if a[i] == b[i]: hit += 1 for j in range(i+1, 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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s811745996
p00025
Wrong Answer
# -*- 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) print(index) if b==A[index]: Hit+=1 else: Blow+=1 print(Hit,Blow) except: break if __name__ == '__main__': main()
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s111933188
p00025
Wrong Answer
import sys for line in sys.stdin: a = list(map(int, line.split())) b = list(map(int, line.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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s079789328
p00025
Wrong Answer
import sys inputs = [] for line in sys.stdin: inputs.append(line) n = len(inputs) for _ in range(n // 2): for line in sys.stdin: a=list(map(int, sys.stdin[_ * 2].split())) b=list(map(int, sys.stdin[_ * 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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s262084964
p00025
Wrong Answer
import sys inputs = [] for line in sys.stdin: inputs.append(line) n = len(inputs) for _ in range(n // 2): for line in sys.stdin: 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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s304368778
p00025
Wrong Answer
while 1: try: hit=0 br=0 a=map(int,raw_input().split()) b=map(int,raw_input().split()) for i in xrange(4): if a[i]==b[i]: hit+=1 br+=b.count(a[i]) print hit,br except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s624468216
p00025
Wrong Answer
while 1: try: hit=0 br=0 a=map(int,raw_input().split()) b=map(int,raw_input().split()) for i in xrange(4): if a[i]==b[i]: hit+=1 br+=a[i].count(b) print hit,br except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s657393490
p00025
Wrong Answer
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))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s201521775
p00025
Wrong Answer
# -*- 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=' ') a = [int(e) for e in input().split()] b = [int(e) for e in input().split()] main(a, b)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s612397922
p00025
Wrong Answer
ansa=input().split() ansb=input().split() 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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s331189039
p00025
Wrong Answer
while True: try: ansa=hoge1.split() ansb=hoge2.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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s834474901
p00025
Wrong Answer
import sys even = True for s in sys.stdin: if even: even = not even a = list(map(int, s.split())) else: b = list(map(int, s.split())) hit = sum(a[i] == b[i] for i in range(4)) blow = sum(b[i] in a for i in range(4)) - hit print(hit, blow)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s118189885
p00025
Wrong Answer
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 j in a: blow+=1 if i==j: hit+=1
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s621745896
p00025
Wrong Answer
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 j in a: blow+=1 if i==j: hit+=1 print(hit,blow)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s766778122
p00025
Wrong Answer
try: while True: l1 = list(map(int, input().split())) l2 = list(map(int, input().split())) hit = blow = 0 for i in l1: for s in l2: if i == s: if l1.index(i) == l2.index(s): hit += 1 else: blow += 1 print hit, blow except: pass
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s237649792
p00025
Wrong Answer
# 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 print(blow_set) blow = len(blow_set) - hit return hit, blow if __name__ == '__main__': while True: try: answer_number = list(map(int, input().split())) expected_number = list(map(int, input().split())) except EOFError: break h, b = hit_and_blow(answer_number, expected_number) print(h, b)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s620442132
p00025
Wrong Answer
while True: hit=0 bro=0 try: a = [int(i) for i in input().split()] b= [int(j) for j in input().split()] for l in range(4): if a[l]==b[l]: hit+=1 for g in range(4): for p in range(4): if a[g]==a[p]: bro+=1 bro=bro-hit bro-=1 print(hit,bro) except:break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s847938441
p00025
Wrong Answer
hit = blow = 0 a = [*map(int,input().split(' '))] b = [*map(int,input().split(' '))] for i in range(4): if a[i] == b[i]: hit += 1 if a[i] == b[i-1]: blow += 1 print(hit, blow)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s056860593
p00025
Wrong Answer
hit = blow = 0 a = list(map(int,input().split())) b = list(map(int,input().split())) for i in range(4): if a[i] == b[i]: hit += 1 elif a[i] in b: blow += 1 print(hit, blow)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s532404149
p00025
Wrong Answer
import sys a = list(map(int, input().split())) for b in sys.stdin: b = list(map(int, b.split())) hit = 0 blow = 0 for i in range(4): try: if i == a.index(b[i]): hit += 1 else: blow += 1 except: pass print("{} {}".format(hit, blow))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s420384063
p00025
Wrong Answer
import sys ans = [] for line in sys.stdin: aa = list(map(int,input().split())) bb = list(map(int,input().split())) hit = 0 blow = 0 for one in range(len(aa)): if aa[one] == bb[one]: hit += 1 for one_a in range(len(aa)): ai = aa[one_a] for one_b in range(len(bb)): bi = bb[one_b] if ai== bi and one_a != one_b: blow += 1 one_list = [hit,blow] ans.append(one_list) for i in range(len(ans)): print(str(ans[i][0]) + ' ' + str(ans[i][1]))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s320787592
p00025
Wrong Answer
import sys ans = [] for line in sys.stdin: aa = list(map(int,input().split())) bb = list(map(int,input().split())) hit = 0 blow = 0 for one_a in range(len(aa)): if aa[one_a] == bb[one_a]: hit += 1 for one_b in range(len(bb)): bi = bb[one_b] if aa[one_a]== bb[one_b] and one_a != one_b: blow += 1 one_list = [hit,blow] ans.append(one_list) for i in range(len(ans)): print(str(ans[i][0]) + ' ' + str(ans[i][1]))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s719484595
p00025
Wrong Answer
import sys ans = [] for line in sys.stdin: aa = list(map(int,input().split())) bb = list(map(int,input().split())) hit = 0 blow = 0 for one_a in range(len(aa)): if aa[one_a] == bb[one_a]: hit += 1 if aa[one_a] in bb: blow += 1 blow = blow - hit one_list = [hit,blow] ans.append(one_list) for i in range(len(ans)): print(str(ans[i][0]) + ' ' + str(ans[i][1]))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s726401152
p00025
Wrong Answer
import sys ans = [] for line in sys.stdin: aa = list(map(int,line.split())) bb = list(map(int,line.split())) hit = 0 blow = 0 for one_a in range(len(aa)): if aa[one_a] == bb[one_a]: hit += 1 if aa[one_a] in bb: blow += 1 blow = blow - hit one_list = [hit,blow] ans.append(one_list) for i in range(len(ans)): print(str(ans[i][0]) + ' ' + str(ans[i][1]))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s445910341
p00025
Wrong Answer
import sys ans = [] for line in sys.stdin: aa = list(map(int,line.split())) bb = list(map(int,line.split())) hit = 0 blow = 0 for one_a in range(len(aa)): if aa[one_a] == bb[one_a]: hit += 1 if aa[one_a] in bb: blow += 1 blow = blow - hit one_list = [hit,blow] ans.append(one_list) for i in range(len(ans)): print(str(ans[i][0]) + ' ' + str(ans[i][1]))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s223781367
p00025
Wrong Answer
import sys for line in sys.stdin: a = list(map(int, line.split())) b = list(map(int, line.split())) hit, brow = 0, 0 for i in range(4): if a[i] == b[i]: hit += 1 elif a[i] in b: brow += 1 print(hit, brow)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s240496786
p00025
Wrong Answer
#!/usr/bin/env python # coding: utf-8 def hit_and_blow(a, b): hits = 0 blows = 0 for i in xrange(4): if b[i] == a[i]: hits += 1 else: for j in xrange(4): if j == i: continue if b[i] == a[j]: blows += 1 return hits, blows def main(): a = [int(x) for x in raw_input().split(" ")] b = [int(x) for x in raw_input().split(" ")] print "%d %d" % hit_and_blow(a, b) if __name__ == '__main__': main()
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s397427590
p00025
Wrong Answer
#!/usr/bin/env python # coding: utf-8 def hit_and_blow(a, b): hits = 0 blows = 0 for i in xrange(4): if b[i] == a[i]: hits += 1 else: for j in xrange(4): if j == i: continue if b[i] == a[j]: blows += 1 return hits, blows def main(): try: a = [int(x) for x in raw_input().split(" ")] b = [int(x) for x in raw_input().split(" ")] except EOFError: return print "%d %d" % hit_and_blow(a, b) if __name__ == '__main__': main()
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s479394798
p00025
Wrong Answer
#!/usr/bin/env python # coding: utf-8 import sys def hit_and_blow(a, b): hits = 0 blows = 0 for i in xrange(4): if b[i] == a[i]: hits += 1 else: for j in xrange(4): if j == i: continue if b[i] == a[j]: blows += 1 return hits, blows def main(): a, b = sys.stdin.read().split("\n")[:2] a = [int(x) for x in a.split(" ")] b = [int(x) for x in b.split(" ")] print "%d %d" % hit_and_blow(a, b) if __name__ == '__main__': main()
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s612992938
p00025
Wrong Answer
while True: try: hit = 0 ; blow = 0 a = map(int,raw_input().split(' ')) ; b = map(int,raw_input().split(' ')) for x in xrange(0,4): if b[x] in a: if b[x]==a[x]: hit += 1 else: blow += 1 else: pass print hit,blow except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s390947316
p00025
Wrong Answer
import sys import math def hit_and_blow(a, b): sa = set(a) sb = set(b) return len(sa.intersection(sb)) def hit(a, b): return reduce(hit_number, map((lambda x, y: (x, y)), a, b), 0) def hit_number(acc, x): if x[0] == x[1]: return acc + 1 else: return acc #input_file = open(sys.argv[1], "r") while True: try: a = map(int, sys.stdin.readline().split(' ')) b = map(int, sys.stdin.readline().split(' ')) hb = hit_and_blow(a, b) h = hit(a, b) b = hb - h print h, b except ValueError: exit()
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s056323132
p00025
Wrong Answer
import sys import math def hit_and_blow(a, b): sa = set(a) sb = set(b) return len(sa.intersection(sb)) def hit(a, b): return reduce(hit_number, zip(a, b), 0) def hit_number(acc, x): if x[0] == x[1]: return acc + 1 else: return acc #input_file = open(sys.argv[1], "r") while True: try: a = map(int, sys.stdin.readline().split(' ')) b = map(int, sys.stdin.readline().split(' ')) hb = hit_and_blow(a, b) h = hit(a, b) b = hb - h print h, b except: exit()
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s648762906
p00025
Wrong Answer
#!/usr/bin/env python # -*- coding:utf-8 -*- import time import sys start = time.clock() a=map(int, raw_input().split()) b=map(int, raw_input().split()) j=k=0 for i in range(4): if b[i]==a[i]: j+=i elif b[i] in a: k+=1 print j,k
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s786934771
p00025
Wrong Answer
#!/usr/bin/env python # -*- coding:utf-8 -*- #from __future__ import print_function import time import sys import io import re import math start = time.clock() while 1: try: a=map(int, raw_input().split()) b=map(int, raw_input().split()) j=k=0 for i in range(4): if b[i]==a[i]: j+=i elif b[i] in a: k+=1 print j,k except: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s912882472
p00025
Time Limit Exceeded
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: pass
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s894905979
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s326950980
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s270750161
p00025
Accepted
# -*- 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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s047587043
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s128981007
p00025
Accepted
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))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s790237858
p00025
Accepted
#!/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] ])
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s396259638
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s890121770
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s755592086
p00025
Accepted
#!/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))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s104565020
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s262403123
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s562413057
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s477121779
p00025
Accepted
# -*- 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()
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s312297352
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s907919165
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s686969749
p00025
Accepted
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[:]
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s084381070
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s045698015
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s889332917
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s343083433
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s301876723
p00025
Accepted
# -*- 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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s435593584
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s390599546
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s053732939
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s269762353
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s098827330
p00025
Accepted
# -*- 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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s361754074
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s215748475
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s044817672
p00025
Accepted
while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) except: break hit = blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 for j in range(4): if i != j and a[i] == b[j]: blow += 1 print(hit, blow)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s400242483
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s857823115
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s205529413
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s520949703
p00025
Accepted
import sys state = True for s in sys.stdin: if state: state = not state a = list(map(int,s.split())) else: state = not state b = list(map(int,s.split())) hit = 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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s888831597
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s312913878
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s070989071
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s562130706
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s769754510
p00025
Accepted
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()
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s406680810
p00025
Accepted
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))
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s694480294
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s870219361
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s695399465
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s708504975
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s753132340
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s688971948
p00025
Accepted
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)
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s872929175
p00025
Accepted
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
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>
s805779455
p00025
Accepted
while True: try: a = list(map(int, input().split())) b = list(map(int, input().split())) hit = 0 blow = 0 for i in range(4): if a[i] == b[i]: hit += 1 elif a[i] in b: blow += 1 print(hit,blow) except EOFError: break
9 1 8 2 4 1 5 9 4 6 8 2 4 6 3 2
1 1 3 0
<H1>Hit and Blow</H1> <p> Let's play Hit and Blow game. <i>A</i> imagines four numbers and <i>B</i> guesses the numbers. After <i>B</i> picks out four numbers, <i>A</i> answers: </p> <ul> <li> The number of numbers which have the same place with numbers <i>A</i> imagined (Hit) </li> <li> The number of numbers included (but different place) in the numbers <i>A</i> imagined (Blow)</li> </ul> <p> For example, if <i>A</i> imagined numbers: </p> <pre> 9 1 8 2 </pre> <p> and <i>B</i> chose: </p> <pre> 4 1 5 9 </pre> <p> <i>A</i> should say 1 Hit and 1 Blow. </p> <p> Write a program which reads four numbers <i>A</i> imagined and four numbers <i>B</i> chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. </p> <H2>Input</H2> <p> The input consists of multiple datasets. Each dataset set consists of: </p> <pre> <var>a<sub>1</sub></var> <var>a<sub>2</sub></var> <var>a<sub>3</sub></var> <var>a<sub>4</sub></var> <var>b<sub>1</sub></var> <var>b<sub>2</sub></var> <var>b<sub>3</sub></var> <var>b<sub>4</sub></var> </pre> <p> , where <var>a<sub>i</sub></var> (0 &le; <var>a<sub>i</sub></var> &le; 9) is <var>i</var>-th number <i>A</i> imagined and <var>b<sub>i</sub></var> (0 &le; <var>b<sub>i</sub></var> &le; 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>