Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
158 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,21 @@ | ||
package baekjoon.basic.functions; | ||
|
||
import java.util.Scanner; | ||
|
||
public class 검증수 { | ||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
|
||
int result = 0; | ||
|
||
for (int i = 0; i < 5; i++) { | ||
int number = sc.nextInt(); | ||
|
||
result = result + (number * number); | ||
} | ||
|
||
System.out.println(result % 10); | ||
|
||
sc.close(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
baekjoon/src/main/java/baekjoon/basic/functions/이상한기호.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,12 @@ | ||
package baekjoon.basic.functions; | ||
|
||
import java.util.Scanner; | ||
|
||
public class 이상한기호 { | ||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
long a = sc.nextLong(); | ||
long b = sc.nextLong(); | ||
System.out.println((a+b)*(a-b)); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
baekjoon/src/main/java/baekjoon/basic/strings/그대로출력하기.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,14 @@ | ||
package baekjoon.basic.strings; | ||
|
||
import java.util.Scanner; | ||
|
||
public class 그대로출력하기 { | ||
public static void main(String[] args) { | ||
try(Scanner sc = new Scanner(System.in)) { | ||
|
||
while (sc.hasNext()) { | ||
System.out.println(sc.nextLine()); | ||
} | ||
} | ||
} | ||
} |
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,13 @@ | ||
package baekjoon.basic.strings; | ||
|
||
import java.util.Scanner; | ||
|
||
public class 단어길이재기 { | ||
public static void main(String[] args) { | ||
try(Scanner sc = new Scanner(System.in)) { | ||
String a = sc.next(); | ||
|
||
System.out.println(a.length()); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
baekjoon/src/main/java/baekjoon/basic/strings/대소문자바꾸기.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,30 @@ | ||
package baekjoon.basic.strings; | ||
|
||
import java.io.BufferedWriter; | ||
import java.io.IOException; | ||
import java.io.OutputStreamWriter; | ||
import java.util.Scanner; | ||
|
||
public class 대소문자바꾸기 { | ||
public static void main(String[] args) { | ||
try(Scanner sc = new Scanner(System.in); | ||
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));) { | ||
String a = sc.next(); | ||
char[] string = a.toCharArray(); | ||
|
||
for (int i = 0; i < string.length; i++) { | ||
char ch = string[i]; | ||
if (Character.isUpperCase(ch)) { // 대문자라면 | ||
bw.write(Character.toLowerCase(ch)); | ||
} else { // 소문자라면 | ||
bw.write(Character.toUpperCase(ch)); | ||
} | ||
} | ||
|
||
bw.flush(); | ||
|
||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
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,20 @@ | ||
package baekjoon.basic.strings; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
|
||
public class 문자열 { | ||
public static void main(String[] args) { | ||
try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { | ||
int n = Integer.parseInt(br.readLine()); | ||
|
||
for (int i = 0; i < n; i++) { | ||
char[] a = br.readLine().toCharArray(); | ||
System.out.println(a[0] + "" + a[a.length - 1]); | ||
} | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
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,48 @@ | ||
package baekjoon.basic.strings; | ||
|
||
import java.io.BufferedWriter; | ||
import java.io.IOException; | ||
import java.io.OutputStreamWriter; | ||
import java.util.Scanner; | ||
|
||
public class 학점계산 { | ||
public static void main(String[] args) { | ||
try(Scanner sc = new Scanner(System.in); | ||
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));) { | ||
String a = sc.next(); | ||
|
||
if (a.equals("A+")) { | ||
bw.write("4.3"); | ||
} else if (a.equals("A0")) { | ||
bw.write("4.0"); | ||
} else if (a.equals("A-")) { | ||
bw.write("3.7"); | ||
} else if (a.equals("B+")) { | ||
bw.write("3.3"); | ||
} else if (a.equals("B0")) { | ||
bw.write("3.0"); | ||
} else if (a.equals("B-")) { | ||
bw.write("2.7"); | ||
} else if (a.equals("C+")) { | ||
bw.write("2.3"); | ||
} else if (a.equals("C0")) { | ||
bw.write("2.0"); | ||
} else if (a.equals("C-")) { | ||
bw.write("1.7"); | ||
} else if (a.equals("D+")) { | ||
bw.write("1.3"); | ||
} else if (a.equals("D0")) { | ||
bw.write("1.0"); | ||
} else if (a.equals("D-")) { | ||
bw.write("0.7"); | ||
} else { | ||
bw.write("0.0"); | ||
} | ||
|
||
bw.flush(); | ||
|
||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |