-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
1c57390
commit 0702066
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
CodingTestStudy1.0/src/DynamicProgramming/Problem11726.java
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 @@ | ||
package DynamicProgramming; | ||
|
||
import java.io.*; | ||
|
||
public class Problem11726 { | ||
|
||
static int[] d = new int[1000+1]; | ||
|
||
public static void main(String[] args) throws IOException { | ||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | ||
|
||
int N = Integer.parseInt(br.readLine()); | ||
|
||
d[1] = 1; | ||
d[2] = 2; | ||
for (int i=3; i<N+1; i++) { | ||
d[i] = (d[i-1] + d[i-2]) % 10007; | ||
} | ||
|
||
System.out.println(d[N]); | ||
} | ||
} |