AtCoder Beginner Contest 013

Submission #1591464

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

ll n, h, a, b, c, d, e;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> h >> a >> b >> c >> d >> e;
	ll mi = 1e18;
	for (ll x = 0; x <= n; x++) {
		ll y = min(n-x, max((n*e-h-(b+e)*x)/(d+e)+1LL), 0LL);
		// if (n*e-h-(b+e)*x < 0) y = 0LL;
		mi = min(mi, x*a+y*c);
	}
	cout << mi << endl;
	return 0;
}

Submission

Task問題 C - 節制
User nameユーザ名 mogura
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 CE
Score得点 -
Source lengthソースコード長 606 Byte
File nameファイル名
Exec time実行時間 -
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:16:48: error: no matching function for call to ‘max(ll)’
ll y = min(n-x, max((n*e-h-(b+e)*x)/(d+e)+1LL), 0LL);
^
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/istream:38,
from /usr/include/c++/5/sstream:38,
from /usr/include/c++/5/complex:45,
from /usr/include/c++/5/ccomplex:38,
from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
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:16:48: note: candidate expects 2 arguments, 1 provid...

Test case