問題:http://codeforces.com/contest/39/problem/D
プラクティス.
正六面体の惑星上で二つの観測者が互いに見える範囲にいるかどうか.少なくとも一つの軸において同じ位置にいればOKだと思った.
import java.util.*; public class D_CubicalPlanet { public static void main(String[] args) { Scanner s = new Scanner(System.in); int[] a = new int[3]; for (int n = 3; n-- > 0;) { a[n] = s.nextInt(); } String result = "NO"; for (int n = 3; n-- > 0;) { if(a[n]==s.nextInt()){ result = "YES"; break; } } System.out.println(result); } }