본문 바로가기

분류 전체보기1523

[백준] 11382 1 2 import sys print(sum(list(map(int, sys.stdin.readline().split())))) cs a,b,c로 받아서 합을 출력해도 되지만 그냥 리스트로 전체를 받아서 python 내장 함수의 sum 기능을 활용했습니다 2020. 12. 15.
[백준] 10926 1 print(input()+"??!") cs 저는 주로 입력을 받을때 sys.stdin.readline() 을 주로 쓰지만 이 함수는 '\n' 까지 같이 받아서 input()으로 받아서 출력했습니다. 2020. 12. 15.
[백준] 10869 1 2 3 4 5 6 7 import sys a,b=map(int, sys.stdin.readline().split()) print(a+b) print(a-b) print(a*b) print(a//b) print(a%b) Colored by Color Scripter cs 크게 어렵진 않습니다만 몫을 구할때 python에서 / 기호를 쓰면 앞 뒤 인자들을 float 형으로 인식해서 원하는 값이 안나옵니다. 따라서 Line 6 처럼 //을 써야됩니다. 혹은 int(a/b)를 써야합니다. 그리고 int(a/b)를 쓴다면 input a,b가 둘다 양수라서 문제가 없지만 음수일 경우는 음수의 나눗셈에 대해서 다시 한 번 리마인드 하시고 풀으셔야 합니다! 2020. 12. 15.
[백준] 10757 1 2 3 import sys a,b=map(int,sys.stdin.readline().split()) print(a+b) Colored by Color Scripter cs python은 그냥 하면 될낀데, C같은 언어는 아마 선언을 long long int 이런식으로 해야겠죠,,? 2020. 12. 14.
[백준] 10699 1 print("2020-12-14") cs 힌트에 채점 서버의 시간대가 UTC+0 이라고 나와있습니다. date함수를 쓰려했지만 귀찮은 관계로.. 2020. 12. 14.
[백준] 10171 1 2 3 4 print("\ /\\") print(" ) ( ')") print("( / )") print(" \(__)|") cs 고양이 vs 강아지 저는 고양이! 2020. 12. 14.
[백준] 8393 1 2 3 import sys n=int(sys.stdin.readline()) print (int ( (1+n)*n/2)) cs 사실 n을 입력받고 반복문을 통해 더해줘도 되지만, 그럴경우에는 주어진 n이 최대가 1만이라 문제가 없겠지만 엄청 큰 수로 가게 되면 메모리의 load가 심해질것같아서 등차수열 합 으로 뚝딱! 2020. 12. 14.
[백준] 5554 1 2 3 4 5 6 import sys ans=0 for _ in range(4): ans+=int(sys.stdin.readline()) print(ans//60) print(ans%60) cs 초 단위니까 분, 초로 나눠서 출력하면 됩니다~ 2020. 12. 14.
[백준] 5338 1 2 3 4 5 print(" _.-;;-._") print ("'-..-'| || |") print("'-..-'|_.-;;-._|") print ("'-..-'| || |") print ("'-..-'|_.-''-._|") cs 2020. 12. 14.
[백준] 5337 1 2 3 print(". . .") print("| | _ | _. _ ._ _ _") print ("|/\|(/.|(_.(_)[ | )(/.") cs 이 문제는 주의 할 부분이 없지만 종종 "(quotation mark) 과 같은 문자는 출력할때 주의 해주셔야 합니다 2020. 12. 14.
[백준] 3046 1 2 R1, S=map(int, input().split()) print(S*2-R1) cs 2020. 12. 14.
[백준] 3003 1 2 3 4 5 6 tmp=[1,1,2,2,2,8] ans=list(map(int,input().split())) for i in range(6): if i!=5: print(tmp[i]-ans[i],end=" ") else : print(tmp[i]-ans[i]) cs 2020. 12. 14.