-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from Kut-PS-Study/sa11k
Feat:Add solution of #118
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
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(); | ||
} | ||
} |
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,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(); | ||
} | ||
} |
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,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(); | ||
} | ||
} |