GYM 101673J(模拟)

本来我就模拟和搜索恐惧症,场上乍一看调度来调度去的真的吓得没敢写。然鹅赛后听说别的队写得贼短就写了写,真的不难……嘤嘤嘤

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

struct Others {
	int usage, recovery, start;
}p[10];
int Jim[10][2], ans;

int main() {
	for (int i = 0; i < 10; ++i) {
		scanf("%d %d", &Jim[i][0], &Jim[i][1]);
	}
	for (int i = 0; i < 10; ++i) {
		scanf("%d %d %d", &p[i].usage, &p[i].recovery, &p[i].start);
	}
	for (int i = 0; i < 30; ++i) {
		int now = i % 10, &t = p[now].start;
		if (ans >= t) {
			t = (ans - t) / (p[now].usage + p[now].recovery) * (p[now].usage + p[now].recovery) + t;
			if (t + p[now].usage > ans)	ans = t + p[now].usage;
			t += p[now].usage + p[now].recovery;
		}
		if (t < ans + Jim[now][0])	t = ans + Jim[now][0];
		ans += Jim[now][0] + Jim[now][1];
	}
	printf("%d\n", ans - Jim[9][1]);
	return 0;
}
// 5 5 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
// 2 2 1
// 8 3 0
// 1 1 0
// 1 1 0 
// 1 1 0 
// 1 1 0 
// 1 1 0 
// 1 1 0 
// 1 1 0 
// 1 1 0
posted @ 2019-04-08 17:42  AlphaWA  阅读(138)  评论(0编辑  收藏  举报