Codeforces Round #674 (Div. 3)

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;
		}
	}
} 
作者:LightAc
出处:https://www.cnblogs.com/lightac/
联系:
Email: dzz@stu.ouc.edu.cn
QQ: 1171613053
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/lightac/p/13748586.html