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;
}

你可能感兴趣的:(考研)