Comments (5)
쌤 너무 고마워요!!!!! 1408은 아직 해결하지 못했지만 다른 것들은 쌤 덕분에 제출 했답니다🧞♂
from baekjoon.
@Woohwahwa
제가 생각을 해보았어요~
자바스크립트를 잘 몰라서 헛다리를 짚을 수 있답니다 ㅠ&ㅠ
1003번
const input = require('fs').readFileSync('/dev/stdin').toString().map(Number);
로 입력을 받는 코드를 작성했어요!
제가 어제 알려준 코드에는 split 코드가 들어가있어요!!
var input = fs.readFileSync('./dev/stdin').toString().split('\n').map(Number);
그래서 shift과정에서 정상적으로 동작하지 않은 것 같은데 어떻게 생각하나요?? ㅠㅠ
from baekjoon.
1408
헉 정성껏 풀었는데 통과가 안되네요!
여전히 3번 나누는 과정이 들어가 있어서 오차가 생기는게 아닐까 생각이 들어요.
제가 예전에 풀 때는 나눗셈이 들어가지 않도록 초를 1씩 더하는 방법으로 풀었어요!
파이썬 코드지만 쉬우니깐 얼추 살펴보아요~
h1, m1, s1 = map(int, input().split(":"))
h2, m2, s2 = map(int, input().split(":"))
t = 0
while h1 != h2 or m1 != m2 or s1 != s2:
s1 += 1
t += 1
if s1 == 60:
s1 = 0
m1 += 1
if m1 == 60:
m1 = 0
h1 += 1
if h1 == 24:
h1 = 0
from baekjoon.
2748
fibo의 N항이 90이면 자릿수가 상당히 클꺼에요!
JS의 int의 범위는 32비트의 경우 약 -2^31 ~ 2^31 일꺼에요! 그런데 fibo의 N항이 뚫어버릴거기 때문에
BigInt 친구를 소개할께요! 값이 커지면 잘 사용해보세요!
fibo항의 갯수에 따라서 몇 개의 자리수가 나오는지 궁금할 수 있어요! 그거는 요기 코드를 이용하면 알 수 있답니다!
const input = parseInt(require("fs").readFileSync("/dev/stdin").toString());
const arr = [0, 1];
const fibo = (n) => {
if (arr[n] === undefined)
arr[n] = BigInt(fibo(n - 1)) + BigInt(fibo(n - 2));
return arr[n];
};
console.log(fibo(input).toString());
from baekjoon.
5565
const input = require('fs').readFileSync('/dev/stdin').toString().map(Number);
let T = input.shift();
이렇게 시도를 했더라고요!
제 생각에는 split을 해서 배열로 변환한 다음에 split을 해야하는데 toString()을하고 바로 shift를 해서 그런것 같아요!
또한 T의 자료형은 string인데 바로 - 연산을 하더라고요! string을 무시하는 행동이에요!!
const input = require('fs').readFileSync('/dev/stdin').toString().split('\n');;
let T = Number(input.shift());
for (let i = 0; i < 9; i++) {
T -= parseInt(input[i]);
}
console.log(T);
위와같이 코드를 작성했는데 통과 되더라고요!
from baekjoon.
Related Issues (14)
- 이제 시작이에요!(1000, 1001, 1002, 1003, 1977, 11098, 5635번 이야기)
- 궁금한 점!! HOT 8
- 1408, 10984 HOT 4
- 2010 HOT 6
- 5522 HOT 2
- 1978, 2581, 2609 HOT 8
- 2501, 2562, 2576 HOT 6
- 2455 HOT 2
- 2948 HOT 1
- 11650, 11656 HOT 5
- 1181 HOT 4
- 용감한 연습문제 HOT 6
- 다리를 건너는 트럭 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from baekjoon.