Submission #22766

# Submission time Handle Problem Language Result Execution time Memory
22766 2017-04-30T07:20:16 Z 최숭실(#962, eldkqmfhf123, youngjeong_yu, choiking10) Unifying Values (KRIII5_UV) C++14
Compilation error
0 ms 0 KB
#include<iostream>
#define MOD 1000000007
using namespace std;
long long int Data[10010];
long long int Sum[10010];
long long int ans;
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%lld", &Data[i]);
		if (i == 0)Sum[i] = Data[i];
		else
			Sum[i] = Sum[i - 1] + Data[i];
	}
	long long int target = 0;
	for (int i = 0; i < n-1; i++)
	{
		target += Data[i];
		if ((Sum[n - 1] - Sum[i]) % target != 0)continue;
		int zero = 0;
		long long int tmp_sum = 0;
		for (int j = i + 1; j < n; j++)
		{
			tmp_sum += Data[j];
			if (tmp_sum == target)
				tmp_sum = 0;
			if (Data[j] == 0)zero++;
		}
		if (tmp_sum != 0)continue;
		ans += pow(2, zero);
		ans %= MOD;
	}
	cout << ans;
	return 0;
}

Compilation message

UV.cpp: In function 'int main()':
UV.cpp:33:21: error: 'pow' was not declared in this scope
   ans += pow(2, zero);
                     ^
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:13:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &Data[i]);
                          ^