ZOJ-1152

来源:互联网 发布:电脑串口测试软件 编辑:程序博客网 时间:2024/05/22 15:14

不能更水了,枚举一下完事了。。

#include<stdio.h>int main(){int t, N;scanf("%d", &N);for (t = 0; t < N; t++){if (t)puts("");int n, m, count = 0;while (scanf("%d %d", &n, &m), n || m){int a, b, total = 0;for (a = 1; a < n; a++)for (b = a + 1; b < n; b++)if ((a * a + b * b + m) % (a * b) == 0)total++;printf("Case %d: %d\n", ++count, total);}}return 0;}


0 0
原创粉丝点击