J - 搞笑版费马大定理

J - 搞笑版费马大定理
Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu

Description

费马大定理:当n>2时,不定方程an+bn=cn没有正整数解。比如a3+b3=c3没有正整数解。为了活跃气氛,我们不妨来个搞笑版:把方程改成a3+b3=c3,这样就有解了,比如a=4, b=9, c=79时43+93=793。

输入两个整数x, y, 求满足x<=a,b,c<=y的整数解的个数。

Input

输入最多包含10组数据。每组数据包含两个整数x, y(1<=x,y<=108)。

Output

对于每组数据,输出解的个数。

Sample Input

1 101 20123 456789 

Sample Output

Case 1: 0Case 2: 2Case 3: 16 
my answer:
#include<iostream>
using namespace std;
int main()
{
	int n,m,t=0;
	while(cin>>n>>m)
	{
		t++;
		int count=0;
		for(int i=n;i*i*i<= m*10+3;i++){
			for(int j=n;j*j*j<=m*10+3;j++){
				if((i*i*i+j*j*j)<=m*10+3&&(i*i*i+j*j*j)%10==3)count++;
			}
		}
		printf("Case %d: %d\n",t,count);
	}
	return 0;
}


posted @ 2014-12-21 12:25  NYNU_ACM  阅读(206)  评论(0编辑  收藏  举报