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

寒假集训附加题目题解报告(7)——”数学好奇心”

2013年09月10日 ⁄ 综合 ⁄ 共 505字 ⁄ 字号 评论关闭

http://acm.sdut.edu.cn:8080/judge/contest/view.action?cid=5#problem/F

川哥说我复杂度算对了。。。

#include "iostream"
using namespace std;
int main()
{
    int N;
    int n,m;
    int count=0,count_match=0;
    cin>>N;
    while(N--)
    {
        count=1;
        while(cin>>n>>m,n||m)
        {
            count_match=0;
            for(int i=1;i<=n-1;i++)
            {
                for(int j=i+1;j<=n-1;j++)
                {
                    if(((i*i+j*j+m)%(i*j))==0) count_match++;
                }
            }
            cout<<"Case "<<count<<": "<<count_match<<endl;
            count++;
        }
        if(N!=0) cout<<endl;
    }
    return 0;
}

抱歉!评论已关闭.