在Kattis中提交代码时收到“运行时错误”

时间:2020-02-14 01:37:34

标签: python python-3.x runtime-error kattis

在Kattis中提交Python 3代码时收到“运行时错误”消息吗?我用普通的input()检查了代码,它起作用了。我认为我的提交格式有问题。

问题的链接是: https://open.kattis.com/contests/j2b4nd/problems/matchgame

picture of the error message

#!/usr/bin/env python
# coding: utf-8
# In[8]:

import sys

# get the input
for line in sys.stdin:
    x_y=line.split('')

    x=x_y[0]
    y=xx_y[1]

    n=len(X)
    Answer='no'
    # Remove the similar digits
    for i in range(n):
        if x[0]==y[0]:
            x=x[1:]
            y=y[1:]

    # by removing one mathc from the First digit, the second digit can be made 
    minus=['71','80','93','65','95','86','89']
    plus=['17','08','39','56','59','68','98']
    # By moving one match between the digits, they can be converted to each other
    zero=['06','09','23','35','69','60','90','32','53','96']

    if len(x)==2:
        if (((x[0]+y[0]) in minus) and ((x[1]+y[1]) in plus) or
            ((x[0]+y[0]) in plus) and ((x[1]+y[1]) in minus)or
            ((x[0]+y[0]) in zero) and ((x[1]+y[1]) in zero)):
            Answer='yes'
    elif len(x)==1:
        if ((x[0]+y[0]) in zero):
            Answer='yes'

    print(Answer)    


# In[ ]:

0 个答案:

没有答案