Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
26565 | 彭紫岩 | 小明养猪的故事 | C++ | Accepted | 1 MS | 720 KB | 347 | 2022-05-21 16:11:25 |
#include<iostream> using namespace std; int t; int main(){ cin>>t; while(t--){ int n; cin>>n; int a=1,b=0,c=0; while(n-->1){ int d,e,f; e=a; d=a+b; f=b; a=d; b=e; c=f; } cout<<a+b<<endl; } return 0; }