#include #include #include #include #include #include #include long int array_to_int(int n,int *a) { long int finalNumber = 0,i; for ( i = 0; i < 3; i++) { int num = a[i]; if (num != 0) { while (num > 0) { finalNumber *= 10; num /= 10; } finalNumber += a[i]; } else finalNumber *= 10; } return finalNumber; } int canConstruct(int size, int* a) { // Return "Yes" or "No" denoting whether you can construct the required number. long int n; long int i; // char *N="No"; n=array_to_int(size,a); if(n%3==0) // printf("y==%s",y); return 1; else return 0; } 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; if(canConstruct(n, a)) printf("Yes"); else printf("No"); printf("\n"); } return 0; }