#include #include #include #include #include #include #include char* canConstruct ( int a_size, int *a ) { int sum = 0; int i, k; int num; k = 10; for (i = 0; i < a_size; i++) { num = a[i]; while (num > 0) { sum = sum + (num % k); num /= k; } } if (sum % 3 == 0) return "Yes"; else return "No"; } int main() { char *result; int *a = NULL; int t, n, a0, result_size, a_i; scanf("%i", &t); for(a0 = 0; a0 < t; a0++) { scanf("%i", &n); *a = malloc(sizeof(int) * n); for (a_i = 0; a_i < n; a_i++) { scanf("%i", &a[a_i]); } result = canConstruct(n, a); printf("%s\n", result); } return 0; }