BOJ/๐Ÿฅ‰

โ˜…Basics III - 40 Solvedโ˜…

metamong 2022. 10. 21.

โ˜… 24075 ่จˆ็ฎ— (Calculation) โ˜…

 

A,B=map(int,input().split())
print(max(A+B,A-B),min(A+B,A-B),sep='\n')

โ˜… 17356 ์šฑ ์ œ โ˜…

 

A,B=map(int,input().split())

M = (B-A)/400

print(1/(1+10**M))

 

๐Ÿธ ** ๊ฑฐ๋“ญ์ œ๊ณฑ์œผ๋กœ ~์Šน ์—ฐ์‚ฐ์ž ์ด์šฉํ•˜๋ฉด ๋จ


โ˜… 20232 Archivist โ˜…

 

winners = {}
winners.update(winners.fromkeys([1995,1998,1999,2001,2002,2003,2004,2005,2009,2010,2011,2012,2014,2015,2016,2017,2019],'ITMO'))
winners.update(winners.fromkeys([1996,1997,2000,2007,2008,2013,2018],'SPbSU'))
winners.update(winners.fromkeys([2006],'PetrSU, ITMO'))
print(winners[int(input())])

 

๐Ÿธ ์—ฐ๋„์— ๋งž๋Š” ์ˆ˜์ƒ์ž๋ฅผ ์ €์žฅํ•˜๋Š” ์ž๋ฃŒ๊ตฌ์กฐ → dictionary ์ž๋ฃŒ๊ตฌ์กฐ ์‚ฌ์šฉ

 

๐Ÿธ dictionary์— multiple keys์— ๋™์ผํ•œ value๋ฅผ ์‚ฝ์ž…ํ•  ๋•Œ ์“ฐ๋Š”, fromkeys() method๋ฅผ ํ™œ์šฉํ•ด, ์ˆ˜์ƒ์ž dictionary๋ฅผ ์ƒ์„ฑ


โ˜… 3765 Celebrity jeopardy โ˜…

 

while 1:
    try:
        print(input())
    except:
        break

 

๐Ÿธ ๊ทธ๋Œ€๋กœ ์ถœ๋ ฅํ•˜๊ณ , EOFerror ๋ฐœ์ƒ ์‹œ break๋ฌธ์œผ๋กœ ํƒˆ์ถœ!


โ˜… 15372 A Simple Problem. โ˜…

 

import sys
input = sys.stdin.readline
for _ in range(int(input())):
    print(int(input())**2)

 

๐Ÿธ ์ตœ์†Œ ์ž์—ฐ์ˆ˜๋Š” ๊ทธ๋Œ€๋กœ ์ œ๊ณฑ์„ ํ•œ ๊ฒฐ๊ณผ ์ž์ฒด๊ฐ€ ์ตœ์†Œ ์ž์—ฐ์ˆ˜!


โ˜… 2588 ๊ณฑ์…ˆ โ˜…

 

a=int(input())
b=input()
print(a*int(b[2]),a*int(b[1]),a*int(b[0]),a*int(b),sep='\n')

 

๐Ÿธ intํ˜•๊ณผ strํ˜• ๋‘ ํƒ€์ž…์„ ์•Œ๋งž๊ฒŒ ๊ตฌ๋ถ„ํ•˜๋ฉด์„œ ์ถœ๋ ฅํ•ด์ฃผ๋ฉด ๋!


โ˜… 10599 ํŽ˜๋ฅด์‹œ์•„์˜ ์™•๋“ค โ˜…

 

while 1:
    a,b,c,d=map(int,input().split())

    if (a,b,c,d) == (0,0,0,0):
        break

    print(c-b,d-a)

 

๐Ÿธ print() ํ•œ ๊ฐœ์— ,๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์“ด๋‹ค๋ฉด, sep=' '๊ฐ€ ๋””ํดํŠธ์ด๋‹ค. ํ•œ ์ค„ ๋ˆ ์ฑ„๋กœ ์ถœ๋ ฅ๋จ


โ˜… 15781 ํ—ฌ๋งท๊ณผ ์กฐ๋ผ โ˜…

 

input()
print(max(map(int,input().split()))+max(map(int,input().split())))

โ˜… 26307 Correct โ˜…

 

a,b=map(int,input().split())
print((a-9)*60+b)

โ˜… 26545 Mathematics โ˜…

 

N=int(input())
print(sum([int(input())for _ in range(N)]))

โ˜… 10817 ์„ธ ์ˆ˜ โ˜…

 

a,b,c = map(int, input().split())
print(max(a,b) if c>=max(a,b) else c if c>=min(a,b) else min(a,b))

 

๐Ÿฅ• sorted(), sort() ๋‚ด์žฅํ•จ์ˆ˜๋กœ ์ถฉ๋ถ„ํžˆ ํ’€ ์ˆ˜ ์žˆ์ง€๋งŒ, max()์™€ min()๋งŒ ์“ฐ๊ณ  ํ•œ ๋ฒˆ ํ’€์–ด๋ณด์•˜๋‹ค.

 

๐Ÿฅ• if - elif - else๋ฌธ์„ ํ•œ ์ค„์˜ if๋ฌธ์œผ๋กœ ์ž‘์„ฑํ•ด๋ณด์•˜๋‹ค.
→ c๊ฐ€ max(a,b)๋ณด๋‹ค ํด ๊ฒฝ์šฐ(1), ๊ทธ๊ฒŒ ์•„๋‹ˆ๊ณ  c๊ฐ€ min(a,b)๋ณด๋‹ค๋Š” ํด ๊ฒฝ์šฐ(2), ๊ทธ๊ฒŒ ์•„๋‹ˆ๋ฉด c๊ฐ€ min(a,b)๋ณด๋‹ค๋„ ์ž‘์„ ๊ฒฝ์šฐ(3) ์ด๋ ‡๊ฒŒ ์„ธ ๊ฐ€์ง€์˜ ์ƒํ™ฉ์œผ๋กœ ๋‚˜๋ˆˆ if๋ฌธ


โ˜… 2562 ์ตœ๋Œ“๊ฐ’ โ˜…

 

lst = []

for _ in range(9):
    lst.append(int(input()))

print(max(lst))
print(lst.index(max(lst))+1)

 

๐Ÿฅ• list comprehension์„ ํ†ตํ•ด for๋ฌธ์„ []์•ˆ์— ๋„ฃ์–ด ํ•œ ์ค„๋กœ ๋ฐ”๋กœ list์— ์ง‘์–ด๋„ฃ์„ ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋ฒ• ์กด์žฌ

 

lst = [int(input()) for _ in range(9)]

 

๐Ÿฅ• list์˜ index method - ์ฒซ๋ฒˆ์งธ๋กœ ๋“ฑ์žฅํ•˜๋Š”, ํ•ด๋‹น ์ตœ๋Œ“๊ฐ’์ด list์˜ ์–ด๋””์— ์œ„์น˜ํ•ด ์žˆ๋Š” ์ง€ index๋ฅผ ๋ฐ˜ํ™˜ํ•ด ์คŒ
(ํ•ด๋‹น ๋ฌธ์ œ๋Š” 9๊ฐœ์˜ '์„œ๋กœ ๋‹ค๋ฅธ' ์ž์—ฐ์ˆ˜์ด๋ฏ€๋กœ ์ค‘๋ณต ๊ฑฑ์ •์ด ํ•„์š” ์—†๋Š”๋ฐ, ์ค‘๋ณต์ด ์žˆ์„ ๊ฒฝ์šฐ๋Š” numpy ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, ๋”ฐ๋กœ list comprehension์œผ๋กœ for๋ฌธ์„ ํ•œ ๋ฒˆ ๋” ๋Œ์•„์ฃผ๋Š” ์†”๋ฃจ์…˜์ด ์žˆ๋‹ค. ์ถ”ํ›„ ๋ฌธ์ œ์— ๋‚˜์˜ค๋ฏ€๋กœ ๊ทธ ๋•Œ ์ž์„ธํžˆ ๋ณด์ž!)


โ˜… 11948 ๊ณผ๋ชฉ์„ ํƒ โ˜…

 

scores = [int(input()) for _ in range(6)]
print(sum(sorted(scores[:4])[1:])+max(scores[4], scores[5]))

โ˜… 10818 ์ตœ์†Œ,์ตœ๋Œ€ โ˜…

 

N = int(input())
lst = list(map(int,input().split()))
print(min(lst), max(lst))

โ˜… 15474 ้‰›็ญ† (Pencils) โ˜…

 

import math

N,A,B,C,D=map(int,input().split())
print(min(math.ceil(N/A)*B,math.ceil(N/C)*D))

 

๐Ÿฅ• A๊ฐœ๋ฅผ ์—ฌ๋Ÿฌ ๊ฐœ ์‚ด ๋•Œ, C๊ฐœ๋ฅผ ์—ฌ๋Ÿฌ ๊ฐœ ์‚ด ๋•Œ ์–ด๋–ค ๊ฑธ ์—ฌ๋Ÿฌ ๊ฐœ ์‚ด ๋•Œ ์ตœ์†Œ N๊ฐœ ์ด์ƒ์˜ ๊ฐœ์ˆ˜๋ฅผ ๊ตฌ๋งคํ–ˆ์„ ๋•Œ์˜ ๊ฐ€๊ฒฉ ์ตœ์†Ÿ๊ฐ’์ด ๋˜๋Š” ์ง€ ๋ฌป๋Š” ๋ฌธ์ œ

→ ceil() ์˜ฌ๋ฆผํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•ด ์ตœ์†Ÿ๊ฐ’์€ min() ํ•จ์ˆ˜ ์‚ฌ์šฉ!


โ˜… 13866 ํŒ€ ๋‚˜๋ˆ„๊ธฐ โ˜…

 

l = sorted(map(int,input().split()))
print(abs(l[0]+l[3]-l[1]-l[2]))

 

๐Ÿฅ• ๋‘ ํŒ€์˜ ์ฐจ์ด๊ฐ€ ์ตœ์†Œ์ผ๋ ค๋ฉด ๋„ค ๊ฐœ์˜ ์Šคํ‚ฌ์„ ์ •๋ ฌํ–ˆ์„ ๋•Œ, ์ตœ์†Œ์™€ ์ตœ๋Œ€๊ฐ€ ํ•œ ํŒ€, ๊ทธ ์‚ฌ์ด ๋‘ ์Šคํ‚ฌ ์ ์ˆ˜๊ฐ€ ํ•œ ํŒ€์œผ๋กœ ์„ธ์›Œ์ค˜์•ผ ์ฐจ์ด๊ฐ€ ์ตœ์†Œ๊ฐ€ ๋จ


โ˜… 22015 ้‡‘ๅนณ็ณ– (Konpeito) โ˜…

 

A,B,C=map(int,input().split())
m = max(A,B,C)
print(3*m-(A+B+C))

 

๐Ÿฅ• ์ตœ๋Œ“๊ฐ’์—์„œ ๊ฐ๊ฐ์˜ ์›์†Œ๋ฅผ ๋บ€ ๊ฒฐ๊ณผ๋ฅผ ๋ชจ๋‘ ํ•ฉํ•œ ๊ฒŒ ์ •๋‹ต์ด๋‹ค.


โ˜… 25377 ๋นต โ˜…

 

ans = 1001
for _ in range(int(input())):
    a,b=map(int,input().split())

    if a <= b:
        ans = min(ans,b)

print(ans) if ans <= 1000 else print(-1)

 

๐Ÿฅ• KOI ๋นต์„ ์‚ฌ๋Š” ์กฐ๊ฑด ํ•˜ ์ตœ์†Œ๊ฐ’์„ ๊ณ„์† ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐฉ์‹! ์ด ๋•Œ ์ตœ์†Ÿ๊ฐ’ ์ดˆ๊ธฐํ™”์— ์ฃผ์˜๋งŒ ํ•˜๋ฉด ๋จ


โ˜… 2953 ๋‚˜๋Š” ์š”๋ฆฌ์‚ฌ๋‹ค โ˜…

 

