20pts求助
查看原帖
20pts求助
1178004
禹天钧2016楼主2024/8/11 21:55
#include<bits/stdc++.h>
using namespace std;
long long n, t;
int main() {
	cin >> t;
	for (int i = 1; i <= t; i++) {
		cin >> n;
		int a1 = 0, a2 = 0, a3 = 0;
		int m = n;
		while (m) {
			m /= 10;
			if ((m % 100) % 4 == 0) {
				a1 = 1;
				break;
			}
		}
		m = n;
		while (m) {
			int x = m % 10;
			m /= 10;
			int y = m % 10;
			y *= 10;
			if ((y + x) % 4 == 0) {
				a2 = 1;
				break;
			}
		}
		m = n;
		if ((m % 10) % 4 == 0) {
			a3 = 1;
		}
		if (n % 4 == 0) {
			cout << "Yes\n";
		} else if (a1 || a2 || a3) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	}
	return 0;
}
2024/8/11 21:55
加载中...