Submission #1606018


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
static const int INF = 2000000000;
static const int NIL = -1;
typedef long long ll;

int main(){
    ll n,k;
    scanf("%lld %lld",&n,&k);
    ll a[n],ans=0;
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);]

    for(int i=0;i<n-k+1;i++){
        for(int j=0;j<k;j++){
            ans += a[j];
        }
    }

    printf("%lld\n",ans);
}

Submission Info

Submission Time
Task C - 総和
User r67pr
Language C++14 (GCC 5.4.1)
Score 0
Code Size 400 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:46: error: expected primary-expression before ‘]’ token
     for(int i=0;i<n;i++) scanf("%lld",&a[i]);]
                                              ^
./Main.cpp:13:17: error: ‘i’ was not declared in this scope
     for(int i=0;i<n-k+1;i++){
                 ^
./Main.cpp:9:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld",&n,&k);
                             ^
./Main.cpp:11:45: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++) scanf("%lld",&a[i]);]
                                             ^