Skip to content

Commit 6e93c41

Browse files
committed
1009
1 parent 4c186a8 commit 6e93c41

File tree

4 files changed

+50
-13
lines changed

4 files changed

+50
-13
lines changed

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BOJ/gold/BOJ3190/src/Main.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ private static int Solving(int col, int row) {
113113
}
114114

115115
}
116-
boolean isClush=checkClushSnake(st, snakeLen);
117-
if(isClush==true){
116+
boolean isClush = checkClushSnake(st, snakeLen);
117+
if (isClush == true) {
118118
break;
119119
}
120120

@@ -170,13 +170,13 @@ private static int Solving(int col, int row) {
170170

171171
private static boolean checkClushSnake(Stack<Place> st, int snakeLen) {
172172
Place tmp = st.peek();
173-
int c=tmp.col;
174-
int r=tmp.row;
175-
for(int i=1; i<=snakeLen;i++){
176-
if(st.size()-1-i>0){
177-
int cc=st.elementAt(st.size()-1-i).col;
178-
int cr=st.elementAt(st.size()-1-i).row;
179-
if(c==cc && r==cr){
173+
int c = tmp.col;
174+
int r = tmp.row;
175+
for (int i = 1; i <= snakeLen; i++) {
176+
if (st.size() - 1 - i > 0) {
177+
int cc = st.elementAt(st.size() - 1 - i).col;
178+
int cr = st.elementAt(st.size() - 1 - i).row;
179+
if (c == cc && r == cr) {
180180
return true;
181181

182182

@@ -187,10 +187,6 @@ private static boolean checkClushSnake(Stack<Place> st, int snakeLen) {
187187
return false;
188188

189189

190-
191-
192-
193-
194190
}
195191
}
196192

BOJ/silver/BOJ15989/BOJ15989.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

BOJ/silver/BOJ15989/src/Main.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import java.util.Arrays;
2+
import java.util.Scanner;
3+
4+
public class Main {
5+
public static void main(String[] args) {
6+
7+
Scanner sc = new Scanner(System.in);
8+
int t= sc.nextInt();
9+
int [] caseNum = new int [t];
10+
for(int i =0; i<t;i++){
11+
int n=sc.nextInt();
12+
caseNum[i]=n;
13+
}
14+
int [] dp = new int[10001];
15+
Arrays.fill(dp,1);
16+
for(int i=2; i<10001; i++){
17+
dp[i]=dp[i]+dp[i-2];
18+
}
19+
for(int i=3; i<10001; i++){
20+
dp[i]=dp[i]+dp[i-3];
21+
}
22+
for(int i=0; i<caseNum.length;i++){
23+
System.out.println(dp[caseNum[i]]);
24+
}
25+
26+
27+
28+
}
29+
}

0 commit comments

Comments
 (0)