题目: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; }