Codeforces 1068B LCM

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/polanwind/article/details/83713940

附官方题解。

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <math.h>

using namespace std;

long long b, ans, i;

int main() {
	scanf("%lld", &b);
	if (b == 1) {
		printf("1\n");
	}
	else {
		long long s = (long long)sqrt(b);
		for (i = 1;i <= s;++i) {
			if (b%i == 0) {
				ans++;
			}
		}
		if (s*s == b) {
			printf("%lld\n", 2 * ans - 1);
		}
		else {
			printf("%lld\n", 2 * ans);
		}
	}
	//system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/polanwind/article/details/83713940
lcm