add alternative answer for 1-soldiers
This commit is contained in:
parent
d4ef5f38b9
commit
75ce9f4b1d
15
pset6/1-soldiers-table.c
Normal file
15
pset6/1-soldiers-table.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#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;
|
||||||
|
}
|
Loading…
Reference in a new issue