本文共 2297 字,大约阅读时间需要 7 分钟。
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 6159 | Accepted: 3008 |
Description
Input
Output
Sample Input
67 1228 1399 15610 17311 190-100 1
Sample Output
5
Source
#include#include #include #include #include using namespace std;int aid[1000][2];float xielv[1000];int main(void){ int i, j, k; int max, tmp; int n; while (scanf("%d", &n) != EOF){ memset(aid, 0, sizeof(aid)); for (i = 0; i < n; i++){ scanf("%d%d", &aid[i][0], &aid[i][1]); } max = 2; for (i = 0; i < n - 1; i++){ for (j = i + 1, k = 0; j < n; j++){ if (aid[j][0] == aid[i][0]){ xielv[k++] = 32767; } else{ xielv[k++] = (float)(aid[j][1] - aid[i][1]) / (float)(aid[j][0] - aid[i][0]); } } sort(xielv, xielv + k); for (j = 1, tmp = 2; j <= k; j++){ if (xielv[j] == xielv[j - 1]){ tmp ++; if (tmp > max){ max = tmp; } } else{ tmp = 2; } } } printf("%d\n", max); } return 0;}
转载地址:http://hooji.baihongyu.com/