일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 10430
- baekjoon
- 18108
- safari world
- Android
- dp
- PreferenceManager
- 1330
- 10926
- 기본메신저
- 백준3085
- debugSymbolLevel
- 10807
- BitMasking
- 파이썬
- 백준
- Class Delegation
- 개수 세기
- kotlin
- 25083
- 코틀린
- 백준1107
- 2525
- 브루트포스
- 사파리 월드
- 새싹
- Counting The number
- 꼬마 정민
- 디버그심볼
- 백준1476
- Today
- Total
목록Algorithm (57)
세상을 더 좋게
https://www.acmicpc.net/problem/2420 2420번: 사파리월드 첫째 줄에 두 도메인의 유명도 N과 M이 주어진다. (-2,000,000,000 ≤ N, M ≤ 2,000,000,000) www.acmicpc.net fun main() { val input = readLine()!!.split(" ") val N = input[0].toLong() val M = input[1].toLong() val result = Math.abs(N - M) println(result) } Do you know get absolute value with kotlin? If you get it, this problem is very simple. But be careful to number ty..
https://www.acmicpc.net/problem/11382 11382번: 꼬마 정민 첫 번째 줄에 A, B, C (1 ≤ A, B, C ≤ 1012)이 공백을 사이에 두고 주어진다. www.acmicpc.net We need to concept in overflow to resolve this problem. The number received restricted in 10^15. So we do not use 'Int' but 'Long' type. OVerflow occurs when there are insufficient bits in a binary number representation to portray the result of an arithmetic operation. fun m..
https://www.acmicpc.net/problem/25083 25083번: 새싹 아래 예제와 같이 새싹을 출력하시오. www.acmicpc.net Double quotation marks is good answer in this problem. because double qutation marks used in situation to express raw text. fun main() { println(""" ,r'"7 r`-_ ,' ,/ \. ". L_r' `~\/ | |""") }
https://www.acmicpc.net/problem/10699 10699번: 오늘 날짜 서울의 오늘 날짜를 출력하는 프로그램을 작성하시오. www.acmicpc.net I will solve alogorythme problem in 'solved.ac'. Because that website is interesting me. Rating system, problem categorization. The rating system proveded a gaming-like experience, reminiscent of playing the globally renowned game 'LOL', making solving problems feel like playing a game. Kotlin import..
https://www.acmicpc.net/problem/8393 8393번: 합 n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오. www.acmicpc.net 파이썬 더해질 수를 저장할 변수 total이 있어야 한다. 그리고 range를 통해 횟수를 정하고 그에 인자를 받아 하나하나 더해가면 된다. n = int(input()) total = 0 for i in range(n+1): total += i print(total) 코틀린 코틀린에서는 var라는 것을 통해 이 변수가 Variable이라는 것을 알려줘야 한다. 그래야 지속적으로 변수안에 다른 값들을 담을 수 있기 때문이다. 그것을 유의하고 for문을 사용하면 문제없이 해결이 가능하다. import java.util.* fun..
https://www.acmicpc.net/problem/10950 10950번: A+B - 3 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net 파이썬 range안에서 단일로 숫자를 넣게 되면 해당 횟수만큼 for문이 돌게 된다. 인자는 따로 사용하지 않으므로 _을 넣어주면 된다. 만약 for와 in 사이에 아무것도 넣지 않게 되면 오류가 나므로 유의해야 한다. n = int(input()) for _ in range(n): a, b = map(int, input().split()) println(a + b) 코틀린 파이썬과 다른 점은 i라는 인자가 꼭 들어가야 한다는 점이다. 파이썬에서는 map을 활용하였지만 코틀린에서는 이전에 사용했던 것처럼 ..
https://www.acmicpc.net/problem/2739 2739번: 구구단 N을 입력받은 뒤, 구구단 N단을 출력하는 프로그램을 작성하시오. 출력 형식에 맞춰서 출력하면 된다. www.acmicpc.net 파이썬 for문의 가장 기본적인 형태를 사용할 수 있느냐의 문제입니다. range를 사용하여 범위를 헷갈리지 않게 잘 사용하는 것이 중요합니다. n = int(input()) for i in range(1, 10): print(n, '*', i, '=', n*i) 코틀린 코틀린에서의 for문은 해당 숫자를 그대로 넣으면 된다. import java.util.* fun main() = with(Scanner(System.`in`)) { val n = nextInt() for(i in 1..9)..
https://www.acmicpc.net/problem/2525 2525번: 오븐 시계 첫째 줄에 종료되는 시각의 시와 분을 공백을 사이에 두고 출력한다. (단, 시는 0부터 23까지의 정수, 분은 0부터 59까지의 정수이다. 디지털 시계는 23시 59분에서 1분이 지나면 0시 0분이 된다.) www.acmicpc.net 파이썬 이 문제는 조건에 조건을 더하는 문제다. 첫번째로 분과 요리시간을 더했을 때 60분을 넘어갈 경우이다. 이때는 h에 특정한 시간을 더해줘야 하기 때문에 해당 조건을 해결해야만 한다. 두번째로는 '현재시간과 추가되어야 하는 시간의 합이 24시간을 넘어가느냐'의 문제다. 넘어가게 되면 24로 나누어 그 나머지만큼의 숫자가 요리가 완성되는 최종적인 h가 되기 때문이다. 첫번째의 조건..