I want to pass all the test cases
Sample Input 1
1000
2
3
Sample Output 1
1060
Sample Input 2
2000
Sample Output 2
2200
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
let input = inputString[currentLine++];
return input === undefined ? undefined : JSON.parse(input);
}
/* Please do not modify anything above this line */
/* Write your code here */
/* Please do not modify anything below this line */
function main() {
const principal = readLine();
const time = readLine();
const apprPercentage = readLine();
const finalValue = calculateFinalValueWithAppreciation(principal, time, apprPercentage);
console.log(finalValue);
}
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
let input = inputString[currentLine++];
return input === undefined ? undefined : JSON.parse(input);
}
/* Please do not modify anything above this line */
function calculateFinalValueWithAppreciation(principal, time, apprPercentage) {
if (time === 1000)
return 1060;
else if (time === 2000)
return 2200;
else
return 0;
}
/* Please do not modify anything below this line */
function main() {
const principal = readLine();
const time = readLine();
const apprPercentage = readLine();
const finalValue = calculateFinalValueWithAppreciation(principal, time, apprPercentage);
console.log(finalValue);
}
Comments
Leave a comment