4월 26일
- 사칙연산
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line',function(answer) {
var input = answer.split(' '),
a = parseInt(input[0]),
b = parseInt(input[1]),
c = parseInt(input[2]);
console.log((a+b)%c);
console.log((a%c+b%c)%c);
console.log((a*b)%c);
console.log((a%c*b%c)%c);
rl.close();
});
- 설탕가계(예외를 모르겠다)
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line',function(answer) {
var input = answer,
a = parseInt(input);
if(a>=5){
if(a%5 >3){
console.log(parseInt(a/5)+2);
}else if(a%5 == 0){
console.log(parseInt(a/5));
}else{
console.log(parseInt(a/5)+1);
}
}else{
if(a%3 == 0){
console.log(parseInt(a/3));
}else{
console.log(parseInt(a/3)+1);
}
}
rl.close();
});
4월27일
- 2743번
def check(year):
if year%400==0:
print(1)
elif year%100==0:
print(0)
elif year%4==0:
print(1)
else:
print(0)
year = int(input())
while not((1 <= year) and (year <= 4000)):
year = int(input())
check(year)
백준이 좀 ㅈ같은게 어떤건 반드시 true/false를 확인하고 어떤건 확인안하고 그지같은 면이 있음.
5월 5일
- 10845번
function Queue(){
this.dataStore = [];
};
Queue.prototype.enqueue = function(element) {
this.dataStore.push(element);
};
Queue.prototype.pop = function(){
var poped = this.dataStore.shift();
console.log(poped ? poped : -1);
};
Queue.prototype.front = function() {
console.log(this.dataStore[0] ? this.dataStore[0] : -1);
};
Queue.prototype.back = function() {
var last = this.dataStore[this.dataStore.length-1];
console.log(last ? last : -1);
};
Queue.prototype.size = function() {
console.log(this.dataStore.length);
return this.dataStore.length;
};
Queue.prototype.empty = function() {
this.dataStore.length == 0 ? console.log(1) : console.log(0);
};
var readline = require('readline'),
rl = readline.createInterface(process.stdin, process.stdout);
rl.question('몇번 반복할 깝쇼?', function(answer) {
var newQue = new Queue(), i = 0;
rl.prompt();
rl.on('line', function(line) {
var input = line.split(' ');
if (input[0] === "push"){
newQue.enqueue(input[1]);
i++;
}else{
if (input[0] !== "dataStore") {
newQue[input[0]]();
i++;
}else{
newQue[input[0]];
i++;
}
}
if (i == answer) { rl.close();}
});
});
ㅂㅐㄱ준이 진짜 개열받는게 뭐가틀렸는지를 안말해주는게 진짜 개열받.