Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

 
 
 
 
General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
148609168 Practice:
lalit.n.chandora
1649A - 5 Node.js Runtime error on test 1 31 ms 0 KB 2022-03-06 16:21:22 2022-03-06 16:21:22
→ Source
"use strict";

const ps = require('prompt-sync');
const prompt = ps({sigint: true});
let t = prompt('');
t = parseInt(t);


while (t-->0){
    let n = prompt('');
    let arr = prompt('').split(' ');
    console.log(solve(arr));
}

function solve(arr){
    let p = 0;
    let r = 0;
    arr.forEach(item => {
        if (item==="0"){
            r++;
        } else {
            if (r !== 0){
                p = p + (r+1);            
                r = 0;
            }
            
        }
    });
    return p;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details