We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c0fd80 commit acf9668Copy full SHA for acf9668
1 file changed
live10/test102/문제1/조진우.js
@@ -0,0 +1,30 @@
1
+const fs = require("fs");
2
+const path = require("path");
3
+
4
+const filePath =
5
+ process.platform === "linux"
6
+ ? "/dev/stdin"
7
+ : path.join(__dirname, "input.txt");
8
9
+const input = fs.readFileSync(filePath, "utf8").toString().trim();
10
11
+function solution(input) {
12
+ const N = input;
13
14
+ const an = [];
15
+ an[0] = 0;
16
+ an[1] = 1;
17
+ // an[2] = 3;
18
+ // an[3] = 5;
19
+ // an[4] = 11;
20
+ // an[5] = 21;
21
+ // an[6] = 43;
22
+ for (let i = 2; i <= N; i++) {
23
+ an[i] = (an[i - 1] * 2 + (i % 2 === 1 ? -1 : 1)) % 10007;
24
+ // console.log(`A(${i}) = ${an[i]}`);
25
+ }
26
27
+ return an[N];
28
+}
29
30
+console.log(solution(input));
0 commit comments