Created
November 19, 2013 22:25
-
-
Save zuigon/7553686 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(){ | |
int m[25]={0}, // matrica sati, sve nule | |
n, i, j, ta, tb, mmax=1; | |
scanf("%d", &n); | |
for(i=0; i<n ; ++i){ | |
scanf("%d%d", &ta, &tb); | |
for(j=ta; j<=tb; ++j) | |
m[j]++; | |
} | |
for(i=0; i<25; ++i) | |
if(m[i]>mmax) | |
mmax=m[i]; | |
i=0; | |
while(m[i]!=mmax) | |
i++; | |
// sad je i postao prvi 'naj' sat | |
// ispisuje prvi interval gdje je bilo najvise ljudi, ne sve | |
printf("Najvise ljudi: %d, od: %d, do: ", mmax, i); | |
while(m[i]==mmax) | |
i++; | |
printf("%d (ukljucujuci)\n", i-1); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment