B. 统计能被7整除的和

    Type: Default 1000ms 128MiB

统计能被7整除的和

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

说明

输入n个整数组成的序列A,序列的编号从1到n。统计有多少个连续的一段和A[s]+A[s+1]+ A[s+2]+…+A[e]能被7整除。

输入格式

第一行,n,表示有n个整数。(n<=1000) 第二行,n个1000以内的整数。

输出格式

一行,一个整数,表示共有多少段连续数的和能被7整除。

5 
8 7 6 9 10
2

提示

【样例解释】 8+7+6=21,能被7整除 7,能被7整除 除了上述两段连续的数的和可以被7整除,找不到其它的段。

来源

前缀和

前缀和练习

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
2
Start at
2026-1-8 12:30
End at
2026-1-16 20:30
Duration
200 hour(s)
Host
Partic.
29