此题不难就是输出格式麻烦
#include<stdio.h>
int main(){ int T; scanf("%d",&T); while(T--) { int n,m,num=0; while(scanf("%d %d",&n,&m)&&n!=0) { int a,b,sum=0; for(a=1;a<100;++a) for(b=a+1;b<n;++b) { if((a*a+b*b+m)%(a*b)==0) sum++; } printf("Case %d: %d\n",++num,sum); } if(T) printf("\n"); } }