方法:枚举

做这道题,在第十行的位置WA了很多次,(n || m)不能写成(n + m),m可能是负数,一直没注意到,导致不停的WA.......

#include <stdio.h>
int main()
{
int T,n,m,a,b,ans,p = 0;
scanf("%d",&T);
while(T--)
{
if(p ++) printf("\n");
int num = 1;
while(scanf("%d%d",&n,&m) && (n || m))
{
ans = 0;
for(a = 1 ; a < n ; a ++)
for(b = a + 1 ; b < n ; b ++)
if( (a*a + b*b + m)%(a*b) == 0 ) ans ++;
printf("Case %d: %d\n",num++,ans);
}
}
return 0;
}

zoj 1152 A Mathematical Curiosity的更多相关文章

  1. A Mathematical Curiosity 分类: HDU 2015-06-25 21:27 11人阅读 评论(0) 收藏

    A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Ot ...

  2. A Mathematical Curiosity

    A Mathematical Curiosity Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/O ...

  3. HDU 1017 A Mathematical Curiosity【水,坑】

    A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  4. HDU 1017 A Mathematical Curiosity (数学)

    A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  5. HDU 1017A Mathematical Curiosity (暴力统计特殊要求个数)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1017 A Mathematical Curiosity Time Limit: 2000/1000 M ...

  6. HDU 1017 A Mathematical Curiosity【看懂题意+穷举法】

    //2014.10.17    01:19 //题意: //先输入一个数N,然后分块输入,每块输入每次2个数,n,m,直到n,m同一时候为零时  //结束,当a和b满足题目要求时那么这对a和b就是一组 ...

  7. HDOJ 1017 A Mathematical Curiosity

    Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such tha ...

  8. HDOJ-1017 A Mathematical Curiosity(淼)

    http://acm.hdu.edu.cn/showproblem.php?pid=1017 # include <stdio.h> int find(int n, int m) { in ...

  9. HDU 1017 - A Mathematical Curiosity

    题目简单,格式酸爽.. #include <iostream> using namespace std; int ans,n,m,p; int main() { cin>>p; ...

随机推荐

  1. ResultSet取结果集多少条记录方法及分页概要

    allst=toconn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); allsql = ...

  2. POJ3233(矩阵二分再二分)

    题目非常有简单: Description Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + ...

  3. nginx 查看并发连接数

    这里仅仅说一下用命令查看(也可配置页面) 通过查tcp连接数 1.netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]} ...

  4. Node.js连接MySQL数据库及构造JSON的正确姿势

    做一下整理,以前也很随意的引入包链接数据库,后来发现常常连接出问题,异常退出,后来使用在网上一个方法解决问题,网址由于书签丢失,抱歉不能引用了.再有就是简单的模块化下,使得目录合理点,再有就是说明一下 ...

  5. 部分PC端安卓管理器使用强行断开重连的方法来连接手机,容易丢书数据,损坏数据

    最近发现部分PC端的安卓管理器,貌似是百度影音以及PPTV的安卓客户端,使用强行断开手机连接,然后重新连接手机的方法,来实现客户端程序连接手机. 此时,如果刚好正在复制文件,则复制的文件会损坏,并且基 ...

  6. 推荐两个针对github的chrome插件

    作为一只程序猿,在github上找代码.看代码是再正常不过的事情了.这时候有个工具可以方便你翻看代码,想必是极好的. Sourcegraph for GitHub 这个插件允许你像使用IDE那样浏览代 ...

  7. 你不明白 String 类别

    序 前几篇文章一直在研究 WEB 安全的问题,并且近期工作中也一直在解决这些安全漏洞.当然,兴许的博客中还会就这些暴露出来的问题谈谈我的解决方式,仅仅只是,在这篇博客中,我想谈点别的问题.并且对于我们 ...

  8. css3标签学习总结文章

    1. :nth-child和 :nth-of-type 区别 比如: p:nth-child(2) 满足条件:1.必须是p标签:2.必须是父元素的第2个子元素:P:nth-of-type(2) 满足条 ...

  9. t_sql语句得到表中所有信息

    --得到所有数据库SELECT Name FROM Master..SysDatabases ORDER BY Name --得到某一数据库的所有表SELECT Name FROM MyPhotos. ...

  10. DDD领域驱动设计

    DDD领域驱动设计实践篇之如何提取模型 需求说明: 省级用户可以登记国家指标 省级用户和市级用户可以登记指标分解 登记国家指标时,需要录入以下数据:指标批次.文号.面积,这里省略其他数据,下同 登记指 ...