solved.ac: CLASS 2
Introduction
직사각형에서 탈출
https://www.acmicpc.net/problem/1085
import sys
input = sys . stdin . readline
x , y , w , h = map ( int , input (). split ())
print ( min ( min ( x , w - x ), min ( y , h - y )))
Hashing
https://www.acmicpc.net/problem/15829
50점
import sys
input = sys . stdin . readline
L = int ( input ())
string = input (). rstrip ( " \n " )
r = 31
m = 1234567891
H = 0
for i in range ( len ( string )):
H = H + ( ord ( string [ i ]) - 96 ) * r ** i
print ( H )
팰린드롬수
import sys
input = sys . stdin . readline
lists = []
string = input (). rstrip ( " \n " )
lists . append ( string )
while string != '0' :
string = input (). rstrip ( " \n " )
lists . append ( string )
lists = lists [: - 1 ]
result = [ '' ] * len ( lists )
for i in range ( len ( lists )):
result [ i ] = "yes"
for j in range ( 0 , len ( lists [ i ]) // 2 ):
if lists [ i ][ j ] != lists [ i ][ - j - 1 ]:
result [ i ] = "no"
break
for r in result :
print ( r )
나이순 정렬
https://www.acmicpc.net/problem/10814
나이를 입력받고 intager로 변환하지 않으면 잘못 정렬 될 수 있다.
import sys
input = sys . stdin . readline
N = int ( input ())
member = {}
age_list = []
for _ in range ( N ):
age , name = input (). split ()
if age not in member . keys ():
member [ age ] = [ name ]
age_list . append ( int ( age ))
else :
member [ age ]. append ( name )
age_list . sort ()
for a in age_list :
for m in member [ str ( a )]:
print ( "{} {}" . format ( a , m ))
나무 자르기
https://www.acmicpc.net/problem/2805
시간초과
import sys
input = sys . stdin . readline
N , M = map ( int , input (). split ())
lists = list ( map ( int , input (). split ()))
maximum = max ( lists )
result = 0
for m in range ( maximum - 1 , - 1 , - 1 ):
cut = []
for l in lists :
cut . append ( max ( l - m , 0 ))
S = sum ( cut )
if S >= M :
result = m
break
print ( result )
수 정렬하기 3
import sys
input = sys . stdin . readline
K = int ( input ())
money = []
for _ in range ( K ):
number = int ( input ())
if number != 0 :
money . append ( number )
else :
money . pop ()
if len ( money ) == 0 :
print ( 0 )
else :
print ( sum ( money ))
통계학
https://www.acmicpc.net/problem/2108
from collections import Counter
import sys
input = sys . stdin . readline
N = int ( input ())
s = 0
numbers = []
catch = {}
for _ in range ( N ):
num = int ( input ())
s += num
numbers . append ( num )
numbers . sort ()
print ( round ( s / N ))
print ( numbers [ N // 2 ])
nums = Counter ( numbers ). most_common ()
if N > 1 :
if nums [ 0 ][ 1 ] == nums [ 1 ][ 1 ]:
print ( nums [ 1 ][ 0 ])
else :
print ( nums [ 0 ][ 0 ])
else :
print ( nums [ 0 ][ 0 ])
print ( numbers [ - 1 ] - numbers [ 0 ])
설탕 배달
Please enable JavaScript to view the comments powered by Disqus.
2022
2 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
3 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
2 minute read
Introduction
less than 1 minute read
Introduction
2 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
2 minute read
Introduction
1 minute read
Introduction
4 minute read
1167 트리의 지름
4 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
3 minute read
Introduction
less than 1 minute read
Introduction
5 minute read
Introduction
3 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
3 minute read
Introduction
2 minute read
Introduction
2 minute read
Introduction
3 minute read
Introduction
less than 1 minute read
Git 명령어를 사용한 하위 디렉토리 다운로드
Clone 할 로컬 저장소 생성
1 minute read
Introduction
less than 1 minute read
# Fetch the submodule commits into the main repository
git remote add submodule_origin git://url/to/submodule/origin
git fetch submodule_origin
less than 1 minute read
Introduction
less than 1 minute read
Introduction
3 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
3 minute read
Introduction
less than 1 minute read
Introduction
4 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
2 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Spring Project
less than 1 minute read
the page for java
3 minute read
가벼운 Base image를 사용
less than 1 minute read
version: 3.0.0a10
less than 1 minute read
WIDTH
less than 1 minute read
version: 3.0.0a10
less than 1 minute read
#include <iostream>
#include <thread>
#include <chrono>
#include <mutex>
#include <atomic>
#include <string.h>
1 minute read
version: 3.0.0a10
less than 1 minute read
https://cplusplus.com/reference/future/
less than 1 minute read
Multithreading support was introduced in C++11.
less than 1 minute read
how to costom github blog using jekyll
less than 1 minute read
You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different wa...
Back to top ↑