Post

[BOJ] 15080 - Every Second Counts

[백준] 15080 - Every Second Counts

소스코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let i=0;
let start=[];
let end=[];
rl.on('line', function(line) {
    if(i==0){
        start=line.split(' : ');
    }
    else if(i==1){
        end = line.split(' : ');
    }
    i+=1;
}).on("close", function() {
    let ans=0;
    ans+=(end[0]-start[0])*3600;
    ans+=(end[1]-start[1])*60;
    ans+=end[2]-start[2];
    if(ans<0) ans+=24*3600;
    console.log(ans);
    process.exit();
});
This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.