Advertisement
Malinovsky239

Untitled

Oct 19th, 2011
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <cstdio>
  2. int mas[100];
  3. int main() {
  4.     int w, j, m, a, b, c, n;
  5.     freopen("INPUT.TXT", "r", stdin);
  6.     freopen("OUTPUT.TXT", "w", stdout);
  7.     scanf("%d\n", &n);
  8.     for (int i = 0; i < n; i++) {
  9.         scanf ("%d %d %d", &a, &b, &c);
  10.         mas[i] = 3600 * a + 60 * b + c;
  11.     }
  12.     for (int v = 0; v < n; v++)
  13.         for (j = 1; j < n; j++) {
  14.             m = j - 1;
  15.             if (mas[m] > mas[j]) {
  16.                 w = mas[j];
  17.                 mas[j] = mas[m];
  18.                 mas[m] = w;
  19.             }
  20.         }
  21.  
  22.     for (int f = 0; f < n; f++) {
  23.         int r = mas[f] / 3600;      
  24.         int t = (mas[f] - ((mas[f] / 3600) * 3600)) / 60;
  25.         int y = mas[f] - ((mas[f] / 3600) * 3600) - (((mas[f] - ((mas[f] / 3600) * 3600)) / 60) * 60);  
  26.         printf("%d %d %d\n", r, t, y);
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement