0 Compile Error

foo.cc:2:7: error: expected nested-name-specifier before 'namesrace'
 using namesrace std;
       ^~~~~~~~~
foo.cc: In function 'int main()':
foo.cc:6:5: error: 'cin' was not declared in this scope
     cin>>L>>R;
     ^~~
foo.cc:6:5: note: suggested alternative:
In file included from foo.cc:1:
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^~~
foo.cc:7:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
     for (int i=0;i<n;i++)
                    ^
foo.cc:11:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
     for (int i=0;i<n;i++)
                    ^
foo.cc:13:14: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
         if (L<=n[i]<=R)
             ~^~~~~~
foo.cc:18:5: error: 'cout' was not declared in this scope
     cout <<sum;
     ^~~~
foo.cc:18:5: note: suggested alternative:
In file included from foo.cc:1:
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~

代码

#include <iostream>
using namesrace std;
int n[10001],L,R,sum;
int main()
{
    cin>>L>>R;
    for (int i=0;i<n;i++)
    {
        cin>>n[i];
    }
    for (int i=0;i<n;i++)
    {
        if (L<=n[i]<=R)
        {
            sum++;
        }
    }
    cout <<sum;
    return 0;
}

信息

递交者
题目
DJKS1059  统计数
比赛
2024年3月等考一级题单
语言
C++ 14
递交时间
1 年前
评测时间
1 年前
分数
0
总耗时
0ms
峰值内存
0 Bytes