โ 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 ์ฐ์ต์ฅ
โ 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')
'BOJ > ๐ฅ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
โ Implementation&Simulation Upper-Beginner I - 25 Solvedโ (0) | 2022.11.03 |
---|---|
โ Implementation Beginner III - 39 Solvedโ (0) | 2022.10.28 |
โ ์ ๋ฐ๋ ์ฐ์ฐ - 1๋ฌธ์ () โ (1) | 2022.10.20 |
โ BF Upper-Beginner I - 16 Solvedโ (0) | 2022.10.19 |
โ Implementation Beginner II - 50 Solvedโ (0) | 2022.10.10 |
๋๊ธ