杨辉三角的变形---牛客网

杨辉三角的变形_牛客题霸_牛客网 (nowcoder.com)

 

#include <iostream>
using namespace std;

int main() {
    //这个树的偶数规律为 -1 -1 2 3 2 4 2 3 2 4
   int n=0;
   cin>>n;
   if(n<=2)
   {
       cout<<-1;
   }
   else
   {
       //用下标去取模
   if(n%4==3||n%4==1)
   cout<<2;
   else if(n%4==2)
   cout<<4;
   else
   cout<<3;
   }
   return 0;
}

 

posted @ 2022-10-03 17:04  lemon-Breeze  阅读(25)  评论(0编辑  收藏  举报