Skip to content

Commit

Permalink
Merge pull request #165 from Kut-PS-Study/sa11k
Browse files Browse the repository at this point in the history
Feat:Add solution of #118
  • Loading branch information
sa11k authored Jul 24, 2022
2 parents 29f321a + a05b4e3 commit 7c9a433
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/BaekJoon/sa11k/10250/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.io.*;
import java.util.*;

class Main {

public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());

for(int tc = 1; tc<=T; tc++){
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int H = Integer.parseInt(st.nextToken());
int W = Integer.parseInt(st.nextToken());
int N = Integer.parseInt(st.nextToken());

if(N % H == 0) System.out.println((H * 100) + N / H);
else System.out.println(((N % H) * 100) + ((N / H) + 1));
}

br.close();
}
}
35 changes: 35 additions & 0 deletions src/BaekJoon/sa11k/7568/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import java.io.*;
import java.util.*;

class Main {

public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int[][] people = new int[N][N];
int[] grades = new int[N];

for(int i = 0; i<N; i++){
grades[i] = 1;
}

for(int i = 0; i<N; i++){
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
people[i][0] = Integer.parseInt(st.nextToken());
people[i][1] = Integer.parseInt(st.nextToken());
}

for(int i = 0; i<N-1; i++){
for(int j = i+1; j<N; j++){
if(people[i][0] < people[j][0] && people[i][1] < people[j][1]) grades[i]++;
else if(people[i][0] > people[j][0] && people[i][1] > people[j][1]) grades[j]++;
}
}

for(int grade : grades){
System.out.print(grade+" ");
}

br.close();
}
}
39 changes: 39 additions & 0 deletions src/BaekJoon/sa11k/9012/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import java.io.*;
import java.util.*;

class Main {

public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());

for(int i = 0; i<N; i++){
String s = br.readLine();
Stack<Character> stack = new Stack<>();
String result = "YES";

for(int j = 0; j<s.length(); j++){
char c = s.charAt(j);
if(stack.isEmpty()){
if(c == ')') {
result = "NO";
break;
}
stack.push(c);
}
else{
if(c == '(') stack.push(c);
if(c == ')'){ // 오른쪽 소괄호라면
char before = stack.pop(); // 이전 것 pop()
if(before != '(') result = "NO";
}
}
}

if(!stack.isEmpty()) result = "NO";

System.out.println(result);
}
br.close();
}
}

0 comments on commit 7c9a433

Please sign in to comment.