⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1528.cpp

📁 这是哈尔滨工业大学acmOJ的源代码
💻 CPP
字号:
/*  This Code is Submitted by wywcgs for Problem 1528 on 2006-08-10 at 10:54:55 */ 
#include <cstdio>
#include <cmath>
 
typedef long long int64;
 
inline void factor(int64&, int64);
 
int main()
{
	int64 n;
	
	while(scanf("%lld", &n) != EOF && n >= 0) {
		factor(n, 2);
		int64 mid = (int64)(sqrt(n)+1e-6), fact;
		for(fact = 3; fact <= mid && n >= mid; fact += 2) {
			if(n % fact != 0) continue;
			factor(n, fact); mid = (int64)(sqrt(n)+1e-6);
		}
		if(n != 1) printf("%lld\n", n);
		putchar('\n');
	}
	
	return 0;
}
 
inline void factor(int64& n, int64 f)
{
	for(; n % f == 0; n /= f) printf("%lld\n", f);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -