题目链接
大致题意:
给你n个数,问你能否从中选出某些数使得它们的和是3600的倍数。
解题报告:
每读入一个数,维护之前所有数的组合和。
O(T*3600*n) 玄
#define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define sl(p) strlen(p)
#define SZ(p) p.size()
#define pii pair<int,int>
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define fast_cin ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
using namespace std;
const int MOD=1e9+7;
const int maxn=1e5+5;
const double eps=1e-9;
const int inf=0x3f3f3f3f;
const double PI=acos(-1.0);
const double e=2.718281828459;
bool dp[3605];
int p[3605];
int main()
{
int T,n,x,cnt,i;
scanf("%d",&T);
while(T--){
mem(dp,false);
scanf("%d",&n);
for(i=1;i<=n&&!dp[0];i++){
scanf("%d",&x);x%=3600;
cnt=0;
for(int j=1;j<3600;j++) if(dp[j]) p[cnt++]=(j+x)%3600;
for(int j=0;j<cnt;j++) dp[p[j]]=true;
dp[x]=true;
}
while(i++<=n){scanf("%d",&x);}
if(dp[0]) printf("YES\n");
else printf("NO\n");
}
return 0;
}