码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 1017

时间:2016-05-16 10:42:52      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:

题目:HDU1017  A Mathmatical Curiosity

题目分析:水题。重点是输入输出格式。

 

 

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;

int main()
{
    int n,m,N;

    scanf("%d",&N);
    while(N--){
         int Case=0;

    while (scanf("%d%d",&n,&m),n||m)
    {

       int Count =0;
       int a=0,b=0;
       int temp=0;
       for( b=2;b<n;++b)
       for( a=1;a<n;++a){
        temp=(a*a+b*b+m)%(a*b);
        if( temp== 0 && a<b) Count++;
       }

       Case++;
       cout<<"Case "<<Case<<":"<<" "<<Count<<endl;
    }
    if(N) cout<<endl;
    }

    return 0;
}

 

HDU 1017

标签:

原文地址:http://www.cnblogs.com/weekend/p/5497045.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!