`
Midnight0101
  • 浏览: 15912 次
  • 性别: Icon_minigender_1
  • 来自: 天津
最近访客 更多访客>>
社区版块
存档分类
最新评论

2011清华考研机试题2

阅读更多
http://ac.jobdu.com/problem.php?id=1087
水~
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

long long solved(long long key)
{
	long long ans=0;
	if(key==1)
		return 1;
	for(long long i=1;i<=sqrt(key);i++)
	{
			
		if(key % i==0)
			if(i==sqrt(key))
			{
				ans++;					
			}
			else
			{
				ans+=2;
			}
	}
	return ans;
}



int main()
{
	int n;
	while(cin>>n)
	{
		if(!n)
			break;
		for(int i=0;i<n;i++)
		{
			long long key;
			scanf("%lld",&key);
			printf("%lld\n",solved(key));
		}
	}	
	return 0;
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics