본문 바로가기

백준1054

백준 18883 N M 찍기 https://www.acmicpc.net/problem/18883 18883번: N M 찍기 총 N개의 줄을 출력해야 한다. 각 줄에는 M개의 정수를 공백 한 칸으로 구분해 출력해야 한다. 1번 줄에는 1부터 M까지, 2번 줄에는 M+1부터 2×M까지, ..., N번 줄에는 (N-1)×M+1부터 N×M까지 출력해야 www.acmicpc.net 1 2 3 4 5 6 7 8 def sol(n, m): for row in range(n): ans = [i+m*row+1 for i in range(m)] print(*ans) if __name__ == '__main__': n, m =map(int, input().split()) sol(n,m) Colored by Color Scripter cs 2022. 12. 26.
백준 5354 J박스 https://www.acmicpc.net/problem/5354 5354번: J박스 첫째 줄에 테스트 케이스의 개수가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있고, 박스의 크기가 주어진다. 박스의 크기는 10보다 작거나 같다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import sys if __name__ == '__main__': tmp = int(sys.stdin.readline()) for _ in range(tmp): n = int(sys.stdin.readline()) if n == 1: print("#") elif n == 2: print("##") print("##") else: print("#" * n) .. 2022. 12. 26.
백준 26767 Hurra! https://www.acmicpc.net/problem/26767 26767번: Hurra! Mała Bajtynka lubi liczyć, a szczególnie uwielbia liczby 7 i 11. Mimo najlepszych starań nauczycieli, Bajtynka uroczyście celebruje, zarówno w mowie, jak i na piśmie, każdą napotkaną liczbę podzielną przez 7, zamiast jej nazwy wykrzykując (alb www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 def sol(n): for i in range(1,n+1): if i%7 == 0 an.. 2022. 12. 26.
백준 26768 H4x0r https://www.acmicpc.net/problem/26768 26768번: H4x0r Od dawna wiadomo, że hakerzy posługują się własnym językiem, różnymi skrótami i innymi formami zaciemniania, żeby zacierać ścieżki po sobie. O najlepszych z nich zwykle mawia się „h4x0rzy”. Niektórzy hakerzy czasami zamieniają niektóre www.acmicpc.net 1 2 3 4 5 6 7 8 def sol(s): table=str.maketrans('aeios', '43105') return s.translate(table) if.. 2022. 12. 26.
백준 26530 Shipping https://www.acmicpc.net/problem/26530 26530번: Shipping The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will start with a single integer x denoting how many items follow. The next x lines consist of a string, and integer, and a floating point numb www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 if __name__ == '__main__': n = int(input()) for _.. 2022. 12. 26.
백준 26566 Pizza https://www.acmicpc.net/problem/26566 26566번: Pizza There’s a pizza store which serves pizza in two sizes: either a pizza slice, with area A1 and price P1, or a circular pizza, with radius R1 and price P2. You want to maximize the amount of pizza you get per dollar. Should you pick the pizza slice or the www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 def sol(a1, p1, r1, p2): pi = 3.14159.. 2022. 12. 24.
백준 26731 Zagubiona litera https://www.acmicpc.net/problem/26731 26731번: Zagubiona litera Bajtosia pracuje w przedszkolu jako nauczycielka angielskiego. Dzisiaj na lekcji dzieci mają poznać litery alfabetu angielskiego. Bajtosia przygotowała na tę lekcję 26 specjalnych tabliczek, z których każda zawierała jedną literę alfabetu. Nieste www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 def sol(s): s = sorted(s) for i in range(len(s)).. 2022. 12. 24.
백준 26532 Acres https://www.acmicpc.net/problem/26532 26532번: Acres You have a rectangular field you want to plant with corn. You know the dimensions of the field in yards, and you know that one bag of corn seed will cover 5 acres. Having passed all your elementary math courses you also know that 4840 square yards is equal www.acmicpc.net 1 2 3 4 5 6 7 8 9 from math import ceil def sol(a, b): answer = ceil((a*b.. 2022. 12. 24.
백준 26500 Absolutely https://www.acmicpc.net/problem/26500 26500번: Absolutely The first line contains a single positive integer, n, indicating the number of data sets. Each data set is on a separate line and contains two values on the number line, separated by a single space. www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(a, b): answer = max(a,b) - min(a,b) return answer if __name__ == '__main__': n = int(input()) for _ .. 2022. 12. 24.
백준 26766 Serca https://www.acmicpc.net/problem/26766 26766번: Serca Informatycy to też ludzie, więc jak wszyscy potrzebują trochę miłości. Bajtek właśnie postanowił wyznać miłość pięknej Bajtolinie i w tym celu zamierza narysować jej N serduszek w ASCII art złożonych ze znaków małpy (@). Jedno serduszko www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 def sol(n): for _ in range(n): print(' @@@ @@@ ') print('.. 2022. 12. 24.
백준 6888 Terms of Office https://www.acmicpc.net/problem/6888 6888번: Terms of Office In CS City, a mathematical place to live, the mayor is elected every 4 years, the treasurer is appointed every 2 years, the chief programmer is elected every 3 years and the dog-catcher is replaced every 5 years. This year, Year $X$, the newly elected mayo www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 def sol(start, end): cnt = (end - start)//60.. 2022. 12. 23.
백준 26546 Reverse https://www.acmicpc.net/problem/26546 26546번: Reverse The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will be one line with a string and two integers i and j, separated by spaces. The first int, i, is the start index of the substring to be taken www.acmicpc.net 1 2 3 4 5 6 7 8 9 def sol(s, i, j): i,j = int(i), int(j) answer = s[:i].. 2022. 12. 23.