#include #include #include #include #include #include #include char* canConstruct(int a_size, int* a) { // Return "Yes" or "No" denoting whether you can construct the required number. // int *b=malloc(sizeof(int)*a_size); int i,sum=0,d,sum1=0,n,e,f; for(i=0;i0){ d=n%10; if(d!=0){ sum=sum*10+d; } n=n/10; } } f=sum; while(sum>0){ e=sum%10; sum1=sum1*10+e; sum=sum/10; } if(sum1%3==0 || f%3==0){ return "Yes"; }else return "No"; } int main() { int t; scanf("%i", &t); for(int a0 = 0; a0 < t; a0++){ int n; scanf("%i", &n); int *a = malloc(sizeof(int) * n); for (int a_i = 0; a_i < n; a_i++) { scanf("%i",&a[a_i]); } int result_size; char* result = canConstruct(n, a); printf("%s\n", result); } return 0; }