View Code of Problem 3857

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define PR printf
#define SC scanf
#define D "%ld"
int main() {
	long t, i, j, k, m, n, f;
	char sp[2] = "";
	long a[1001];
	long ans[1001];
	char tmp[30];
	long num;
	long rankID;
	SC("%ld", &t);
	for (i = 0; i < t; i++) {
		SC(D, &num);
		ans[i] = 0;
		for (j = 0; j < num; j++) {
			SC(D, &a[j]);
			if (a[j] == 2) ans[i]++;
		}
	}
	for (i = 0; i < t; i++) {
		PR("%ld\n", ans[i] );
		
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3857