c++

念儿  •  4个月前


include <stdio.h>

int main() {

int a, b, c; int g = 0; scanf("%d%d%d", &a, &b, &c); for (int i = 1; i <= 3000; i++) {

for (int j = 1; j <= 2000; j++) {
	if (a * i + b * j == c) {
		g = 1;
		printf("%d %d\n", i, j);
	}
}

} if (g == 0) {

printf("-1");

} return 0; }


评论:

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

struct b {
	int time, cont;
};
int c[100005];

int main() {
	int n;
	cin >> n;
	queue<b> a;
	memset(c, 0, sizeof(c));
	int co = 0;
	for (int i = 0; i < n; i++) {
		int t, r, l;
		b k, f;
		cin >> t >> r;
		while (r--) {
			cin >> l;
			k = {t, l};
			a.push(k);
			c[l]++;
			if (c[l] == 1 ) {
				co++;
			}
		}
		while (a.size()) {
			if (k.time - a.front().time   < 86400) {
				break;
			}
			f = a.front();
			a.pop();
			c[f.cont]--;
			if (c[f.cont] <= 0 ) {
				co--;
			}
		}
		cout << co << endl;
	}
	return 0;
}

Gooooogle  •  4个月前

请先登录,才能进行评论