样例没过求助
  • 板块CF1692F 3SUM
  • 楼主Dehydration
  • 当前回复2
  • 已保存回复2
  • 发布时间2022/7/2 10:06
  • 上次更新2023/10/27 22:06:42
查看原帖
样例没过求助
661534
Dehydration楼主2022/7/2 10:06

题目 样例

输入 #1


6
4
20 22 19 84
4
1 11 1 2022
4
1100 1100 1100 1111
5
12 34 56 78 90
4
1 9 8 4
6
16 38 94 25 18 99

输出 #1


YES
YES
NO
NO
YES
YES

代码:

#include<bits/stdc++.h>
using namespace std;
int a[10005],tong[15];
int t,n,m=10;
int panduan()
{
	for(int I=0;I<=9;I++)
			for(int J=0;J<=9;J++)
				for(int K=0;K<=9;K++)
				{
					if((I+J+K)%m==3&&tong[I]>0&&tong[J]>0&&tong[K]>0)
					{
							return 1;
							break;
					}
				}
	return 0;
}
int main()
{
	cin>>t;
	for(int i=1;i<=t;i++)
	{
		memset(tong, 0, sizeof tong);
		cin>>n;
		for(int j=1;j<=n;j++)
		{
			cin>>a[i];
			tong[a[i]%m]++;
		}
		if(panduan())
		cout<<"YES"<<endl;else
		cout<<"NO"<<endl;
		
	}
}
2022/7/2 10:06
加载中...