首页 > 其他 > 详细

蓝桥杯 ALGO-104 阿尔法乘积(数学)

时间:2015-03-28 08:53:07      阅读:293      评论:0      收藏:0      [点我收藏+]

【思路】:水题。

【AC代码】:PS.题目中说测试数据小于6000000,但是样例又给了个超int的。。果然蓝桥杯是做过的最差的OJ。。各种问题。

#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstring>
using namespace std;

int alpha(long long int n)
{
	int mul = 1;
	while (n)
	{
		int temp = n%10;
		if (0 != temp)
			mul *= temp;
		n /= 10;
	}
	return mul;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	long long int n = 0;
	cin >> n;
	while (n > 9 )
	{
		n = alpha(n);
	}
	cout << n;
	return 0;
}


蓝桥杯 ALGO-104 阿尔法乘积(数学)

原文:http://blog.csdn.net/weijj6608/article/details/44683759

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!