# 11280: 【原1280】整装待发

### 题目描述

author: Chen Xutong 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/1280

## Sample Input

``````4 5
1
2
8
2
``````

## Sample Output

``````3
``````

## yyong119's solution

``````#include <cstdio>
#include <cstring>
#define MAX_N 2005
#define MAX_F 1005
const int K = (int)1e8;
int N, MOD, num;
int f[MAX_N][MAX_F];
char ch = getchar(); int res = 0, flag = 1;
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') flag = -1, ch = getchar();
while (ch >= '0' && ch <= '9') res = res * 10 + ch - 48, ch = getchar();
return res * flag;
}
int main() {
num = read(); num %= MOD; f[0][num] = 1;
for (register int i = 1; i < N; ++i) {
num %= MOD;
for (register int j = 0; j < MOD; ++j) {
int next = (j + num) % MOD;
f[i][next] = (f[i - 1][j] + f[i - 1][next]) % K;
}
++f[i][num];
}
int ans = 0;
printf("%d\n", f[N - 1][0] % K);
return 0;
}
``````

## zqy2018's solution

``````#include <bits/stdc++.h>
#define INF 2000000000
#define M 100000000
using namespace std;
typedef long long ll;
int f = 1, x = 0;
char c = getchar();
while(c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
while(c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
return f * x;
}
int n, ff, a[2005], f[2005][1005] = {0};
void init(){
for (int i = 1; i <= n; ++i)
}
void solve(){
f[0][0] = 1;
for (int i = 1; i <= n; ++i){
a[i] %= ff;
for (int j = 0, k = a[i]; j < ff; ++j, k = (k == ff - 1 ? 0: k + 1))
f[i][k] = (f[i - 1][k] + f[i - 1][j]) % M;
}
printf("%d\n", (f[n][0] + M - 1) % M);
}
int main(){
init();
solve();
return 0;
}
``````