摘要: 解题思路:题意很明确,关键就是求邮局的位置,由于所有住户坐标到该点的距离和最短,其实就是纵横坐标中位数。即先排序,然后计算中位数的序号。接着就容易求出各个住户到邮局的距离之和即可。View Code 1#include<iostream>2#include<cstdio>3#include<algorithm>4usingnamespacestd;56structpoint{7intx,y;8}p[10005];910intcmp1(pointa,pointb)11{12returna.x<b.x;13}14intcmp2(pointa,pointb) 阅读全文
posted @ 2012-04-21 11:18 笑巧 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 解题思路:这道题就是让求一个整数n除自身外的所有因子之和,然后与 n 相比,如果小于则输出 DEFICIENT,等于则输出 PERFECT;大于则输出 ABUNDANT。本题关键就是注意输出格式,从题意 Format counts: the echoed integers should be right justified within the first 5 spaces of the output line, followed by two blank spaces, followed by the description of the integer. 整数 n输出占 5 空格且向右对齐 阅读全文
posted @ 2012-04-21 08:29 笑巧 阅读(850) 评论(0) 推荐(0) 编辑