t=[sum(map(int,input().split()))for i in range(5)]
i=max(t)
print(t.index(i)+1,i)

โ˜… 20053 ์ตœ์†Œ, ์ตœ๋Œ€ 2 โ˜…

 

for _ in range(int(input())):
    input()
    l=list(map(int,input().split()))
    print(min(l),max(l))

โ˜… 6840 Who is in the middle? โ˜…

 

print(sorted([int(input())for _ in range(3)])[1])

โ˜… 26574 Copier โ˜…

 

for _ in range(int(input())):
    N=int(input())
    print(N,N,sep=' ')

โ˜… 10189 Hook โ˜…

 

print('''#  # #### #### #  #
#### #  # #  # # #
#### #  # #  # # #
#  # #### #### #  #''')

โ˜… 26711 A+B โ˜…

 

a=int(input())
b=int(input())
print(a+b)

โ˜… 26766 Serca โ˜…

 

a=''' @@@   @@@ 
@   @ @   @
@    @    @
@         @
 @       @ 
  @     @  
   @   @   
    @ @    
     @     
'''
print(a*int(input()))

โ˜… 2372 Livestock Count โ˜…

 

with Ada.Text_IO;

procedure Hello is
begin
  Ada.Text_IO.Put_Line("Animal      Count");
  Ada.Text_IO.Put_Line("-----------------");
  Ada.Text_IO.Put_Line("Chickens      100");
  Ada.Text_IO.Put_Line("Clydesdales     5");
  Ada.Text_IO.Put_Line("Cows           40");
  Ada.Text_IO.Put_Line("Goats          22");
  Ada.Text_IO.Put_Line("Steers          2");
end Hello;

 

๐Ÿฅ• ada ์–ธ์–ด๋Š” ํ”„๋ฆฐํŠธํ•  ๋•Œ ์œ„์™€ ๊ฐ™์€ ์ฝ”๋“œ ๊ด€๋ก€๋ฅผ ๋”ฐ๋ฅธ๋‹ค๊ณ  ํ•จ... ์˜›๋‚  ์–ธ์–ด๋ผ๊ณ  ํ•จ...


โ˜… 2377 Pottery โ˜…

 

Print " _________"
Print " \_     _/"
Print "   \   /"
Print "    | |"
Print "   /   \"
Print "  /     \"
Print " |       |"
Print "/---------\"
Print "| \-/ \-/ |"
Print "\---------/"
Print " \_______/"

 

๐Ÿฅ• freebasic ์–ธ์–ด๋Š” ๋‹จ์ˆœํžˆ Print" "๋กœ ๊ฐ€๋Šฅํ•˜๋‹ค!


โ˜… 14337  Helicopter โ˜…

 

Imports System

