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 凸包+枚举 水题 用小树林的木头给小树林围一个围墙 每棵树都有价值 求消耗价值最低的做法,输出被砍伐的树的编号和剩余的木料 若砍伐价值相 ...
随机推荐
- 【转】 [Unity3D]手机3D游戏开发:场景切换与数据存储(PlayerPrefs 类的介绍与使用)
http://blog.csdn.net/pleasecallmewhy/article/details/8543181 在Unity中的数据存储和iOS中字典的存储基本相同,是通过关键字实现数据存储 ...
- 截图神器-snipaste
基础操作 Snipaste 是一个简单但强大的贴图工具,同时也可以执行截屏.标注等功能. 截屏 开始截图 快捷键(默认为 F1) 鼠标左键 单击托盘图标 何谓一次 成功的截图 保存到剪贴板 ( / ...
- hdu6212[区间dp] 2017青岛ACM-ICPC网络赛
原题: BZOJ1032 (原题数据有问题) /*hdu6212[区间dp] 2017青岛ACM-ICPC网络赛*/ #include <bits/stdc++.h> using name ...
- CentOS下Nginx部署React静态应用
查看CentOS版本: cat /etc/redhat-release 安装nginx: yum install nginx 查看nginx版本: nginx -v 启动nginx: systemct ...
- springboot 2.0配置集成thymeleaf的坑
Servlet.service() for servlet [dispatcherServlet] in context with path [] java.lang.NoClassDefFoundE ...
- jquery 实践操作:attr()方法
此篇要记录的是 关于 jquery 的 attr() 方法 在JS中设置节点的属性与属性值用到setAttribute(),获得节点的属性与属性值用到getAttribute(),而在jquery中 ...
- git常用命令符
全局配置 $ git config --global user.name "姓名" 告诉git你是谁 $ git config --global user.email " ...
- 利用linux信号机制调试段错误(Segment fault)【转】
转自:http://blog.csdn.net/ab198604/article/details/6164517 版权声明:本文为博主原创文章,未经博主允许不得转载. 在实际开发过程中,大家可能会遇到 ...
- hdu 5059(模拟)
Help him Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...
- win7 64位数据库连接问题:在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配
通过ODBC/JDBC连接程序和数据库时,异常报错“在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配”的解决办法 本机:64位win7,64位JDK,做Web实验用32位myeclipse ...