🌓

基于公招的龙门币清空计算程序

创建于 2024-02-17

Tags: 摸鱼

Categories: 摸鱼

代码
#include <bits/stdc++.h>
using namespace std;

constexpr int maxv = 1e5 + 10, maxn = 40;

int n = 36, a[] = {0, 140, 210, 280, 350, 161, 231, 301, 371, 182, 252, 322, 392, 203, 273, 343, 413, 280, 350, 420, 490, 322, 392, 462, 532, 364, 434, 504, 574, 518, 588, 658, 728, 602, 672, 742, 812};
int f[maxv], pre[maxv];

int main() {
  f[0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = a[i]; j < maxv; ++j) {
      if (f[j - a[i]]) f[j] = 1, pre[j] = i;
    }
  }
  cout << "Please input your current resource quantity: ";
  int cur; cin >> cur;
  vector<int> ans;
  if (f[cur]) ans.emplace_back(cur);
  for (int i = cur + 1000; i <= min(maxv - 1, cur + 10000); i += 500) {
    if (f[i]) ans.emplace_back(i);
  }
  cout << "Possible amount(s):";
  for (auto e : ans) cout << ' ' << e;
  cout << "...\n";
  cout << "Please choose on of these numbers: ";
  cin >> cur;
  while (cur) {
    int id = pre[cur], h = (id - 1) / 4 + 1, tags = id - h * 4 + 4;
    cout << '#' << id << ": " << h << " hour(s) with " << tags << " tag(s), cost " << a[id] << ".\n";
    cur -= a[pre[cur]];
  }
}

Powered by Hexo, theme by Facter