Contest Duration: - (local time) (100 minutes) Back to Home

Submission #856058

Source Code Expand

Copy
```#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <queue>
#define INF 0x3f3f3f3f
#define ll long long
using namespace std;
#define mod 100000000
long long dp[60][60][2600];
int main()
{
int n,A,a[100];
while(~scanf("%d%d",&n,&A))
{
memset(dp,0,sizeof(dp));
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
/*  int ans=0;
for(int i=1;i<(1<<n);i++)
{
int res=0,res1=0;
for(int j=0;j<n;j++)
if(i&(1<<j)) res+=a[j+1],res1++;
if(res%res1==0&&res/res1==A)
{
for(int j=0;j<n;j++)
if(i&(1<<j)) cout<<a[j+1]<<" ";
cout<<endl;
ans++;
}
}
cout<<ans<<endl;*/
dp[0][0][0]=1;
for(int i=0;i<n;i++)
{
for(int j=0;j<=n;j++)
{
for(int k=0;k<=2500;k++)
{
if(dp[i][j][k]==0) continue;
//   cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<endl;
dp[i+1][j+1][k+a[i+1]]+=dp[i][j][k];
dp[i+1][j][k]+=dp[i][j][k];
}
}
}
long long ans=0;
for(int i=0;i<=2500;i++)
{
for(int j=1;j<=n;j++)
{
if(i%j==0&&i/j==A) ans+=dp[n][j][i];
}
}
cout<<ans<<endl;
}
return 0;
}
```

#### Submission Info

Submission Time 2016-08-28 21:44:46+0900 C - Tak and Cards mirac1e C++14 (GCC 5.4.1) 300 1644 Byte AC 131 ms 73344 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:24:48: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
^
```

#### Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 100 / 100
Status
 AC × 4
 AC × 12
 AC × 24
Set Name Test Cases
Sample example_01.txt, example_02.txt, example_03.txt, example_04.txt
Case Name Status Exec Time Memory
example_01.txt AC 118 ms 73344 KB
example_02.txt AC 119 ms 73344 KB
example_03.txt AC 119 ms 73344 KB
example_04.txt AC 124 ms 73344 KB
subtask1_01.txt AC 120 ms 73344 KB
subtask1_02.txt AC 106 ms 73344 KB
subtask1_03.txt AC 120 ms 73344 KB
subtask1_04.txt AC 120 ms 73344 KB
subtask1_05.txt AC 120 ms 73344 KB
subtask1_06.txt AC 118 ms 73344 KB
subtask1_07.txt AC 131 ms 73344 KB
subtask1_08.txt AC 115 ms 73344 KB
subtask1_09.txt AC 120 ms 73344 KB
subtask2_01.txt AC 118 ms 73344 KB
subtask2_02.txt AC 118 ms 73344 KB
subtask2_03.txt AC 130 ms 73344 KB
subtask2_04.txt AC 130 ms 73344 KB
subtask2_05.txt AC 130 ms 73344 KB
subtask2_06.txt AC 130 ms 73344 KB
subtask2_07.txt AC 131 ms 73344 KB
subtask2_08.txt AC 124 ms 73344 KB
subtask2_09.txt AC 124 ms 73344 KB
subtask2_10.txt AC 126 ms 73344 KB
subtask2_11.txt AC 126 ms 73344 KB