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

#include "iostream"
#include "cmath"
#include "algorithm"
using namespace std;

int p, q;
int divP[1000];
int divQ[1000];

int yueShu(int n, int *div)
{
    int u = 0;
    for(int i=1; i<=sqrt(n); i++)
    {
        if(n%i == 0)
        {
            div[u++] = i;
            if(n/i > i)  //防止平方数的根被加入2次
                div[u++] = n/i;
        }
    }
    return u;
}

int main()
{
    int i, j;
    cin >> p >> q;
    int n1 = yueShu(p, divP); 
    int n2 = yueShu(q, divQ);
    sort(divP, divP+n1);
    sort(divQ, divQ+n2);
    for(i=0; i<n1; i++)
        for(j=0; j<n2; j++)
            cout << divP[i] << " " << divQ[j] << endl;
    return 0;
}
### 坐标在编程和GIS系统中的应用 #### 定义与基本概念 坐标系是用于描述空间位置的一组数值体系,在地理信息系统 (GIS) 和计算机科学领域中具有重要意义。常见的坐标表示方法包括笛卡尔坐标系、极坐标系以及球面坐标系等[^1]。 在 GIS 中,坐标通常用来定义地球表面的位置。这些坐标可以采用多种标准形式表达,例如经度和纬度(基于大地测量学),或者通过投影后的平面直角坐标来实现更精确的空间分析操作[^4]。 #### 数据存储方式 对于矢量几何对象而言,其内部结构可能涉及不同的二进制编码方案来进行高效的数据交换与处理。其中两种广泛接受的标准分别是 **Well-Known Binary (WKB)** 及 **Well-Known Text (WKT)** 表达式[^2]: - WKB 提供了一种紧凑型二进制序列化机制; - 而 WKT 则允许开发者以人类可读字符串的形式记录复杂形状的信息。 以下是 Python 实现的一个简单例子展示如何解析 WKT 字符串并将其转换为 Shapely 几何体: ```python from shapely.wkt import loads wkt_string = "POINT (-71.064544 42.28787)" point_geom = loads(wkt_string) print(f"Coordinates: {list(point_geom.coords)}") ``` 此脚本会输出给定点的坐标列表 `[(longitude, latitude)]` 形式的值。 #### 投影变换技术 由于地球是一个近似椭圆体而非完美平坦表面的事实,因此当试图将三维曲面上的点映射到二维平面上时不可避免地会产生变形现象。为了最小化这种失真影响,人们设计出了各种各样的地图投影算法。 美国国家层面常用的一种解决方案叫做 “State Plane Coordinate System”,它依据各个州的具体方位选取合适的锥形正交投影模型(Lambert Conformal Conic) 或横轴墨卡托投影(transverse Mercator),从而确保局部范围内保持较高的角度一致性或面积准确性。 #### 开源工具库推荐 如果希望进一步探索有关高级功能的应用实例,则可以考虑利用某些成熟的开源项目作为起点。比如下面列举的一些选项能够很好地满足不同层次的需求: - Boost.Geometry 结合 MySQL-GIS 扩展提供了强大的计算几何能力; - GeoWave 不仅实现了高效的多维度时空索引策略,还无缝对接主流大数据平台如 Apache Accumulo ,并通过一系列插件扩展增强了与其他生态组件之间的互操作性[^3]. ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值