首页 > 其他 > 详细

HDU 1017

时间:2016-05-16 10:41:08      阅读:132      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!