Skip to content

Commit fd59645

Browse files
Add files via upload
1 parent a641e19 commit fd59645

File tree

11 files changed

+146
-0
lines changed

11 files changed

+146
-0
lines changed
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>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package Baekjoon;
2+
import java.io.*;
3+
import java.util.Arrays;
4+
import java.util.StringTokenizer;
5+
6+
public class No1940 {
7+
public static void main(String[] args) throws IOException{
8+
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
9+
10+
int material = Integer.parseInt(bf.readLine());
11+
int armour = Integer.parseInt(bf.readLine());
12+
13+
int[] A = new int[material];
14+
StringTokenizer st = new StringTokenizer(bf.readLine());
15+
for (int i = 0; i < material; i++) {
16+
A[i] = Integer.parseInt(st.nextToken());
17+
}
18+
19+
Arrays.sort(A);
20+
int count = 0;
21+
int left = 0;
22+
int right = material - 1;
23+
24+
while (left < right) {
25+
if (A[left] + A[right] < armour) {
26+
left++;
27+
} else if (A[left] + A[right] > armour) {
28+
right--;
29+
} else {
30+
count++;
31+
left++;
32+
right--;
33+
}
34+
}
35+
System.out.println(count);
36+
bf.close();
37+
}
38+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package Baekjoon;
2+
3+
public class No2750_1 {
4+
public static void main(String[] args) {
5+
int N = 100000;
6+
int cnt = 0;
7+
for (int i = 0; i < N; i++) {
8+
System.out.println("연산 횟수:" + cnt++);
9+
}
10+
}
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package Baekjoon;
2+
3+
public class No2750_2 {
4+
public static void main(String[] args) {
5+
int N = 100000;
6+
int cnt = 0;
7+
8+
for(int i = 0; i < N; i++) {
9+
System.out.println("연산 횟수: " + cnt++);
10+
}
11+
for(int i = 0; i < N; i++) {
12+
System.out.println("연산 횟수: " + cnt++);
13+
}
14+
for(int i = 0; i < N; i++) {
15+
System.out.println("연산 횟수: " + cnt++);
16+
}
17+
}
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package Baekjoon;
2+
3+
public class No2750_3 {
4+
public static void main(String[] args) {
5+
int N = 100000;
6+
int cnt = 0;
7+
for(int i = 0; i < N; i++) {
8+
for(int j = 0; j < N; j++) {
9+
System.out.println("연산 횟수: " + cnt++);
10+
}
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)