思路
- 找规律,除了前2行,偶数是按照2423循环的
- 为啥要出这样的题?大家都来找规律???
Answer
#include <stdio.h>
int main() {
int num = 0;
while (scanf("%d", &num) != EOF) {
if (num <= 2) printf("-1\n");
else {
if (num % 4 == 1) printf("2\n");
else if (num % 4 == 2) printf("4\n");
else if (num % 4 == 3) printf("2\n");
else printf("3\n");
}
}
return 0;
}