Codeforces #57 (div2) A "Ultra-Fast Mathematician"
問題:http://codeforces.com/contest/61/problem/A
参加形式:本番
0と1で表される二つの数字列が与えられる.i番目の数字を比較して違うとき1,同じとき0とするとき,二つの数字列を比較した結果を求める.
そのままxorを取るだけ.
コード
import java.util.*; public class A_UltraFastMathematician { public static void main(String[] args) { Scanner s = new Scanner(System.in); String a = s.next(); String b = s.next(); String c = ""; for (int i = 0; i < a.length(); ++i) { if (a.charAt(i) != b.charAt(i)) { c+="1"; }else{ c+="0"; } } System.out.println(c); } }