ACM: 数论题 toj 1721
来源:互联网 发布:麻瓜编程 爬虫 编辑:程序博客网 时间:2024/05/16 13:03
Partial Sums
描述
Given a series of nnumbers a1, a2, ..., an, the partial sum of the numbers is definedas the sum of ai, ai+1, ..., aj.
You are supposed to calculate how many partial sums of a givenseries of numbers could be divided evenly by a given numberm.
输入
There are multiple test,each contains 2 lines.
The first line is 2 positive integers n (n <= 10000) and m (m <= 5000).
The second line contains n non-negative integers a1, a2, ..., an.Numbers are separated by one or several spaces.
The input is ended by EOF.
输出
One test each line - thenumber of partial sums which could be divided by m.
样例输入
5 4
1 2 3 4 5
6 7
9 8 7 6 5 4
样例输出
2
3
题意:
解题思路:
代码:
#include <iostream>
#include <cstring>
using namespace std;
#define MAX 10005
int ca[MAX];
int n, m;
int t;
int sum;
int main()
{
//
}
- ACM: 数论题 toj 1721
- ACM: 二分法 数论题 poj 1905
- ACM: polay定理 数论题 poj 1286 …
- ACM : 数论题 poj1061 (扩展欧几…
- ACM: 数论题 toj3343 同 poj 1061
- ACM: 矩阵建模 数论题 poj 3735 (…
- ACM: 一道数论题 poj1730 (做了好…
- ACM: polya模拟 数论题 poj 1026
- ACM: polya定理+hash 数论题 poj 3…
- ACM: polya定理 数论题 poj 2409
- ACM: n!末尾0的个数 数论题 poj 14…
- ACM: 数学规律题 数论题 hdoj 1021
- ACM: 二进制问题 数论题 poj 1023
- ACM: 矩阵快速幂运算 数论题 poj 3…
- ACM: 二分又二分 数论题 poj 3233
- ACM: 矩阵变形题 数论题 poj 3150
- ACM: 图论题 poj3259 bellman_ford…
- ACM: 图论题 poj 1135
- 图论: 最大流
- 图论: 最小费用最大流
- ACM: spfa+dfs 图论题 poj 2679
- ACM: 简单最小生成树 图论题 poj 1…
- ACM: 序列中找最小逆序对 杂题 TOJ…
- ACM: 数论题 toj 1721
- ACM:最大子树 动态规划题 toj2676
- 虚拟机下安装ubuntu后root密码设置
- ACM: 数论题 toj3343 同 poj 1061
- ACM: 优先队列 数据结构题 toj 290…
- ACM: 变形的LCS(最长公共子序) toj…
- 动态规划: 航线设置 (求最大升序长…
- 动态规划: poj1505改编题
- 包装类