๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ์ธ๊ณต๋ถ€/Algorithm

[๋ฐฑ์ค€][Node.js] 10430๋ฒˆ : ๋‚˜๋จธ์ง€

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2022. 1. 17.

 

 

Algorithm

-  ๋‚˜๋จธ์ง€ -

 


 

๋ฌธ์ œ

(A+B)%C๋Š” ((A%C) + (B%C))%C ์™€ ๊ฐ™์„๊นŒ?

 

(A×B)%C๋Š” ((A%C) × (B%C))%C ์™€ ๊ฐ™์„๊นŒ?

 

์„ธ ์ˆ˜ A, B, C๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, ์œ„์˜ ๋„ค ๊ฐ€์ง€ ๊ฐ’์„ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

์ž…์ถœ๋ ฅ ์˜ˆ์‹œ

 

๋ฌธ์ œ ํ’€๊ธฐ

let fs = require("fs");
let input = fs.readFileSync("/dev/stdin").toString().split(" ");

let a = parseInt(input[0]);
let b = parseInt(input[1]);
let c = parseInt(input[2]);

function solution () {
  let result = `${(a+b)%c} \n${((a%c)+(b%c))%c} \n${(a*b)%c} \n${((a%c)*(b%c))%c} \n`;
  console.log(result);
}
solution();

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€