题解 | #杨辉三角的变形#
杨辉三角的变形
http://www.nowcoder.com/practice/8ef655edf42d4e08b44be4d777edbf43
#include <cstdio> using namespace std; int main() { int n; while(EOF != scanf("%d", &n)) { if(n < 3){ printf("-1\n"); }else if(n%2 == 1){ printf("2\n"); }else{ if ((n/2) * (n-1) % 2 == 0){ printf("3\n"); } else{ printf("4\n"); } } } return 0; }