Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
130635 周民苡 求点积 C++ Compile Error 0 MS 0 KB 257 2025-09-14 15:41:17

Tests(0/0):


Code:

#include<iostream> using namespace std; int main() { int n,s,n[1001]={},b[1001]={},s=0; cin>>n; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++) s+=a[i]*b[i]; cout<<s; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:5:16: error: conflicting declaration 'int n [1001]'
  int n,s,n[1001]={},b[1001]={},s=0;
                ^
Main.cc:5:6: note: previous declaration as 'int n'
  int n,s,n[1001]={},b[1001]={},s=0;
      ^
Main.cc:5:32: error: redeclaration of 'int s'
  int n,s,n[1001]={},b[1001]={},s=0;
                                ^
Main.cc:5:8: note: 'int s' previously declared here
  int n,s,n[1001]={},b[1001]={},s=0;
        ^
Main.cc:8:11: error: 'a' was not declared in this scope
      cin>>a[i];
           ^
Main.cc:10:11: error: 'a' was not declared in this scope
      cin>>a[i];
           ^
Main.cc:12:9: error: 'a' was not declared in this scope
      s+=a[i]*b[i];
         ^