-
思路:第二题就很简单,将判断是否是合格地址和统计四角点数分成两个函数,就可以了。不用vector和struct会更简洁。
-
代码:
#include<iostream>
#include<vector>
using namespace std;
struct Point {
int x, y;
};
bool judge(Point point, vector<Point> points) {
int cnt = 0;
for (vector<Point>::iterator it = points.begin(); it != points.end(); it++) {
if (((*it).x - 1) == point.x && (*it).y == point.y)cnt++;
if (((*it).x +