HDOJ 1017 (水题)
来源:互联网 发布:淘宝首页轮播大图代码 编辑:程序博客网 时间:2024/06/09 09:05
给定n,m要求满足(x^2+y^2+m)/ab为整数,然后0<a<b<n。求有多少组a,b;n的范围太小了。肯定是个水题没得跑了。不过要注意下输出形式就是了。
#include <iostream>using namespace std;int main(){ ios::sync_with_stdio(false);cin.tie(0); int N; cin>>N; while(N--){ int n,m; int i = 1; while(cin>>n>>m){ if(m==0 && n==0) break; int ans=0; for(int a = 1;a < n;a ++) for(int b = a+1;b < n;b ++){ int res=(a*a+b*b+m)%(a*b); if(res == 0) ans++; } cout<<"Case "<<i++<<": "<<ans<<endl; } if(N!=0) cout<<endl; } return 0;}
阅读全文
0 0
- hdoj 1017(水题)
- HDOJ 1017 (水题)
- hdoj prerequisites? (水题)
- hdoj 1017 (注意细节)
- hdoj 2700 (奇偶校验)(水题)
- HDOJ - 1008 - Elevator(水题)
- HDOJ 1008 Elevator(水题)
- hdoj Numbers 5585 (水题)
- hdoj--1418--抱歉(水题)
- hdoj--幸福指数(水题)
- HDOJ 1056 HangOver(水题)
- HDOJ-----1214---圆桌会议(水题)
- HDOJ 1985 Conversions(水题)
- HDOJ 2535 Vote(水题)
- hdoj 1020 Encoding (水题)
- HDOJ题目1017A Mathematical Curiosity(水题)
- hdoj 1017
- HDOJ 1017
- 关于在ubuntu16.04 64位系统上安装交叉编译工具出现错误的解决方法
- 撤销功能的实现——备忘录模式(一)
- 火柴棍等式
- python的@classmethod和@staticmethod
- 类的常见使用方法,包含静态内部类,懒汉类的
- HDOJ 1017 (水题)
- 树与二叉树基本概念与性质
- R绘图系统中的坐标系
- Activity 生命周期函数执行过程详解
- Ubuntu 14 使用火狐浏览器
- Floyd算法
- pytorch入门(一)-----Autograd
- 在linux中安装pyqt
- 插入排序的实现方式