結果
問題 | No.27 板の準備 |
ユーザー |
![]() |
提出日時 | 2016-03-24 11:23:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 836 bytes |
コンパイル時間 | 550 ms |
コンパイル使用メモリ | 59,744 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 12:25:14 |
合計ジャッジ時間 | 1,376 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP(i,n,0) #define REP(i,s,e) for (i = s; i < e; i++) #define rep(i,n) REP(i,0,n) #define INF 1e8 typedef long long ll; int main() { int i, j, k, ans; int vs[4]; rep (i,4) cin >> vs[i]; ans = INF; REP (i,1,29) REP (j,i+1,30) REP (k,j+1,31) { int cnt = 0; bool found = true; for (int v : vs) { int c = INF; for (int x = 0; x <= v; x+=i) { for (int y = 0; x+y <= v; y+=j) { if ((v-x-y)%k == 0) c = min(c,x/i+y/j+(v-x-y)/k); } } cnt += c; } ans = min(ans,cnt); } cout << ans << endl; return 0; }