# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22752 | JAESu_gak (#40) | Unifying Values (KRIII5_UV) | C++98 | 0 ms | 1124 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
#define mod 1000000007
using namespace std;
long long arr[1010];
long long sum=0;
int cnt=0,n,ans=0;
void dfs(int start,long sum,int cnt){
if(cnt==0){
ans++;
ans%=mod;
}
long SUM=0;
for(int i=start;i<=n;i++){
SUM+=arr[i];
if(SUM==sum)
dfs(i+1,sum,cnt-1);
}
}
int main(void){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&arr[i]);
sum+=arr[i];
}
for(long i=2;i<=n;i++)
if(sum%i==0)
dfs(1,sum/i,i);
printf("%ld\n",ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |