UOJ Logo 蜗牛编程训练题库

JZOJ

#1300. [USACO16JAN]7的倍数--Subsequences Summing to Sevens S

Statistics
时间限制:1s    空间限制:512MB    输入文件:div7.in    输出文件:div7.out
当前24小时内您还剩30次提交本题的机会

题目描述

给你n个数,分别是a[1],a[2],...,a[n]。求一个最长的区间[x,y],使得区间中的数(a[x],a[x+1],a[x+2],...,a[y-1],a[y])的和能被7整除。

输出区间长度。若没有符合要求的区间,输出0。

输入格式

The first line of input contains$ N$ ($1 \leq N \leq 50,000$). The next $N$

lines each contain the $N$ integer IDs of the cows (all are in the range

$0 \ldots 1,000,000$).

输出格式

一个整数,表示输出区间长度。若没有符合要求的区间,输出0。

样例数据

input

7
3
5
1
6
2
14
10

output

5

样例解释

从第2个数5 到第6个数14 累加和为28

数据规模与约定

时间限制:$1 \text {s}$

空间限制:$256 \text {MB}$

Solutions

标题 发表者 发表日期
None