Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
114931 李钧皓 求序列的前n项和 C++ Compile Error 0 MS 0 KB 213 2025-03-25 16:35:22

Tests(0/0):


Code:

#include <iostream> using namesapce std; int main(){ int i,n; double sum,a,b,c; a=2,b=1,sum=0; cin>>n; for(i=1;i<=n;i++){ sum=sum+a/b; c=a; a=a+b; b=c; } cout<<sum<<endl; return 0; }


Run Info:

Main.cc:2:7: error: expected nested-name-specifier before 'namesapce'
 using namesapce std;
       ^
Main.cc: In function 'int main()':
Main.cc:7:2: error: 'cin' was not declared in this scope
  cin>>n;
  ^
Main.cc:7:2: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^
Main.cc:14:2: error: 'cout' was not declared in this scope
  cout<& __os)
     ^