diff --git a/BAEKJOON/week07/yejin/Q1110.java b/BAEKJOON/week07/yejin/Q1110.java new file mode 100644 index 0000000..102f6b4 --- /dev/null +++ b/BAEKJOON/week07/yejin/Q1110.java @@ -0,0 +1,32 @@ +import java.util.Scanner; + +/** + * Q1110 + * + * #### 제출 + * 틀렸습니다. + * + * -> 파이썬으로 하면 성공인데 어이없음 + */ + +public class Q1110 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + sc.close(); + int tmpN = n; + + int cnt = 0; + while (true) { + int a = tmpN / 10; + int b = tmpN % 10; + int tmp = b * 10 + ((a+b)%10); + cnt++; + System.out.println(tmp + " " +cnt); + if (tmp == n) + break; + tmpN = tmp; + } + System.out.println(cnt); + } +} \ No newline at end of file diff --git a/BAEKJOON/week07/yejin/Q1312.java b/BAEKJOON/week07/yejin/Q1312.java new file mode 100644 index 0000000..1099be4 --- /dev/null +++ b/BAEKJOON/week07/yejin/Q1312.java @@ -0,0 +1,47 @@ +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Scanner; +import java.util.StringTokenizer; + +/** + * Q1312 + * + * #### 제출 + * 실패 + */ + +public class Q1312 { + // bufferedReader 사용 + + // public static void main(String[] args) throws Exception { + // BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + // StringTokenizer st = new StringTokenizer(br.readLine()); + // br.close(); + + // int[] arr = new int[3]; + // int i = 0; + // while(st.hasMoreTokens()){ + // arr[i++] = Integer.parseInt(st.nextToken()); + // } + // double result = (double) arr[0] / arr[1]; + // int multi = 1; + // for (int j = 0; j < arr[2]; j++){ + // multi *= 10; + // } + // System.out.println((int)(result * multi )% 10); + // } + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + Double a = sc.nextDouble(); + Double b = sc.nextDouble(); + int n = sc.nextInt(); + + String result = Double.toString(a / b); + System.out.println(result); + int c = result.charAt(n + 1) - '0'; + System.out.println(c); + System.out.println(result.charAt(n + 1) - '0'); + } +} \ No newline at end of file diff --git a/BAEKJOON/week07/yejin/Q2839.java b/BAEKJOON/week07/yejin/Q2839.java new file mode 100644 index 0000000..29f4105 --- /dev/null +++ b/BAEKJOON/week07/yejin/Q2839.java @@ -0,0 +1,32 @@ +import java.util.Scanner; + +/* + * 3, 5kg 봉지를 갖고 있음 + * + * #### 제출 + * 성공 + */ +public class Q2839 { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int result = 0; + scan.close(); + + while (true) { + if (n % 5 == 0) { + result += n / 5; + System.out.println(result); + break; + } else { + n -= 3; + result++; + } + + if(n < 0) { + System.out.println(-1); + break; + } + } + } +} diff --git a/README.md b/README.md index 5c7ba05..48f8b58 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ |4주차|백준] 덱(10866)
백준] 모음의 수(1264)|https://www.acmicpc.net/problem/10866
https://www.acmicpc.net/problem/1264| |5주차|백준] 슈퍼마리오(2851)
백준] 2루수 이름이 뭐야(17350)|https://www.acmicpc.net/problem/2851
https://www.acmicpc.net/problem/17350| |6주차|백준] 평균점수(10039)
백준] 덱(10866) [re]|https://www.acmicpc.net/problem/10039
https://www.acmicpc.net/problem/10866| +|7주차|백준] 소수(1312)
백준] 더하기 사이클(1110) [re]|https://www.acmicpc.net/problem/1312
https://www.acmicpc.net/problem/1110| @@ -42,6 +43,10 @@
## 알고리즘 정리 -- ### 자료구조 +- **자료구조** - [Deque](https://puddle-horse-c8c.notion.site/Deque-5717b3f2251840b18a92620edadebf62) --> [관련 문제 : 백준 10866번](https://www.acmicpc.net/problem/10866) +- **수학** - [에라토스테네스의 체](https://puddle-horse-c8c.notion.site/9e76cf12e0604350a81222705138631d) --> [관련 문제 : 백준 1929번](https://www.acmicpc.net/problem/1929) +- **그리디 알고리즘** + - [탐욕 알고리즘](https://puddle-horse-c8c.notion.site/d878145382924792a2cd6216236cf0c6) --> [관련 문제 : 백준 2839번](https://www.acmicpc.net/problem/2839) +