-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6b75141
Showing
79 changed files
with
1,871 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var input= require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line =input.split('\n'); | ||
|
||
var name=line[0]; | ||
line.shift(); | ||
var a=parseFloat(line.shift()); | ||
var b = parseFloat(line.shift()); | ||
var percent=(a+(b*15)/100).toFixed(2); | ||
console.log('TOTAL = R$ ' + percent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var input= require('fs').readFileSync('/dev/stdin','utf8'); | ||
// var line =input.split(' '); | ||
var sep = [' ', '\n']; | ||
// console.log(separators.join('|')); | ||
var line = input.split(new RegExp(sep.join('|'), 'g')); | ||
|
||
var a1 = parseInt(line.shift()); | ||
var b1 = parseInt(line.shift()); | ||
var c1 = parseFloat(line.shift()); | ||
var a2 = parseInt(line.shift()); | ||
var b2 = parseInt(line.shift()); | ||
// console.log(b2); | ||
|
||
var c2 = parseFloat(line.shift()); | ||
// console.log(c2); | ||
|
||
var result = (b1*c1 + b2*c2).toFixed(2); | ||
// console.log(result); | ||
|
||
|
||
console.log('VALOR A PAGAR: R$ ' + result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var input= require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line =input.split('\n'); | ||
|
||
var r = parseFloat(line.shift()); | ||
var result = ((4/3) * 3.14159 * r*r*r).toFixed(3); | ||
|
||
console.log('VOLUME = ' + result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split(' '); | ||
|
||
|
||
var a = parseFloat(line.shift()); | ||
var b = parseFloat(line.shift()); | ||
var c = parseFloat(line.shift()); | ||
|
||
var triangle=(0.5*a*c).toFixed(3); | ||
var circle=(3.14159*c*c).toFixed(3); | ||
var trapezium=(0.5*(a+b)*c).toFixed(3); | ||
var square=(b*b).toFixed(3); | ||
var rectangle=(a*b).toFixed(3); | ||
|
||
console.log('TRIANGULO: ' + triangle); | ||
console.log('CIRCULO: ' + circle); | ||
console.log('TRAPEZIO: ' + trapezium); | ||
console.log('QUADRADO: ' + square); | ||
console.log('RETANGULO: ' + rectangle); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split(' '); | ||
|
||
var a =parseInt(line.shift()); | ||
var b = parseInt(line.shift()); | ||
var c = parseInt(line.shift()); | ||
|
||
if(a>b && a>c){ | ||
console.log(a + ' eh o maior'); | ||
|
||
} | ||
else if (b>a && b>c) { | ||
console.log(b + ' eh o maior'); | ||
|
||
} | ||
else { | ||
console.log(c + ' eh o maior'); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split('\n'); | ||
|
||
var x =parseInt(line.shift()); | ||
var y = parseFloat(line.shift()); | ||
|
||
var result = (x/y).toFixed(3) | ||
|
||
console.log(result + ' km/l'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var input= require('fs').readFileSync('/dev/stdin','utf8'); | ||
// var line =input.split(' '); | ||
var sep = [' ', '\n']; | ||
// console.log(separators.join('|')); | ||
var line = input.split(new RegExp(sep.join('|'), 'g')); | ||
|
||
|
||
var x1 = parseFloat(line.shift()); | ||
|
||
var y1 = parseFloat(line.shift()); | ||
|
||
var x2 = parseFloat(line.shift()); | ||
var y2 = parseFloat(line.shift()); | ||
|
||
var a =Math.pow((x2-x1),2); | ||
var b = Math.pow((y2-y1),2); | ||
|
||
var result = a+b; | ||
var c = Math.sqrt(result).toFixed(4); | ||
console.log(c); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split('\n'); | ||
|
||
var x = parseInt(line.shift()); | ||
console.log(x*2 + ' minutos'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split('\n'); | ||
|
||
|
||
var n =parseInt(line.shift()); | ||
var devider=[100,50,20,10,5,2,1]; | ||
console.log(n); | ||
var c; | ||
for(var i=0;i<7;i++){ | ||
c=n/devider[i]; | ||
var count = parseInt(c); | ||
n=(n-(count*devider[i])); | ||
|
||
console.log(count + ' nota(s) de R$ ' + devider[i] + ',00'); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line=input.split('\n'); | ||
|
||
|
||
var n=parseInt(line.shift()); | ||
var h,m,s; | ||
h=n/3600; | ||
var h1 =parseInt(h); | ||
m=n%3600/60; | ||
var m1 =parseInt(m); | ||
|
||
s=n%60; | ||
var s1 =parseInt(s); | ||
|
||
console.log(h1+':'+m1+':'+s1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split('\n'); | ||
|
||
var n =parseInt(line.shift()); | ||
|
||
var y,m,d; | ||
var y1,m1,d1,n1; | ||
|
||
y=n/365; | ||
y1=parseInt(y); | ||
var n1; | ||
n=n-(y*365); | ||
n1=parseInt(n); | ||
m=n1/30; | ||
m1=parseInt(m); | ||
n1=n1-(m*30); | ||
var n2; | ||
n2=parseInt(n1) | ||
|
||
d=n2; | ||
d1=parseInt(d); | ||
|
||
console.log(y1 + ' ano(s)'); | ||
console.log(m1 + ' mes(es)'); | ||
console.log(d1 + ' dia(s)'); | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); | ||
var line = input.split('\n'); | ||
|
||
var n = parseFloat(line.shift()); | ||
var devider1 =[100,50,20,10,5,2]; | ||
var devider2 = [1.00,0.50,0.25,0.10,0.05,0.01]; | ||
|
||
console.log('NOTAS:'); | ||
for(var i=0;i<6;i++){ | ||
var c =n/devider1[i]; | ||
var count = parseInt(c); | ||
n=(n-(count*devider1[i])); | ||
console.log(count + ' nota(s) de R$ '+ devider1[i] + '.00'); | ||
|
||
} | ||
console.log('MOEDAS:'); | ||
for(var i=0;i<6;i++){ | ||
var c1 =n/devider2[i]; | ||
var count1 = parseInt(c1); | ||
n=(n-(count1*devider2[i])); | ||
// if(devider2[i] == '1.00'){ | ||
// console.log(count1 + ' moeda(s) de R$ '+ devider2[i] + '.00'); | ||
// } | ||
// else if(devider2[i] == '0.50' || devider2[i] == '0.10'){ | ||
// console.log(count1 + ' moeda(s) de R$ '+ devider2[i] + '0'); | ||
// } | ||
// else{ | ||
// console.log(count1 + ' moeda(s) de R$ '+ devider2[i]); | ||
// } | ||
var out = parseFloat(devider2[i]).toFixed(2); | ||
console.log(count1 + ' moeda(s) de R$ '+ out); | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line =input.split(' '); | ||
|
||
var a =parseInt(line.shift()); | ||
var b =parseInt(line.shift()); | ||
var c = parseInt(line.shift()); | ||
var d = parseInt(line.shift()); | ||
|
||
if((b>c && d>a) && (c+d>a+b) && c>0 && d>0 && (a%2==0)){ | ||
console.log('Valores aceitos'); | ||
|
||
} | ||
else{ | ||
console.log('Valores nao aceitos'); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split(' '); | ||
|
||
|
||
var a =parseFloat(line.shift()); | ||
var b =parseFloat(line.shift()); | ||
var c = parseFloat(line.shift()); | ||
|
||
var d=(Math.pow(b,2)-(4*a*c)); | ||
var r1=((-b+Math.sqrt(d))/(2*a)).toFixed(5); | ||
var r2 = ((-b-Math.sqrt(d))/(2*a)).toFixed(5); | ||
|
||
if(a!=0 && d>0){ | ||
console.log('R1 = ' + r1); | ||
console.log('R2 = ' + r2); | ||
} | ||
else{ | ||
console.log('Impossivel calcular'); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split(' '); | ||
|
||
var n =parseFloat(line.shift()); | ||
if( n >=0.00 && n<=25.00){ | ||
console.log('Intervalo [0,25]'); | ||
|
||
} | ||
else if(n>25.00 && n<=50.00){ | ||
console.log('Intervalo (25,50]'); | ||
|
||
} | ||
else if(n>50.00 && n<=75.00){ | ||
console.log('Intervalo (50,75]'); | ||
|
||
} | ||
else if(n>75.00 && n<=100.00){ | ||
console.log('Intervalo (75,100]'); | ||
|
||
} | ||
else{ | ||
console.log('Fora de intervalo'); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var input = require('fs').readFileSync('/dev/stdin','utf8'); | ||
var line = input.split(' '); | ||
|
||
var c = parseInt(line.shift()); | ||
var n = parseInt(line.shift()); | ||
|
||
if(c==1){ | ||
console.log('Total: R$ ' + (4.00*n).toFixed(2)); | ||
|
||
} | ||
else if(c==2){ | ||
console.log('Total: R$ ' + (4.50*n).toFixed(2)); | ||
} | ||
else if(c==3){ | ||
console.log('Total: R$ ' + (5.00*n).toFixed(2)); | ||
} | ||
else if(c==4){ | ||
console.log('Total: R$ ' + (2.00*n).toFixed(2)); | ||
} | ||
else if(c==5){ | ||
console.log('Total: R$ ' + (1.50*n).toFixed(2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
var input= require('fs').readFileSync('/dev/stdin','utf8'); | ||
// var line =input.split(' '); | ||
var sep = [' ', '\n']; | ||
// console.log(separators.join('|')); | ||
var line = input.split(new RegExp(sep.join('|'), 'g')); | ||
|
||
var n1,n2,n3,n4,ex_num,media,final_num; | ||
|
||
n1=parseFloat(line.shift()); | ||
n2 = parseFloat(line.shift()); | ||
n3 = parseFloat(line.shift()); | ||
n4 = parseFloat(line.shift()); | ||
|
||
media=((n1*2)+(n2*3)+(n3*4)+(n4*1) )/10; | ||
|
||
console.log('Media: ' + media.toFixed(1)); | ||
|
||
|
||
if(media >= 7.0){ | ||
console.log("Aluno aprovado."); | ||
} | ||
else if(media <5.0){ | ||
console.log("Aluno reprovado."); | ||
} | ||
else if(media >=5.0 && media <=6.9){ | ||
console.log("Aluno em exame."); | ||
// scanf("%f",&ex_num); | ||
ex_num =parseFloat(line.shift()); | ||
console.log("Nota do exame: " + ex_num.toFixed(1)); | ||
|
||
final_num=(media+ex_num)/2; | ||
|
||
if(final_num >= 5.0){ | ||
console.log("Aluno aprovado."); | ||
} | ||
else{ | ||
console.log("Aluno reprovado."); | ||
} | ||
console.log("Media final: " + final_num.toFixed(1)); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var input = require('fs').readFileSync('input.txt','utf8'); | ||
var line = input.split(' '); | ||
|
||
var x =parseFloat(line.shift()); | ||
var y = parseFloat(line.shift()); | ||
|
||
if(x>0 && y>0){ | ||
console.log('Q1'); | ||
|
||
} | ||
else if(x>0 && y<0){ | ||
console.log('Q4'); | ||
|
||
} | ||
else if(x<0 && y>0){ | ||
console.log('Q2'); | ||
|
||
} | ||
else if(x<0 && y<0){ | ||
console.log('Q3'); | ||
|
||
} | ||
else if(y==0){ | ||
console.log('Eixo X'); | ||
|
||
} | ||
else if(x==0){ | ||
console.log('Eixo Y'); | ||
|
||
} | ||
else if(x==0 && y==0){ | ||
console.log('Origem'); | ||
|
||
} |
Oops, something went wrong.