제출 #22353

#제출 시각아이디문제언어결과실행 시간메모리
22353크리님 제가 귀여우면 됬지 뭘 더 원하세요 진짜 (#40)Unifying Values (KRIII5_UV)C++11
0 / 7
0 ms2180 KiB
#include<bits/stdc++.h>

using std::pair;
std::map<pair<long long, int>, long long> map;
const long long MOD = 1000000007;
long long arr[10010];
long long sum[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];
	for (int i = 1; i <= n; i++) {
		if (p%sum[i] == 0) {
			map[{sum[i], 1}]++;
		}
		for (auto q : map) {
			if (q.first.first*(q.first.second + 1) == sum[i]) {
				map[{q.first.first, q.first.second + 1}] += q.second;
				map[{q.first.first, q.first.second + 1}] %= MOD;
			}
		}
	}
	long long ans = 0;
	for (auto q : map) {
		if (q.first.first*q.first.second == p && q.first.second!=1) {
			ans += q.second;
			ans %= MOD;
		}
	}
	printf("%lld", ans);
}

컴파일 시 표준 에러 (stderr) 메시지

UV.cpp: In function 'int main()':
UV.cpp:10:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
UV.cpp:12:25: 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...