标签:
题目链接:http://acm.swust.edu.cn/problem/188/
1
2
3
4
5
|
1
2
3 4
1 2
|
1
|
25
|
1 #include <iostream> 2 #include <cmath> 3 using namespace std; 4 5 inline int mapping_x(int x){ 6 return x*(x + 2) + 3; 7 } 8 inline int mapping_y(int y){ 9 return 3 * y + 2; 10 } 11 inline int mapping_dis(int x, int y){ 12 return abs(x - y); 13 } 14 int main(){ 15 int t, n, i, j, k, maxn, Max, ptr[101][4]; 16 cin >> t; 17 while (t--){ 18 cin >> n; 19 Max = 0x7ffffff; 20 for (i = 0; i < n; i++){ 21 cin >> ptr[i][0] >> ptr[i][1]; 22 ptr[i][2] = mapping_x(ptr[i][0]); 23 ptr[i][3] = mapping_y(ptr[i][1]); 24 } 25 for (i = 0; i < n; i++){ 26 for (maxn = j = 0; j < n; j++){ 27 k = mapping_dis(ptr[i][0], ptr[j][3]) + mapping_dis(ptr[i][1], ptr[j][2]); 28 maxn = maxn>k ? maxn : k; 29 } 30 Max = Max < maxn ? Max : maxn; 31 } 32 cout << Max << endl; 33 } 34 return 0; 35 }
标签:
原文地址:http://www.cnblogs.com/zYx-ac/p/4572519.html