#include <stdio.h> #include <windows.h> int Whichismax(int v[], int n) { int i, max; max = 0; for (i = 0; i<n; i++) { if (v[i]>v[max]) max = i; } return v[max]; } int main() { int i, i_temp, mid, t, l, r, n, a[50000], b[50000], v[50000], temp; scanf("%d", &t); while (t--) { scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &l, &r); a[i] = l; b[i] = r; v[i] = r - l; } mid = Whichismax(v, n); temp = 0; for (i = 0; i < n; i++) { if (a[i] % mid == 0 || a[i] % mid >= b[i] - a[i]) { temp++; } else { printf("NO"); system("pause"); return 0; } } if (temp == n) { printf("YES"); } else{ printf("NO"); } printf("\n"); } system("pause"); return 0; } /* Main.c:2:21: fatal error: windows.h: No such file or directory #include <windows.h> ^ compilation terminated. */ |
Double click to view unformatted code.