Module Program
    Sub Main(args As String())
        Console.WriteLine("      ===================")
        Console.WriteLine("          ____||___")
        Console.WriteLine("\ /      /       []\")
        Console.WriteLine(" X=======           \__")
        Console.WriteLine("/ \      \____________|")
        Console.WriteLine("            ||  ||")
        Console.WriteLine("         \-----------/")
    End Sub
End Module

 

๐Ÿฅ• VB๋Š” c#๊ณผ ๋™์ผํ•˜๊ฒŒ Console.WriteLine()์œผ๋กœ print ๊ฐ€๋Šฅํ•˜๋‹ค๊ณ  ํ•œ๋‹ค


โ˜… 1809 Moo โ˜…

 

'(___)
(o o)____/
 @@      \
  \ ____,/
  //   //
 ^^   ^^'

 

๐Ÿฅ• short-coding์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ golfscript๋Š” printํ•  ๋•Œ ๋‹จ์ˆœํžˆ ' ' ์‚ฌ์ด์— ์ถœ๋ ฅํ•  ๊ทธ๋ฆผ์„ ๋„ฃ์œผ๋ฉด ๋œ๋‹ค.

 

๐Ÿฅ• golfscript ์—ฐ์Šต์žฅ

 

GolfScript - Riju

 

riju.codes


โ˜… 11023 ๋”ํ•˜๊ธฐ 3 โ˜…

 

print(sum(list(map(int,input().split()))))

โ˜… 11024 ๋”ํ•˜๊ธฐ 4 โ˜…

 

for _ in range(int(input())):print(sum(map(int,input().split())))

โ˜… 27331 2 ๆกใฎๆ•ดๆ•ฐ (Two-digit Integer) โ˜…

 

print(input()+input())

โ˜… 11719 ๊ทธ๋Œ€๋กœ ์ถœ๋ ฅํ•˜๊ธฐ 2 โ˜…

 

while True:
    try:
        print(input())
    except EOFError:
        break

โ˜… 27389 Metronome โ˜…

 

print(float(input())/4)

โ˜… 27327 ๆ™‚้–“ (Hour) โ˜…

 

print(24*int(input()))

โ˜… 6916 0123456789 โ˜…

 

n0=""" * * *
*     *
*     *
*     *

*     *
*     *
*     *
 * * *"""

n1="""
      *
      *
      *

      *
      *
      *
"""

n2=""" * * *
      *
      *
      *
 * * *
*
*
*
 * * * """

n3=""" * * *
      *
      *
      *
 * * *
      *
      *
      *
 * * *"""

n4="""
*     *
*     *
*     *
 * * *
      *
      *
      *
"""

n5=""" * * *
*
*
*
 * * *
      *
      *
      *
 * * *"""

n6=""" * * *
*
*
*
 * * *
*     *
*     *
*     *
 * * *"""

n7=""" * * *
      *
      *
      *

      *
      *
      *
"""

n8=""" * * *
*     *
*     *
*     *
 * * *
*     *
*     *
*     *
 * * *"""

n9=""" * * *
*     *
*     *
*     *
 * * *
      *
      *
      *
 * * *"""

print([n0,n1,n2,n3,n4,n5,n6,n7,n8,n9][int(input())])
print()

โ˜… 2393 Rook โ˜…

 

       IDENTIFICATION DIVISION.
       PROGRAM-ID. HELLOWRD.

       PROCEDURE DIVISION.
       DISPLAY "  ___  ___  ___".
       DISPLAY "  | |__| |__| |".
       DISPLAY "  |           |".
       DISPLAY "   \_________/".
       DISPLAY "    \_______/".
       DISPLAY "     |     |".
       DISPLAY "     |     |".
       DISPLAY "     |     |".
       DISPLAY "     |     |".
       DISPLAY "     |_____|".
       DISPLAY "  __/       \__".
       DISPLAY " /             \".
       DISPLAY "/_______________\".
       STOP RUN.

โ˜… 26495 Big Number โ˜…

 

n0="""0000
0  0
0  0
0  0
0000"""

n1="""   1
   1
   1
   1
   1"""

n2="""2222
   2
2222
2
2222"""

n3="""3333
   3
3333
   3
3333"""

n4="""4  4
4  4
4444
   4
   4"""

n5="""5555
5
5555
   5
5555"""

n6="""6666
6
6666
6  6
6666"""

n7="""7777
   7
   7
   7
   7"""

n8="""8888
8  8
8888
8  8
8888"""

n9="""9999
9  9
9999
   9
   9"""

l=[n0,n1,n2,n3,n4,n5,n6,n7,n8,n9]
s=input()

for i in s:
    print(l[int(i)])
    print()

โ˜… 27889 ํŠน๋ณ„ํ•œ ํ•™๊ต ์ด๋ฆ„ โ˜…

 

d={
    "NLCS":'North London Collegiate School',
    "BHA": 'Branksome Hall Asia',
    "KIS": "Korea International School",
    "SJA": "St. Johnsbury Academy"
}

print(d[input()])

โ˜… 28235 ์ฝ”๋“œ๋งˆ์Šคํ„ฐ 2023 โ˜…

 

x=input()
print('HIGHSCHOOL' if x=='SONGDO' else 'MASTER' if x=='CODE' else '0611' if x=='2023' else 'CONTEST')

 

 

 

 

 

 

 

 

 

 

 

๋Œ“๊ธ€