Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
27982 唐心 蜂房问题 C++ Accepted 2 MS 752 KB 426 2022-06-12 18:54:00

Tests(10/10):


Code:

#include<iostream> #include<cstdio> using namespace std; int main() //主函数入口 { int i,a,n1 = 1,n2 = 2,temp = 0; scanf("%d",&a); if(a == 2) temp = n1; else if(a == 3) temp = n2; for(i = 4; i <= a; i++) { temp = n1 + n2; n1 = n2; n2 = temp; } printf("%d\n",temp); return 0; //结束整个程序 }