답안 #22728

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22728 2017-04-30T07:01:44 Z 크리님 제가 귀여우면 됬지 뭘 더 원하세요 진짜(#952, sys7961, hyorothy, skdudn321) Unifying Values (KRIII5_UV) C++11
0 / 7
3 ms 2256 KB
#include<bits/stdc++.h>
using std::vector;
using std::pair;
const long long MOD = 1000000007;
std::set<long long> set;
long long arr[10010];
long long sum[10010];
long long cnt[10010];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &arr[i]);
		sum[i] = sum[i - 1] + arr[i];
	}
	long long p = sum[n];
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		if (set.count(sum[i]) == 0) {
			if (sum[i]!=0 && p%sum[i] == 0) {
				set.insert(sum[i]);
				long long k = p / sum[i];
				if (k > n || k == 1)break;
				for (int j = 1; j <= k; j++) {
					cnt[j] = 0;
				}
				cnt[0] = 1;
				for (int j = i; j <= n; j++) {
					if (sum[j] % sum[i] == 0) {
						long long q = sum[j] / sum[i];
						cnt[q] += cnt[q - 1];
						cnt[q] %= MOD;
					}
				}
				ans += cnt[k];
				ans %= MOD;

			}
		}
	}
	printf("%lld", ans);
}

Compilation message

UV.cpp: In function 'int main()':
UV.cpp:11:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
UV.cpp:13:25: 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 2256 KB Output is correct
2 Correct 0 ms 2256 KB Output is correct
3 Correct 0 ms 2256 KB Output is correct
4 Correct 3 ms 2256 KB Output is correct
5 Correct 3 ms 2256 KB Output is correct
6 Incorrect 0 ms 2256 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2256 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -