about summary refs log tree commit diff
path: root/2ndary/10/CSP-KT2/hamming.c
blob: 645eb17832bec63efea19625f106825be4b8b1aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>

char *hamming(long m)
{
	while (m % 5 == 0)
		m /= 5;
	while (m % 3 == 0)
		m /= 3;
	while (m % 2 == 0)
		m /= 2;
	return (m > 1) ? "NO" : "YES";
}

int main()
{
	short n, i;
	long a[10000];

	scanf("%hd", &n);
	for (i = 0; i < n; i++)
		scanf("%ld", &a[i]);

	for (i = 0; i < n; i++)
		printf("%s\n", hamming(a[i]));

	return 0;
}