HDU 1492(The number of divisors(约数) about Humble Numbers)

基础题。

#include <iostream>
using namespace std;

int main()
{
	__int64 n;
	while (cin >> n)
	{
		if (n == 0)
			break;

		int a = 0, b = 0, c = 0, d = 0;
		while (n % 2 == 0)
		{
			n /= 2;
			++a;
		}
		while (n % 3 == 0)
		{
			n /= 3;
			++b;
		}
		while (n % 5 == 0)
		{
			n /= 5;
			++c;
		}
		while (n % 7 == 0)
		{
			n /= 7;
			++d;
		}
		cout << (a + 1) * (b + 1) * (c + 1) * (d + 1) << endl;
	}
	return 0;
}

继续加油。

发布了332 篇原创文章 · 获赞 1 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/Intelligence1028/article/details/105684184