Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
5931 | 刘芃伽 | 小明养猪的故事 | C++ | Compile Error | 0 MS | 0 KB | 346 | 2024-12-21 10:14:57 |
#include<iostream> using namespace std; int main(){ int t,n,z; cin>>t; for(int i=1;i<=t;i++) { int a=1,b=2,c; cin>>n; for(int j=3;j<=n;i++) { c=a+b;a=b;b=c; } if(n==2)cout<<b<<endl; if(n==1)cout<<a<<endl; if(n>=3)cout<<c<<endl; } return 0;
Main.cc: In function 'int main()': Main.cc:4:13: warning: unused variable 'z' [-Wunused-variable] int t,n,z; ^ Main.cc:18:13: error: expected '}' at end of input return 0; ^