现在的位置: 首页 > 综合 > 正文

【练习01】 简单题(1)1008

2013年10月13日 ⁄ 综合 ⁄ 共 283字 ⁄ 字号 评论关闭

A Mathematical Curiosity

 

# include <iostream>
using namespace std;

void main()
{
    int n,m,N;
    cin>>N;
    while(N > 0)
    {
        int k=1;
        while(cin>>n>>m && (n||m))
        {
            int count=0;
            for(int i=1;i<n-1;i++)
            {
                for(int j=i+1;j<n;j++)
                {
                    if((i*i+j*j+m)%(i*j)==0)
                        count++;
                }
            }
            cout<<"Case "<<k++<<": "<<count<<endl;
        }
        N--;
        if(N!=0)
            cout<<endl;
    }
}

 

 

 

抱歉!评论已关闭.