結果

問題 No.1238 選抜クラス
ユーザー chocorusk
提出日時 2020-09-25 21:33:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 1,074 bytes
コンパイル時間 926 ms
コンパイル使用メモリ 122,620 KB
最終ジャッジ日時 2025-01-14 20:38:50
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
using ll=long long;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int main()
{
    int n, k; cin>>n>>k;
    int a[101];
    for(int i=0; i<n; i++){
        cin>>a[i];
        a[i]-=k;
    }
    ll dp[101][20200]={};
    const int geta=100;
    dp[0][geta*n]=1;
    for(int i=0; i<n; i++){
        for(int j=0; j<=2*geta*n; j++){
            if(dp[i][j]==0) continue;
            (dp[i+1][j]+=dp[i][j])%=MOD;
            (dp[i+1][j+a[i]]+=dp[i][j])%=MOD;
        }
    }
    ll ans=MOD-1;
    for(int i=geta*n; i<=2*geta*n; i++) (ans+=dp[n][i])%=MOD;
    cout<<ans<<endl;
    return 0;
}
0