Created
August 17, 2012 03:28
-
-
Save iporsut/3375685 to your computer and use it in GitHub Desktop.
ZOJ 2970: Faster, Higher, Stronger
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> | |
#include <string.h> | |
#define min(A,B) (A < B)?A:B | |
#define max(A,B) (A > B)?A:B | |
int main() { | |
int test, n, v, best; | |
char type[9]; | |
scanf("%d", &test); | |
while(test != 0) { | |
scanf("%s", type); | |
scanf("%d", &n); | |
if ( ! strcmp(type,"Faster")) { | |
best = 999999999; | |
while(n != 0) { | |
scanf("%d", &v); | |
best = min(best,v); | |
n--; | |
} | |
printf("%d\n", best); | |
} else { | |
best = 0; | |
while(n != 0) { | |
scanf("%d", &v); | |
best = max(best,v); | |
n--; | |
} | |
printf("%d\n", best); | |
} | |
test--; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment