Created
December 10, 2014 05:01
-
-
Save vikhyat/a48a7aae1072616063ee to your computer and use it in GitHub Desktop.
This file contains 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
main() { | |
int n, m, k, t=0, i; | |
scanf("%d\n", &n); | |
int s[n][2]; | |
for (i=0; i<n; i++) | |
scanf("%d %c\n", &s[i][0], &s[i][1]); | |
scanf("%d\n", &m); | |
while (m--) { | |
scanf("%d\n", &k); | |
for (i=0; i<n; i++) { | |
if ( abs(k - s[t][0]) > abs(k - s[i][0]) ) | |
t = i; | |
} | |
putchar(s[t][1]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment