結果

問題 No.2323 Nafmo、A+Bをする
ユーザー katonyonkokatonyonko
提出日時 2023-05-28 13:36:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 1,069 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 71,644 KB
最終ジャッジ日時 2023-08-27 08:07:28
合計ジャッジ時間 2,663 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,412 KB
testcase_01 AC 71 ms
71,644 KB
testcase_02 AC 69 ms
71,624 KB
testcase_03 AC 70 ms
71,528 KB
testcase_04 AC 73 ms
71,380 KB
testcase_05 AC 69 ms
71,464 KB
testcase_06 AC 70 ms
71,580 KB
testcase_07 AC 71 ms
71,548 KB
testcase_08 AC 71 ms
71,308 KB
testcase_09 AC 71 ms
71,472 KB
testcase_10 AC 71 ms
71,356 KB
testcase_11 AC 72 ms
71,316 KB
testcase_12 AC 71 ms
71,404 KB
testcase_13 AC 69 ms
71,348 KB
testcase_14 AC 71 ms
71,140 KB
testcase_15 AC 69 ms
71,312 KB
testcase_16 AC 71 ms
71,160 KB
testcase_17 AC 70 ms
71,392 KB
testcase_18 AC 70 ms
71,404 KB
testcase_19 AC 70 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import io
import sys

_INPUT = """\
6
10
100
111
111
10100
1011
"""

def solve(test):
  A=input()
  B=input()
  ans=0
  if len(A)>len(B): B='0'*(len(A)-len(B))+B
  elif len(A)<len(B): A='0'*(len(B)-len(A))+A
  N=len(A)
  for i in range(N):
    if A[N-1-i]!=B[N-1-i]: ans+=1<<(i)
  if test==0:
    print(ans)
  else:
    return None

def random_input():
  from random import randint,shuffle
  N=randint(1,10)
  M=randint(1,N)
  A=list(range(1,M+1))+[randint(1,M) for _ in range(N-M)]
  shuffle(A)
  return (" ".join(map(str, [N,M]))+"\n"+" ".join(map(str, A))+"\n")*3

def simple_solve():
  return []

def main(test):
  if test==0:
    solve(0)
  elif test==1:
    sys.stdin = io.StringIO(_INPUT)
    case_no=int(input())
    for _ in range(case_no):
      solve(0)
  else:
    for i in range(1000):
      sys.stdin = io.StringIO(random_input())
      x=solve(1)
      y=simple_solve()
      if x!=y:
        print(i,x,y)
        print(*[line for line in sys.stdin],sep='')
        break

#0:提出用、1:与えられたテスト用、2:ストレステスト用
main(0)
0