hihocoder-1186-求约数

简介: 1.题目 #1186 : Coordinates 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Give you two integers P and Q. Let all divisors of P be X-coordinates. Let all divisors of Q be Y-coord

1.题目

#1186 : Coordinates

时间限制: 10000ms
单点时限: 1000ms
内存限制: 256MB

描述

Give you two integers P and Q. Let all divisors of P be X-coordinates. Let all divisors of Q be Y-coordinates.

For example, when P=6 and Q=2, we can get the coordinates (1,1) (1,2) (2,1) (2,2) (3,1) (3,2) (6,1) (6,2).

You should print all possible coordinates in the order which is first sorted by X-coordinate when coincides, sorted by Y-coordinate.

输入

One line with two integers P and Q(1 <= P, Q <= 10000).

输出

The output may contains several lines , each line with two integers Xi and Yi, denoting the coordinates.

样例输入
6 2
样例输出
1 1
1 2
2 1
2 2
3 1
3 2
6 1
6 2

2.分析

水题,求出P的约数列表pList,求Q的约数列表qList,两两搭配即可。

注意约数列表从小到大排列,不能重复。

3.代码

 

目录
相关文章
|
4月前
|
Java
hdu 1427 速算24点【暴力枚举】
hdu 1427 速算24点【暴力枚举】
54 0
|
4月前
数字游戏2(数位dp)
数字游戏2(数位dp)
31 0
|
4月前
每日一题(珠玑妙算,两数之和)
每日一题(珠玑妙算,两数之和)
45 1
|
4月前
|
存储
每日一题啦(● ̄(エ) ̄●)(尼克切斯定理,等差数列)
每日一题啦(● ̄(エ) ̄●)(尼克切斯定理,等差数列)
22 0
|
机器学习/深度学习 数据采集 人工智能
【每周一坑】杨辉三角形
了解完背景知识之后,来看看对应的题目,定义一个函数 yanghui() ,传入正整数参数 M、N,分别代表杨辉三角形第 M 行,左起第 N 个数字(M,N 都从 0 开始计算)。入超出范围则返回 invalid query 。
|
人工智能 算法 测试技术
【寒假每日一题】AcWing 4644. 求和(补)
目录 一、题目 1、原题链接 2、题目描述 二、解题报告 1、思路分析 2、时间复杂度 3、代码详解
77 0
【蓝桥杯集训·每日一题】AcWing 3625. 幂次方
文章目录 一、题目 1、原题链接 2、题目描述 二、解题报告 1、思路分析 2、时间复杂度 3、代码详解 三、知识风暴 快速幂
59 0
|
C++
【寒假每日一题】AcWing 4728. 乘方
目录 一、题目 1、原题链接 2、题目描述 二、解题报告 1、思路分析 2、时间复杂度 3、代码详解
136 0
(数论)蓝桥杯AcWing 1205. 买不到的数目
(数论)蓝桥杯AcWing 1205. 买不到的数目
43 0
|
算法
Acwing第53场周赛 T2:整除子串反思
Acwing第53场周赛 T2:整除子串反思
92 0
Acwing第53场周赛 T2:整除子串反思