HDU 1017 A Mathematical Curiosity (枚举水题)
This problem contains multiple test cases!
The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.
The output format consists of N output blocks. There is a blank line between output blocks.
1 10 1
20 3
30 4
0 0
Case 1: 2
Case 2: 4
Case 3: 5
!细致审题
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
int main()
{
int a,b,mod,n,m,t,number,ans;
scanf("%d",&t);
while(t--) {
number=0;
while(scanf("%d%d",&n,&m)!=EOF){
if(n==0 && m==0) break;
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",++number,ans);
}
if(t) printf("\n");
}
return 0;
}
HDU 1017 A Mathematical Curiosity (枚举水题)的更多相关文章
- HDU 1017 A Mathematical Curiosity【水,坑】
A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- HDU 1017 A Mathematical Curiosity(枚举)
题目链接 Problem Description Given two integers n and m, count the number of pairs of integers (a,b) suc ...
- HDU 1017 A Mathematical Curiosity (数学)
A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- HDU 1017 A Mathematical Curiosity【看懂题意+穷举法】
//2014.10.17 01:19 //题意: //先输入一个数N,然后分块输入,每块输入每次2个数,n,m,直到n,m同一时候为零时 //结束,当a和b满足题目要求时那么这对a和b就是一组 ...
- HDU 1017 A Mathematical Curiosity 数学题
解题报告:输入两个数,n和m,求两个数a和b满足0<a<b<n,并且(a^2+b^2+m) % (a*b) =0,这样的a和b一共有多少对.注意这里的b<n,并不可以等于n. ...
- HDU 1017 - A Mathematical Curiosity
题目简单,格式酸爽.. #include <iostream> using namespace std; int ans,n,m,p; int main() { cin>>p; ...
- HDU 1017 A Mathematical Curiosity (输出格式,穷举)
#include<stdio.h> int main() { int N; int n,m; int a,b; int cas; scanf("%d",&N); ...
- HDU 2096 小明A+B --- 水题
HDU 2096 /* HDU 2096 小明A+B --- 水题 */ #include <cstdio> int main() { #ifdef _LOCAL freopen(&quo ...
- poj1873 The Fortified Forest 凸包+枚举 水题
/* poj1873 The Fortified Forest 凸包+枚举 水题 用小树林的木头给小树林围一个围墙 每棵树都有价值 求消耗价值最低的做法,输出被砍伐的树的编号和剩余的木料 若砍伐价值相 ...
随机推荐
- 现代互联网的TCP拥塞控制(CC)算法评谈
动机 写这篇文章本质上的动机是因为前天发了一个朋友圈,见最后的写在最后,但实际上,我早就想总结总结TCP拥塞控制算法点点滴滴了,上周总结了一张图,这周接着那些,写点文字. 前些天,Linux中国微信公 ...
- loj 300 [CTSC2017]吉夫特 【Lucas定理 + 子集dp】
题目链接 loj300 题解 orz litble 膜完题解后,突然有一个简单的想法: 考虑到\(2\)是质数,考虑Lucas定理: \[{n \choose m} = \prod_{i = 1} { ...
- mongodb学习(3)--- NodeJs使用mongoose操作mongodb
转载: https://cnodejs.org/topic/50c145ed637ffa4155c7eaee 首先对于以下错误说明(有写 db.close): Error: db object alr ...
- 【08】node 之 fs文件
var fs = require("fs");//fs 系统文件模块,对文件进行操作.Node.js 文件系统(fs 模块)模块中的方法均有异步和同步版本,例如读取文件内容的函数有 ...
- XWW的难题(bzoj 3698)
Description XWW是个影响力很大的人,他有很多的追随者.这些追随者都想要加入XWW教成为XWW的教徒.但是这并不容易,需要通过XWW的考核.XWW给你出了这么一个难题:XWW给你一个N*N ...
- pat 甲级 1127. ZigZagging on a Tree (30)
1127. ZigZagging on a Tree (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...
- rsync Linux系统下的数据镜像备份工具
rsync是Linux系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync.rsync支持大多数的类Unix系统,无论是Linux.Solaris还是BSD上都经过了良好的 ...
- javascript草稿
原文发布时间为:2011-06-01 -- 来源于本人的百度文章 [由搬家工具导入] @MyHelper.Script("jquery-1.6.1.min.js", Url) ...
- SQL优化 ASP.NET ADO.NET
原文发布时间为:2009-08-26 -- 来源于本人的百度文章 [由搬家工具导入] 总的考虑方向 1) 根据数据使用的方式来设计数据访问层 2) 缓存数据,避免不必要的操 ...
- C# asp.net 导出数据库二进制字段到excel
前台的话不多说,本次只详细说下后台导出数据库中的二进制字段,上传下次有时间再说,有比较急的可以留言我 之前在网上搜了关于下载导出二进制字段的资料,发现都不是我想要的,都只是把上传的文件放到服务器然后下 ...