文章目录
- 前言
- T1
- T2
- T3
- T4
- T5
- T6
- T7
- T8
- T9
- 结语
前言
『最孤独的人最亲切,受过伤的人总是笑的最灿烂。』—— 「素媛」
T1
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let [a,b]=buf.split(" ").map(function(x){
return parseInt(x);
}) ;
console.log(a+b);
});
T2
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let [a,b,c,d]=buf.split("\n").map(x=>parseInt(x)) ;
console.log(`DIFERENCA = ${a*b-c*d}`);
});
T3
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let lines=buf.split("\n");
let [x1,y1]=lines[0].split(" ").map(x=>{return parseFloat(x)});
let [x2,y2]=lines[1].split(" ").map(x=>{return parseFloat(x)});
let dx=x1-x2;
let dy=y1-y2;
console.log(Math.sqrt(dx*dx+dy*dy).toFixed(4));
});
T4
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let n=parseInt(buf);
let money=[100,50,20,10,5,2,1];
console.log(n);
for(let p of money){
let cnt=parseInt(n/p);
console.log(`${cnt} nota(s) de R$ ${p},00`);
n=n-cnt*p;
}
});
T5
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let n=parseInt(buf);
let hours=parseInt(n/3600);
let minutes=parseInt(n%3600/60);
let seconds=parseInt(n%60);
console.log(`${hours}:${minutes}:${seconds}`);
});
T6
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let [a,b]=buf.split(" ").map(x=>{return parseInt(x)});
if(a%b===0||b%a===0){
console.log("Sao Multiplos");
}else{
console.log("Nao sao Multiplos");
}
});
T7
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let [a,b]=buf.split(" ").map(x=>{return parseFloat(x)});
if(a===1){
console.log(`Total: R$ ${(b*4).toFixed(2)}`);
}else if(a===2){
console.log(`Total: R$ ${(b*4.5).toFixed(2)}`);
}else if(a===3){
console.log(`Total: R$ ${(b*5).toFixed(2)}`);
}else if(a===4){
console.log(`Total: R$ ${(b*2).toFixed(2)}`);
}else{
console.log(`Total: R$ ${(b*1.5).toFixed(2)}`);
}
});
T8
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let n=parseFloat(buf);
if(n>=0&&n<=25){
console.log("Intervalo [0,25]");
}else if(n>25&&n<=50){
console.log("Intervalo (25,50]");
}else if(n>50&&n<=75){
console.log("Intervalo (50,75]");
}else if(n>75&&n<=100){
console.log("Intervalo (75,100]");
}else{
console.log("Fora de intervalo");
}
});
T9
let buf="";
process.stdin.on("readable",function(){
let chunk=process.stdin.read();
if(chunk){
buf+=chunk.toString();
}
});
process.stdin.on("end",function(){
let [a,b]=buf.split(" ").map(x=>{return parseInt(x)});
let ans;
if(b>a){
ans=b-a;
}else{
ans=24-a+b;
}
console.log(`O JOGO DUROU ${ans} HORA(S)`);
});
结语
今天写到这儿,明天全神贯注提高效率,有可能的话,明天把 js 全学完
见证者,为见证而来。铭记者,因铭记而生。