python,样例过了但RE

P1046 [NOIP2005 普及组] 陶陶摘苹果

nqpk @ 2022-10-02 13:25:50

import re
a = re.split("\s",input())
a0 = int(input())
t = 0
for b in a:
    if a0+30 >= int(b):
        t += 1
print(t)

by nqpk @ 2022-10-02 20:46:13

有没有大佬帮帮我qwq


by Ryann74 @ 2022-10-03 17:26:54

同样RE...


by dalao1575 @ 2022-10-15 11:23:45

不知道,但我在编译器编译出错

Traceback (most recent call last):
  File "E:\1python作品\测试.py", line 34, in <module>
    a0 = int(input())
ValueError: invalid literal for int() with base 10: ''

@nqpk


by lcw529307 @ 2022-11-17 23:53:24

不要用re 改成map ls = list(map(int, input().split()))


by wanghonghao123456 @ 2023-06-23 16:15:25

a = list(map(int, input().split(' ')))
a0 = int(input())
t = 0
for b in a:
    if a0+30 >= int(b):
        t += 1
print(t)

a = list(map(int, input().split(' ')))很常用,要背的。


by wanghonghao123456 @ 2023-06-23 16:17:34

a = list(map(int, input().split(' ')))
c = int(input())
t = 0
for b in c:
    if c+30 >= int(b):
        t += 1
print(t)

变量里不能出现数字,改成c就行. re最好不要用。


|