Submission #2235323


Source Code Expand

#include <iostream>
#include <algorithm>

using namespace std;

long long int min(long long int a, long long int b){
	if (a < b)
		return a;
	else
		return b;
}

int main(void){
	long long int n, h, a, b, c, d, e;


	cin >> n >> h >> a >> b >> c >> d >> e;

	long long int m = 1e18;

	for (long long int i = 0; i <= n; i++){
		if ((e*n - h - (b + e)*i)/(d + e) + 1 + i <= n)
			m = min(m, a*i + c*(max(-1, (e*n - h - (b + e)*i)/(d + e)) + 1));
	}


	cout << m << endl;
}

Submission Info

Submission Time
Task C - 節制
User h2929
Language C++14 (GCC 5.4.1)
Score 0
Code Size 497 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:23:61: error: no matching function for call to ‘max(int, long long int)’
    m = min(m, a*i + c*(max(-1, (e*n - h - (b + e)*i)/(d + e)) + 1));
                                                             ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/5/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
./Main.cpp:23:61: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’)
    m = min(m, a*i + c*(max(-1, (e*n - h - (b + e)*i)/(d + e)) + 1));
                                             ...