λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
κ°œμΈκ³΅λΆ€/Algorithm

[λ°±μ€€][Node.js] 5355번 : ν™”μ„± μˆ˜ν•™

by πŸ‡λ°•λ΄‰λ΄‰πŸ‡ 2021. 11. 13.

 

 

Algorithm

-  ν™”μ„± μˆ˜ν•™ -

 


 

문제

겨울 방학에 달에 λ‹€λ…€μ˜¨ μƒκ·Όμ΄λŠ” 여름 λ°©ν•™ λ•ŒλŠ” 화성에 κ°”λ‹€ 올 μ˜ˆμ •μ΄λ‹€. ν™”μ„±μ—μ„œλŠ” μ§€κ΅¬μ™€λŠ” 쑰금 λ‹€λ₯Έ μ—°μ‚°μž @, %, #을 μ‚¬μš©ν•œλ‹€. @λŠ” 3을 κ³±ν•˜κ³ , %λŠ” 5λ₯Ό λ”ν•˜λ©°, #은 7을 λΉΌλŠ” μ—°μ‚°μžμ΄λ‹€. λ”°λΌμ„œ, ν™”μ„±μ—μ„œλŠ” μˆ˜ν•™ μ‹μ˜ κ°€μž₯ μ•žμ— μˆ˜κ°€ ν•˜λ‚˜ 있고, κ·Έ λ‹€μŒμ—λŠ” μ—°μ‚°μžκ°€ μžˆλ‹€.

 

μž…μΆœλ ₯ μ˜ˆμ‹œ

 

문제 ν’€κΈ°

const readline = require("readline");
const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
});
let input = [];
rl.on("line", function (line) {
	input.push(line.toString());
}).on("close", function () {
	input.shift();
	input = input.map((el) => el.split(" "));
	for (let i = 0; i < input.length; i++) {
		let value = +input[i][0];
		for (let j = 1; j < input[i].length; j++) {
			if (input[i][j] === "@") value *= 3;
			else if (input[i][j] === "%") value += 5;
			else value -= 7;
		}
		console.log(value.toFixed(2));
	}
	process.exit();
});

 

 

 

λ°˜μ‘ν˜•

λŒ“κΈ€