python在同一行输入3个数_在Python3中一行输入所有数字的最快方法?

我的问题是在SPOJ上出现了“超过时间限制”的错误。因为我认为这个错误是因为大输入,所以我需要你的帮助来找到处理大输入的最佳方法。在

让我解释一下输入和代码。在Input

The first line of the input contains test cases t(1<=t<=100). It is

followed by 2*t lines, 2 for each test case. The first line of input

for each test case contains a number n (0<=n<=10^6), followed by n

elements in the next line. Each number is from -10^3 to +10^3

下面是一个输入示例3 #number of test cases (t)

4 #number of elements that will come to next line (n) (this can be 10^6)

2 1 2 2 #this line may have 10^6 numbers

6

1 1 1 2 2 2

5

1 2 4 5 1

问题是问一个数是否出现超过n//2次。

输出示例

^{pr2}$

有关问题的详细信息Added by: Troika::Bytes Date: 2010-02-18 Time limit: 1s Source

limit: 50000B Memory limit: 256MB Cluster: Pyramid (Intel Pentium III

733 MHz) Languages: All except: PERL 6

最后是我的代码。在fro

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值