Submission #22752

#TimeUsernameProblemLanguageResultExecution timeMemory
22752JAESu_gak (#40)Unifying Values (KRIII5_UV)C++98
0 / 7
0 ms1124 KiB
#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)

UV.cpp: In function 'int main()':
UV.cpp:34:23: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'int' [-Wformat=]
     printf("%ld\n",ans);
                       ^
UV.cpp:24:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
UV.cpp:26:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&arr[i]);
                              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...