답안 #22752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22752 2017-04-30T07:14:04 Z JAESu_gak(#945, gs13031, lg970325, tsfo1489) Unifying Values (KRIII5_UV) C++
0 / 7
0 ms 1124 KB
#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

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]);
                              ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Runtime error 0 ms 1124 KB Execution killed because of forbidden syscall futex (202)
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1124 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -