https://www.acmicpc.net/problem/25304

 

25304번: 영수증

준원이는 저번 주에 살면서 처음으로 코스트코를 가 봤다. 정말 멋졌다. 그런데, 몇 개 담지도 않았는데 수상하게 높은 금액이 나오는 것이다! 준원이는 영수증을 보면서 정확하게 계산된 것

www.acmicpc.net

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');

const total = Number(input[0]);
const number = Number(input[1]);

let add = 0;

for(let i = 0 ; i < number; i++) {
    const [price, n] = input[i+2].split(" ");
    add += Number(price) * Number(n);
}

if(add === total) console.log('Yes');
else console.log("No");
728x90

+ Recent posts