10分求助
查看原帖
10分求助
922134
jiejielove楼主2023/2/23 12:20
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<string>
#include<algorithm>
#include <cstdlib>
#include<stdlib.h>

using namespace std;


int main()
{
	int t;
	string s;
	cin >> t;
	int count = 0;
	long long n,p;
	int q = 0;
	for (int i = 0; i < t; i++)
	{
		cin >> n;
		count = 0;
		s = to_string(n);
		p = n;
		while (p != 0)
		{
			count++;
			p = p / 10;
		}
		if (n % 4 == 0)
		{
			cout << "Yes";
		}
		else
		{
			for (int l = 0; l < count; l++)
			{
				for (int r = l; r<count; r++)
				{
					if (l == 0 && r == count - 1)
					{
						break;
					}
					else
					{
						s = s.erase(l,r-l+1);
						n = atoi(s.c_str());
						if (n % 4 == 0)
						{
							cout << "Yes"<<"\n";
							goto A;
						}
					}
				}
			}
			cout << "No"<<"\n";
		}
	A:;
	}
	return 0;
}

2023/2/23 12:20
加载中...