Submission #582143


Source Code Expand

#include <cstdio>

int A, B, C, D, E, H, N;

int getCost(int H, int N) {
	if (N == 0) {
		return 0;
	}
	else if (H >= E) {
		return getCost(H - E, N - 1);
	}
	else {
		return std::min({ getCost(H + B, N - 1) + A, getCost(H + D, N - 1) + C });
	}
}

int main() {
	scanf("%d %d", &N, &H);
	scanf("%d %d %d %d %d", &A, &B, &C, &D, &E);
	
	printf("%d\n", getCost(H, N));
	
	return 0;
}

Submission Info

Submission Time
Task C - 節制
User staryoshi
Language C++11 (GCC 4.8.1)
Score 0
Code Size 406 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int getCost(int, int)’:
./Main.cpp:13:10: error: ‘min’ is not a member of ‘std’
   return std::min({ getCost(H + B, N - 1) + A, getCost(H + D, N - 1) + C });
          ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:18:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &N, &H);
                        ^
./Main.cpp:19:45: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d %d %d", &A, &B, &C, &D, &E);
                                             ^