python问题是输入格式一行字符串总长度不超过256。输出格式输出为1行输出字符串里面数字字符的个数。我写的是s=inputdef count_digitss count = 0 for c in s if cisdigit count += 1 return countprintcount_digitss一直提示Memory Limit E
可能是因为你的输入方式不太适合该题目的测试数据,建议改为以下方式:
import sys s = sys.stdin.readline().strip()
这样可以避免输入过长导致的 Memory Limit Exceed。
原文地址: https://www.cveoy.top/t/topic/bUyF 著作权归作者所有。请勿转载和采集!