首页 > 技术文章 > Codeforces Round #674 (Div. 3)

lightac 2020-09-29 11:02 原文

A题

#include <bits/stdc++.h>
using namespace std;
int main () {
	int t;
	cin >> t;
	while(t--) {
		int n, x;
		cin >> n >> x;
		int ans = 0;
		for(int i = 0; i < n; ) {
			i = ans * x + 2;
			ans++;
		}
		cout << ans << endl;
	}
} 

 B题

 

 

#include <bits/stdc++.h>
using namespace std;
int main () {
	int t;
	cin >> t;
	while(t--) {
		bool ok = 0;
		int n, m;
		cin >> n >> m;
		for(int i = 0; i < n; ++i) {
			int x1, x2, y1, y2;
			cin >> x1 >> x2 >> y1 >> y2;
			if(x2 == y1) {
				ok = 1;
			}
		}
		if(ok && m % 2 == 0) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
} 

 

推荐阅读