2020 ICPC Asia Taipei-Hsinchu Site A.Right-Coupled Numbers(数学)

Description
2020 ICPC Asia Taipei-Hsinchu Site A.Right-Coupled Numbers(数学)_第1张图片
Solution
质因数分解

Code

int main(int argc, char const *argv[])
{
	int T;scanf("%d",&T);
	while(T--) {
		int x;scanf("%d",&x);
		bool flag = false;
		for(int i = 1;i * i <= x;++i) {
			if(x % i == 0) {
				int a = i, b = x / i;
				if(b <= 2 * a){flag = true;break;}
			}
		}if(flag) printf("1\n");else printf("0\n");
	}
	return 0;
}

你可能感兴趣的:(基础算法/思维,Math)