BUPT-homework/semester1/pset6/1-soldiers-table.c

16 lines
266 B
C

#include <stdio.h>
int main(void) {
int table[] = {461, 2771, 5081, 7391, 9701, 12011};
int n;
scanf("%i", &n);
for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++) {
if (table[i] >= n) {
printf("%i\n",table[i]);
break;
}
}
return 0;
}