罗伊和个人资料图片

时间:2017-06-15 15:30:50

标签: python-3.x

我需要帮助我的代码,我在hackearth中执行Roy和Profile Picture的代码,当我要运行时,会出现此错误:

' ValueError:基数为10的int()的无效文字:'

这是我的代码:

l = int(input())
n = int(input())
i = 0
while i < n:
    wh = str(input().split('  '))
    w,h = int(wh[0]),int(wh[1])
    if w == l and h == l:
        print('ACCEPTED')
    else:
        if w > l and h > l:
            print('CROP IT')
        else:
            print('UPLOAD ANOTHER')

    i+=1

抱歉我的英语错误,我正在学习。这是在python 3.x

2 个答案:

答案 0 :(得分:0)

正确的计划如下:

l = int(input())
n = int(input())
i = 0
while i < n:
    wh = (input().split())
    w = int(wh[0])
    h = int(wh[1])
    if w < l or h < l:
        print('UPLOAD ANOTHER')
    else:
        if w == h and (w >= l and h >= l) :
          print('ACCEPTED')  
        else:
            print('CROP IT')

    i+=1

答案 1 :(得分:0)

        Scanner s = new Scanner(System.in);
        int L = Integer.parseInt(s.nextLine());
        int N = Integer.parseInt(s.nextLine());
        int i = 0;
        while(i++ < N) {
            String[] arr = s.nextLine().split(" ");
            int W = Integer.parseInt(arr[0]);
            int H = Integer.parseInt(arr[1]);
            if(W < L || H < L) {
                System.out.println("UPLOAD ANOTHER");
            } else if (W >= L && H >= L) {
                if(W == H) {
                    System.out.println("ACCEPTED");
                } else {
                    System.out.println("CROP IT");
                }
            }
        }