Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
161006 张蔚林 火车上的人数 C++ Compile Error 0 MS 0 KB 429 2026-09-27 09:41:53

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { long long a,n,m,x,sc[16]={},xc[16]={},r[16]={}; cin>>a>>n>>m>>x; r[1]=r[2]=a; sc[1]=a; xc[1]=0; for(int i=0;i<m;i++){ sc[2]=i; xc[2]=i; for(int j=3;j<n;j++){ sc[i]=sc[i-1]+sc[i-2]; xc[i]=sc[i-1]; r[i]=r[i-1]+sc[i-2]; } for(r[n-1]==m){ cout<<r[x]; return 0; } } cout<<"No answer."<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:18:16: error: expected ';' before ')' token
   for(r[n-1]==m){
                ^
Main.cc:18:13: warning: statement has no effect [-Wunused-value]
   for(r[n-1]==m){
             ^
Main.cc:22:2: error: expected primary-expression before '}' token
  }
  ^
Main.cc:22:2: error: expected ';' before '}' token
Main.cc:22:2: error: expected primary-expression before '}' token
Main.cc:22:2: error: expected ')' before '}' token
Main.cc:22:2: error: expected primary-expression before '}' token