├── BOJ ├── 13000 ~ 13999 │ ├── 13311_행운의 편지.swift │ ├── 13297_Quick Estimates.swift │ ├── 13866_팀 나누기.swift │ ├── 13909_창문 닫기.swift │ ├── 13163_닉네임에 갓 붙이기.swift │ ├── 13484_Tarifa.swift │ ├── 13597_Tri-du.swift │ ├── 13235_팰린드롬.swift │ ├── 13985_Equality.swift │ ├── 13580_Andando no tempo.swift │ ├── 13129_Disposable Cup.swift │ ├── 13877_이건 무슨 진법이지?.swift │ ├── 13752_히스토그램.swift │ ├── 13771_Presents.swift │ ├── 13416_주식 투자.swift │ └── 13610_Volta.swift ├── 11000 ~ 11999 │ ├── 11942_고려대는 사랑입니다.swift │ ├── 11282_한글.swift │ ├── 11718_그대로 출력하기.swift │ ├── 11023_더하기 3.swift │ ├── 11283_한글.swift │ ├── 11654_아스키 코드.swift │ ├── 11719_그대로 출력하기 2.swift │ ├── 11908_카드.swift │ ├── 11382_꼬마 정민.swift │ ├── 11179_2진수 뒤집기.swift │ ├── 11024_더하기 4.swift │ ├── 11720_숫자의 합.swift │ ├── 11104_Fridge of Your Dreams.swift │ ├── 11121_Communication Channels.swift │ ├── 11365_!밀비 급일.swift │ ├── 11312_삼각 무늬 - 2.swift │ ├── 11320_삼각 무늬 - 1.swift │ ├── 11648_지속.swift │ ├── 11931_수 정렬하기.swift │ ├── 11006_남욱이의 닭장.swift │ ├── 11301_타일 장식물.swift │ ├── 11549_Identifying tea.swift │ ├── 11021_A+B - 7.swift │ ├── 11721_열 개씩 끊어 출력하기.swift │ ├── 11022_A+B - 8.swift │ ├── 11726_2×n 타일링.swift │ ├── 11899_괄호 끼워넣기.swift │ └── 11953_파일 옮기기.swift ├── 27000 ~ 27999 │ ├── 27465_소수가 아닌 수.swift │ ├── 27323_직사각형.swift │ ├── 27389_Metronome.swift │ ├── 27433_팩토리얼 2.swift │ ├── 27324_ゾロ目 (Same Numbers).swift │ ├── 27331_2 桁の整数 (Two-digit Integer).swift │ ├── 27332_11 月 (November).swift │ ├── 27866_문자와 문자열.swift │ ├── 27106_Making Change.swift │ ├── 27959_초코바.swift │ ├── 26082_WARBOY.swift │ ├── 27219_Робинзон Крузо.swift │ ├── 27327_時間 (Hour).swift │ ├── 27541_末尾の文字 (Last Letter).swift │ ├── 27961_고양이는 많을수록 좋다.swift │ ├── 27262_Лифт.swift │ ├── 27328_三方比較 (Three-Way Comparison).swift │ ├── 27110_특식 배부.swift │ ├── 27294_몇개고?.swift │ ├── 27267_Сравнение комнат.swift │ ├── 27890_특별한 작은 분수.swift │ ├── 27889_특별한 학교 이름.swift │ └── 27918_탁구 경기.swift ├── 7000 ~ 7999 │ ├── 7287_등록.swift │ ├── 7567_그릇.swift │ ├── 7891_Can you add this?.swift │ ├── 7572_간지(干支).swift │ └── 7523_Gauß.swift ├── 21000 ~ 21999 │ ├── 21553_암호 만들기.swift │ ├── 21598_SciComLove.swift │ ├── 21964_선린인터넷고등학교 교가.swift │ ├── 21335_Another Eruption.swift │ ├── 21867_Java Bitecode.swift │ ├── 21734_SMUPC의 등장.swift │ ├── 21300_Bottle Return.swift │ ├── 21185_Some Sum.swift │ ├── 21612_Boiling Water.swift │ ├── 21212_Cakes.swift │ ├── 21633_Bank Transfer.swift │ └── 21657_숫자의 개수 2.swift ├── 24000 ~ 24999 │ ├── 24078_余り (Remainder).swift │ ├── 24082_立方体 (Cube).swift │ ├── 24262_알고리즘 수업 - 알고리즘의 수행 시간 1.swift │ ├── 24263_알고리즘 수업 - 알고리즘의 수행 시간 2.swift │ ├── 24264_알고리즘 수업 - 알고리즘의 수행 시간 3.swift │ ├── 24266_알고리즘 수업 - 알고리즘의 수행 시간 5.swift │ ├── 24751_Betting.swift │ ├── 24265_알고리즘 수업 - 알고리즘의 수행 시간 4.swift │ ├── 24623_Изгороди.swift │ ├── 24086_身長 (Height).swift │ ├── 24267_알고리즘 수업 - 알고리즘의 수행 시간 6.swift │ ├── 24568_Cupcake Party.swift │ ├── 24083_短針 (Hour Hand).swift │ ├── 24365_ПЧЕЛИЧКАТА МАЯ.swift │ ├── 24416_알고리즘 수업 - 피보나치 수 1.swift │ ├── 24072_帰省 (Homecoming).swift │ ├── 24294_ГРАДИНА.swift │ ├── 24075_計算 (Calculation).swift │ ├── 24389_2의 보수.swift │ ├── 24079_移動 (Moving).swift │ ├── 24723_녹색거탑.swift │ ├── 24387_ИЗЛОЖЕНИЕ НА ПЧЕЛЕН МЕД.swift │ ├── 24356_ЧАСОВНИК.swift │ ├── 24313_알고리즘 수업 - 점근적 표기 1.swift │ └── 24084_次の文字 (Next Character).swift ├── 30000 ~ 30999 │ ├── 30328_Java Warriors.swift │ ├── 30030_스위트콘 가격 구하기.swift │ ├── 30821_별자리가 될 수 있다면 .swift │ ├── 30018_타슈.swift │ ├── 30017_치즈버거 만들기.swift │ ├── 30310_Finding Forks.swift │ ├── 30224_Lucky 7.swift │ ├── 30501_관공... 어찌하여 목만 오셨소....swift │ ├── 30958_서울사이버대학을 다니고.swift │ ├── 30468_호반우가 학교에 지각한 이유 1.swift │ ├── 30792_gahui and sousenkyo 2.swift │ ├── 30822_UOSPC 세기.swift │ └── 30999_민주주의.swift ├── 10000 ~ 10999 │ ├── 10926_??!.swift │ ├── 10821_정수의 개수.swift │ ├── 10718_We love krii.swift │ ├── 10189_Hook.swift │ ├── 10988_팰린드롬인지 확인하기.swift │ ├── 10822_더하기.swift │ ├── 10817_세 수.swift │ ├── 10171_고양이.swift │ ├── 10172_개.swift │ ├── 10824_네 수.swift │ ├── 10952_A+B - 4.swift │ ├── 10173_니모를 찾아서.swift │ ├── 10823_더하기 2.swift │ ├── 10569_다면체.swift │ ├── 10935_A + B - 6.swift │ ├── 10998_AXB.swift │ ├── 10833_사과.swift │ ├── 10874_이교수님의 시험.swift │ ├── 10870_피보나치 수 5.swift │ ├── 10872 팩토리얼.swift │ ├── 10987_모음의 개수.swift │ ├── 10797_10부제.swift │ ├── 10950_A + B - 3.swift │ ├── 10174_팰린드롬.swift │ ├── 10178_할로윈의 사탕.swift │ ├── 10808_알파벳 개수.swift │ ├── 10643_FUNGHI.swift │ ├── 10867_중복 빼고 정렬하기.swift │ ├── 10474_분수좋아해?.swift │ ├── 10480_Oddities.swift │ ├── 10991_별 찍기 - 16.swift │ ├── 10773_제로.swift │ ├── 10886_0 = not cute : 1 = cute.swift │ └── 10869_사칙연산.swift ├── 23000 ~ 23999 │ ├── 23234_The World Responds.swift │ ├── 23530_Not A + B.swift │ ├── 23825_SASA 모형을 만들어보자.swift │ ├── 23802_골뱅이 찍기 - 뒤집힌 ㄱ.swift │ ├── 23235_The Fastest Sorting Algorithm In The World.swift │ ├── 23795_사장님 도박은 재미로 하셔야 합니다.swift │ ├── 23803_골뱅이 찍기 - ㄴ.swift │ ├── 23037_5의 수난.swift │ ├── 23080_스키테일 암호.swift │ ├── 23343_JavaScript.swift │ ├── 23375_Arm Coordination.swift │ └── 23303_이 문제는 D2 입니다.swift ├── 8000 ~ 8999 │ ├── 8545_Zadanie próbne.swift │ ├── 8871_Zadanie próbne 2.swift │ ├── 8741_이진수 합.swift │ ├── 8370_Plane.swift │ ├── 8393_합.swift │ ├── 8714_Monety.swift │ ├── 8674_Tabliczka.swift │ ├── 8760_Schronisko.swift │ ├── 8558_Silnia.swift │ ├── 8387_Dyslexia.swift │ ├── 8710_Koszykarz.swift │ └── 8815_Test.swift ├── 2000 ~ 2999 │ ├── 2557_Hello World.swift │ ├── 2921_도미노.swift │ ├── 2741_N 찍기.swift │ ├── 2558_A+B - 2.swift │ ├── 2742_찍기 N.swift │ ├── 2903_중앙 이동 알고리즘.swift │ ├── 2739_구구단.swift │ ├── 2420_사파리월드.swift │ ├── 2914_저작권.swift │ ├── 2355_시그마.swift │ ├── 2052_지수연산.swift │ ├── 2010_플러그.swift │ ├── 2163_초콜릿 자르기.swift │ ├── 2438_별 찍기 - 1.swift │ ├── 2440_별 찍기 - 3.swift │ ├── 2562_최댓값.swift │ ├── 2959_거북이.swift │ ├── 2587_대표값2.swift │ ├── 2750_수 정렬하기.swift │ ├── 2751_수 정렬하기 2.swift │ ├── 2588_곱셈.swift │ ├── 2902_KMP는 왜 KMP일까?.swift │ ├── 2292_벌집.swift │ ├── 2745_진법 변환.swift │ ├── 2752_세수정렬.swift │ ├── 2908_상수.swift │ ├── 2963_N번째 큰 수.swift │ ├── 2475_검증수.swift │ ├── 2747_피보나치 수.swift │ ├── 2748_피보나치 수 2.swift │ ├── 2869_달팽이는 올라가고 싶다.swift │ ├── 2753_윤년.swift │ ├── 2193_이친수.swift │ ├── 2441_별 찍기 - 4.swift │ ├── 2965_캥거루 세마리.swift │ ├── 2204_도비의 난독증 테스트.swift │ ├── 2399_거리의 합.swift │ ├── 2442_별 찍기 - 5.swift │ ├── 2443_별 찍기 - 6.swift │ ├── 2749_피보나치 수 3.swift │ ├── 2231_분해합.swift │ ├── 2439_별 찍기 - 2.swift │ ├── 2920_음계.swift │ └── 2721_삼각수의 합.swift ├── 25000 ~ 25999 │ ├── 25311_UCPC에서 가장 쉬운 문제 번호는?.swift │ ├── 25176_청정수열 (Easy).swift │ ├── 25628_햄버거 만들기.swift │ ├── 25277_Culture shock.swift │ ├── 25083_새싹.swift │ ├── 25238_가희와 방어율 무시.swift │ ├── 25314_코딩은 체육과목 입니다.swift │ ├── 25175_두~~부 두부 두부.swift │ ├── 25640_MBTI.swift │ ├── 25205_경로당펑크 2077.swift │ ├── 25305_커트라인.swift │ ├── 25191_치킨댄스를 추는 곰곰이를 본 임스.swift │ ├── 25756_방어율 무시 계산하기.swift │ ├── 25828_Corona Virus Testing.swift │ ├── 25372_성택이의 은밀한 비밀번호.swift │ ├── 26500_Absolutely.swift │ └── 25784_Easy-to-Solve Expressions.swift ├── 31000 ~ 31999 │ ├── 31611_ 火曜日 (Tuesday).swift │ ├── 31606_果物 (Fruit).swift │ ├── 31614_分 (Minutes).swift │ ├── 31615_桁 (Digit).swift │ ├── 31610_飴の袋詰め (Drops Packing).swift │ ├── 31746_SciComLove (2024).swift │ ├── 31472_갈래의 색종이 자르기.swift │ ├── 31048_Last Factorial Digit.swift │ ├── 31926_밤양갱.swift │ ├── 31668_특별한 가지.swift │ ├── 31261_НАМИСЛИХ СИ ЧИСЛО.swift │ ├── 31403_A + B - C.swift │ ├── 31429_SUAPC 2023 Summer.swift │ ├── 31833_온데간데없을뿐더러.swift │ ├── 31922_이 대회는 이제 제 겁니다.swift │ ├── 31450_Everyone is a winner.swift │ ├── 31418_엘리스 트랙 매칭.swift │ ├── 31654_Adding Trouble.swift │ ├── 31822_재수강.swift │ ├── 31656_Sticky Keys.swift │ ├── 31821_학식 사주기.swift │ ├── 31090_2023은 무엇이 특별할까?.swift │ └── 31867_홀짝홀짝.swift ├── 9000 ~ 9999 │ ├── 9659_돌 게임 5.swift │ ├── 9660_돌 게임 6.swift │ ├── 9316_Hello Judge.swift │ ├── 9655_돌 게임.swift │ ├── 9656_돌 게임2.swift │ ├── 9295_주사위.swift │ ├── 9306_Practice- Roll Call.swift │ ├── 9699_RICE SACK.swift │ ├── 9838_XMAS.swift │ ├── 9085_더하기.swift │ ├── 9243_파일 완전 삭제.swift │ ├── 9093_단어 뒤집기.swift │ ├── 9237_이장님 초대.swift │ └── 9469_폰 노이만.swift ├── 14000 ~ 14999 │ ├── 14491_9진수.swift │ ├── 14264_정육각형과 삼각형.swift │ ├── 14065_Gorivo.swift │ ├── 14581_팬들에게 둘러싸인 홍준.swift │ ├── 14909_양수 개수 세기.swift │ ├── 14723_이산수학 과제.swift │ ├── 14219_막대과자 포장.swift │ ├── 14915_진수 변환기.swift │ ├── 14568_2017 연세대학교 프로그래밍 경시대회.swift │ ├── 14215_세 막대.swift │ ├── 14924_폰 노이만과 파리.swift │ ├── 14487_욱제는 효도쟁이야!.swift │ ├── 14782_Bedtime Reading, I.swift │ ├── 14730_謎紛芥索紀 (Small).swift │ ├── 14545_Square.swift │ ├── 14682_Shifty Sum.swift │ ├── 14614_Calculate!.swift │ ├── 14495_피보나치 비스무리한 수열.swift │ ├── 14645_와이버스 부릉부릉.swift │ ├── 14655_욱제는 도박쟁이야!!.swift │ ├── 14579_덧셈과 곱셈.swift │ ├── 14489_치킨 두 마리 (...).swift │ └── 14913_등차수열에서 항 번호 찾기.swift ├── 15000 ~ 15999 │ ├── 15000_CAPS.swift │ ├── 15894_수학은 체육과목 입니다.swift │ ├── 15236_Dominos.swift │ ├── 15439_Vera and Outfits.swift │ ├── 15272_Hissing Microphone.swift │ ├── 15610_Abbey Courtyard.swift │ ├── 15372_A Simple Problem.swift │ ├── 15969_행복.swift │ ├── 15885_고장난 시계.swift │ ├── 15232_Rectangles.swift │ ├── 15700_타일 채우기 4.swift │ ├── 15813_너의 이름은 몇 점이니?.swift │ ├── 15633_Fan Death.swift │ ├── 15680_연세대학교.swift │ ├── 15963_CASIO.swift │ ├── 15964_이상한 기호.swift │ ├── 15567_2018 연세대학교 프로그래밍 경진대회.swift │ ├── 15927_노솔브 방지문제야!!.swift │ ├── 15727_조별과제를 하려는데 조장이 사라졌다.swift │ ├── 15751_Teleportation.swift │ ├── 15995_잉여역수 구하기.swift │ ├── 15096_Batter Up.swift │ ├── 15726_이칙연산.swift │ └── 15781_헬멧과 조끼.swift ├── 26000 ~ 26999 │ ├── 26057_Большой удой.swift │ ├── 26594_ZOAC 5.swift │ ├── 26209_Intercepting Information.swift │ ├── 26574_Copier.swift │ ├── 26489_Gum Gum for Jay Jay.swift │ ├── 26742_Skarpetki.swift │ ├── 26768_H4x0r.swift │ ├── 26545_Mathmatics.swift │ ├── 26731_Zagubiona litera.swift │ ├── 26307_Correct.swift │ ├── 26532_Acres.swift │ ├── 26736_Wynik meczu.swift │ ├── 26531_Simple Sum.swift │ ├── 26561_Population.swift │ ├── 26040_특정 대문자를 소문자로 바꾸기.swift │ ├── 26332_Buying in Bulk.swift │ ├── 26645_성장의 비약 선택권.swift │ └── 26766_Serca.swift ├── 3000 ~ 3999 │ ├── 3765_Celebrity jeopardy.swift │ ├── 3053_택시 기하학.swift │ ├── 3046_R2.swift │ ├── 3733_Shares.swift │ ├── 3052_나머지.swift │ ├── 3003_킹, 퀸, 룩, 비숍, 나이트, 폰.swift │ ├── 3062_수 뒤집기.swift │ ├── 3507_Automated Telephone Exchange.swift │ └── 3578_Holes.swift ├── 20000 ~ 20999 │ ├── 20944_팰린드롬 척화비.swift │ ├── 20833_Kuber.swift │ ├── 20352_Circus.swift │ ├── 20332_Divvying Up.swift │ ├── 20492_세금.swift │ ├── 20360_Binary numbers.swift │ ├── 20673_Covid-19.swift │ ├── 20976_2 番目に大きい整数 (The Second Largest Integer).swift │ ├── 20254_Site Score.swift │ └── 20528_끝말잇기.swift ├── 6000 ~ 6999 │ ├── 6438_Reverse Text.swift │ ├── 6887_Squares.swift │ ├── 6840_Who is in the middle?.swift │ ├── 6749_Next in line.swift │ ├── 6810_ISBN.swift │ ├── 6190_Another Cow Number Game.swift │ ├── 6888_Terms of Office.swift │ ├── 6750_Rotating letters.swift │ ├── 6794_What is n, Daddy?.swift │ ├── 6131_완전 제곱수.swift │ └── 6825_Body Mass Index.swift ├── 1000 ~ 1999 │ ├── 1550_16진수.swift │ ├── 1152_단어의 개수.swift │ ├── 1402_아무래도이문제는A번난이도인것같다.swift │ ├── 1427_소트인사이드.swift │ ├── 1964_오각형, 오각형, 오각형....swift │ ├── 1676_팩토리얼 0의 개수.swift │ ├── 1834_나머지와 몫이 같은 수.swift │ ├── 1085_직사각형에서 탈출.swift │ ├── 1000_A+B.swift │ ├── 1001_A-B.swift │ ├── 1008_A 나누기 B.swift │ ├── 1748_수 이어쓰기 1.swift │ ├── 1259_팰린드롬수.swift │ ├── 1568_새.swift │ ├── 1712_손익분기점.swift │ ├── 1343_폴리오미노.swift │ ├── 1789_수들의 합.swift │ └── 1225_이상한 곱셈.swift ├── 16000 ~ 16999 │ ├── 16394_홍익대학교.swift │ ├── 16600_Contemporary Art.swift │ ├── 16485_작도하자! - ②.swift │ ├── 16483_접시 안의 원.swift │ ├── 16430_제리와 톰.swift │ ├── 16171_나는 친구가 적다 (Small).swift │ ├── 16445_Desvendando Monty Hall.swift │ ├── 16486_운동장 한 바퀴.swift │ ├── 16496_큰 수 만들기.swift │ ├── 16212_정열적인 정렬.swift │ ├── 16479_컵라면 측정하기.swift │ ├── 16427_Time Limits.swift │ ├── 16968_차량 번호판 1.swift │ ├── 16239_Nadan.swift │ └── 16861_Harshad Numbers.swift ├── 4000 ~ 4999 │ ├── 4806_줄 세기.swift │ ├── 4999_아!.swift │ ├── 4922_Walk Like an Egyptian.swift │ ├── 4740_거울, 오! 거울.swift │ ├── 4458_첫 글자를 대문자로.swift │ ├── 4562_No Brainer.swift │ ├── 4564_숫자 카드놀이.swift │ ├── 4655_Hangover.swift │ └── 4696_St. lves.swift ├── 5000 ~ 5999 │ ├── 5341_Pyramids.swift │ ├── 5337_웰컴.swift │ ├── 5522_카드 게임.swift │ ├── 5524_입실 관리.swift │ ├── 5554_심부름 가는 길.swift │ ├── 5338_마이크로소프트 로고.swift │ ├── 5598_카이사르 암호.swift │ ├── 5300_Fill the Rowboats!.swift │ ├── 5013_Death Knight Hero.swift │ ├── 5704_팬그램.swift │ ├── 5565_영수증.swift │ ├── 5691_평균 중앙값 문제.swift │ ├── 5724_파인만.swift │ ├── 5666_Hot Dogs.swift │ ├── 5555_반지.swift │ ├── 5102_Sarah's Toys.swift │ └── 5717_상근이의 친구들.swift ├── 17000 ~ 17999 │ ├── 17548_Greetings!.swift │ ├── 17427_약수의 합.swift │ ├── 17608_막대기.swift │ ├── 17263_Sort 마스터 배지훈.swift │ ├── 17598_Animal King Election.swift │ ├── 17783_Breaking Branches.swift │ ├── 17249_태보태보 총난타.swift │ ├── 17912_License to Launch.swift │ ├── 17356_욱 제.swift │ ├── 17466_N! mod P (1).swift │ ├── 17874_Piece of Cake!.swift │ ├── 17530_Buffoon.swift │ ├── 17350_2루수 이름이 뭐야.swift │ ├── 17294_귀여운 수~ε٩(๑> ₃ <)۶з.swift │ ├── 17863_FYI.swift │ ├── 17614_369.swift │ ├── 17869_Simple Collatz Sequence.swift │ ├── 17010_Time to Decompress.swift │ └── 17201_자석 체인.swift ├── 18000 ~ 18999 │ ├── 18108_1998년생인 내가 태국에서는 2541년생?!.swift │ ├── 18409_母音を数える (Counting Vowels).swift │ ├── 18310_안테나.swift │ ├── 18698_The Walking Adam.swift │ ├── 18411_試験 (Exam).swift │ ├── 18228_펭귄추락대책위원회.swift │ ├── 18301_Rats.swift │ ├── 18414_X に最も近い値 (The Nearest Value).swift │ ├── 18398_HOMWRK.swift │ ├── 18005_Even or Odd?.swift │ └── 18127_모형결정.swift ├── 32000 ~ 32999 │ └── 32025_체육은 수학과목 입니다.swift ├── 28000 ~ 28999 │ ├── 28352_10!.swift │ ├── 28444_HI-ARC=?.swift │ ├── 28061_레몬 따기.swift │ ├── 28224_Final Price.swift │ ├── 28701_세제곱의 합.swift │ ├── 28113_정보섬의 대중교통.swift │ ├── 28235_코드마스터 2023.swift │ ├── 28097_모범생 포닉스.swift │ ├── 28691_정보보호학부 동아리 소개.swift │ ├── 28454_Gift Expire Date.swift │ └── 28490_Area.swift ├── 12000 ~ 12999 │ ├── 12833_XORXORXOR.swift │ └── 12780_원피스.swift ├── 29000 ~ 29999 │ ├── 29766_DKSH 찾기.swift │ ├── 29751_삼각형.swift │ └── 29986_Altura Mínima.swift ├── 19000 ~ 19999 │ ├── 19602_Dog Treats.swift │ ├── 19698_헛간 청약.swift │ └── 19944_뉴비의 기준은 뭘까?.swift └── 22000 ~ 22999 │ └── 22279_Quality-Adjusted Life-Year.swift ├── Programmers ├── Level 0 │ ├── 문자열 출력하기.swift │ ├── 문자열 돌리기.swift │ ├── 나이 출력.swift │ ├── 문자열로 변환.swift │ ├── 정수 부분.swift │ ├── 종이 자르기.swift │ ├── n 번째 원소까지.swift │ ├── 두 수의 곱.swift │ ├── 두 수의 차.swift │ ├── 두 수의 합.swift │ ├── 몫 구하기.swift │ ├── 문자열을 정수로 변환하기.swift │ ├── 편지.swift │ ├── 홀짝 구분하기.swift │ ├── 0 떼기.swift │ ├── n의 배수.swift │ ├── 나머지 구하기.swift │ ├── 배열 뒤집기.swift │ ├── 개미 군단.swift │ ├── 문자 리스트를 문자열로 변환하기.swift │ ├── 배열 두배 만들기.swift │ ├── 소문자로 바꾸기.swift │ ├── 약수 구하기.swift │ ├── 카운트 업.swift │ ├── 피자 나눠 먹기 (1).swift │ ├── 배열 원소의 길이.swift │ ├── 순서쌍의 개수.swift │ ├── 숫자 비교하기.swift │ ├── 아이스 아메리카노.swift │ ├── 짝수는 싫어요.swift │ ├── 뒤에서 5등 위로.swift │ ├── 뒤에서 5등까지.swift │ ├── 문자열 뒤집기.swift │ ├── 배열 만들기 1.swift │ ├── 정수 찾기.swift │ ├── 주사위의 개수.swift │ ├── 중앙값 구하기.swift │ ├── 카운트 다운.swift │ ├── flag에 따라 다른 값 반환하기.swift │ ├── n 번째 원소부터.swift │ ├── 두 수의 연산값 비교하기.swift │ ├── 문자열안에 문자열.swift │ ├── 부분 문자열.swift │ ├── 양꼬치.swift │ ├── 자릿수 더하기.swift │ ├── 중복된 숫자 개수.swift │ ├── 첫 번째로 나오는 음수.swift │ ├── ad 제거하기.swift │ ├── n의 배수 고르기.swift │ ├── 공 던지기.swift │ ├── 대문자로 바꾸기.swift │ ├── 문자열 뒤에 n글자.swift │ ├── 문자열의 앞의 n글자.swift │ ├── 직각삼각형 출력하기.swift │ ├── 9로 나눈 나머지.swift │ ├── 대소문자 바꿔서 출력하기.swift │ ├── 두 수의 나눗셈.swift │ ├── 배열 자르기.swift │ ├── 배열의 원소만큼 추가하기.swift │ ├── 배열의 유사도.swift │ ├── 순서 바꾸기.swift │ ├── 짝수 홀수 개수.swift │ ├── 피자 나눠 먹기 (3).swift │ ├── 369게임.swift │ ├── 가장 큰 수 찾기.swift │ ├── 간단한 논리 연산.swift │ ├── 공배수.swift │ ├── 문자열 곱하기.swift │ ├── 문자열 정렬하기 (2).swift │ ├── 조건에 맞게 수열 변환하기 3.swift │ ├── rny_string.swift │ ├── 가위 바위 보.swift │ ├── 공백으로 구분하기 1.swift │ ├── 공백으로 구분하기 2.swift │ ├── 문자열 붙여서 출력하기.swift │ ├── 문자열 섞기.swift │ ├── 문자열 정수의 합.swift │ ├── 배열 만들기 3.swift │ ├── 부분 문자열인지 확인하기.swift │ ├── 숨어있는 숫자의 덧셈.swift │ ├── 숫자 찾기.swift │ ├── 커피 심부름.swift │ ├── 합성수 찾기.swift │ ├── x 사이의 개수.swift │ ├── 꼬리 문자열.swift │ ├── 더 크게 합치기.swift │ ├── 모음 제거.swift │ ├── 배열의 원소 삭제하기.swift │ ├── 배열의 평균값.swift │ ├── 세균 증식.swift │ ├── 접두사인지 확인하기.swift │ ├── 접미사 배열.swift │ ├── 접미사인지 확인하기.swift │ ├── 5명씩.swift │ ├── A로 B 만들기.swift │ ├── l로 만들기.swift │ ├── 길이에 따른 연산.swift │ ├── 문자열 잘라서 정렬하기.swift │ ├── 외계행성의 나이.swift │ ├── 진료 순서 정하기.swift │ ├── 최댓값 만들기 (1).swift │ ├── 7의 개수.swift │ ├── a와 b 출력하기.swift │ ├── 문자열 묶기.swift │ ├── 원하는 문자열 찾기.swift │ ├── 이진수 더하기.swift │ ├── 특정 문자 제거하기.swift │ ├── 덧셈식 출력하기.swift │ ├── 머쓱이보다 키 큰 사람.swift │ ├── 문자열 정렬하기 (1).swift │ ├── 원소들의 곱과 합.swift │ ├── 할 일 목록.swift │ ├── n개 간격의 원소들.swift │ ├── 문자열 바꿔서 찾기.swift │ ├── 삼각형의 완성조건 (1).swift │ ├── 2의 영역.swift │ ├── A 강조하기.swift │ ├── k의 개수.swift │ ├── 문자열 반복해서 출력하기.swift │ ├── 가까운 1 찾기.swift │ ├── 암호 해독.swift │ ├── 주사위 게임 1.swift │ ├── qr code.swift │ ├── 글자 이어 붙여 문자열 만들기.swift │ ├── 수열과 구간 쿼리 3.swift │ ├── 배열 만들기 5.swift │ ├── 짝수의 합.swift │ ├── 글자 지우기.swift │ ├── 로그인 성공?.swift │ ├── 제곱수 판별하기.swift │ ├── 특정한 문자를 대문자로 바꾸기.swift │ ├── 배열에서 문자열 대소문자 변환하기.swift │ ├── 배열의 길이를 2의 거듭제곱으로 만들기.swift │ ├── 피자 나눠 먹기 (2).swift │ ├── 세로 읽기.swift │ ├── 직사각형 넓이 구하기.swift │ ├── 최댓값 만들기 (2).swift │ ├── 홀짝에 따라 다른 값 반환하기.swift │ ├── 등차수열의 특정한 항만 더하기.swift │ ├── 인덱스 바꾸기.swift │ ├── 그림 확대.swift │ ├── 배열 회전시키기.swift │ ├── 세 개의 구분자.swift │ ├── 배열 만들기 2.swift │ ├── 옷가게 할인 받기.swift │ ├── n보다 커질 때까지 더하기.swift │ ├── 날짜 비교하기.swift │ ├── 문자 개수 세기.swift │ ├── 한 번만 등장한 문자.swift │ ├── 문자열 겹쳐쓰기.swift │ ├── 문자열 뒤집기 2.swift │ ├── 부분 문자열 이어 붙여 문자열 만들기.swift │ ├── 외계어 사전.swift │ ├── 특별한 이차원 배열 1.swift │ └── 팩토리얼.swift ├── Level 1 │ ├── 문자열을 정수로 바꾸기.swift │ ├── 문자열 내림차순으로 배치하기.swift │ ├── 자릿수 더하기.swift │ ├── 평균 구하기.swift │ ├── 없는 숫자 더하기.swift │ ├── 3진법 뒤집기.swift │ ├── 두 정수 사이의 합.swift │ ├── 정수 내림차순으로 배치하기.swift │ ├── 나누어 떨어지는 숫자 배열.swift │ ├── x만큼 간격이 있는 n개의 숫자.swift │ ├── 수박수박수박수박수박수?.swift │ ├── 제일 작은 수 제거하기.swift │ ├── 자연수 뒤집어 배열로 만들기.swift │ ├── 내적.swift │ ├── 직사각형 별찍기.swift │ ├── 나머지가 1이 되는 수 찾기.swift │ ├── 문자열 내 마음대로 정렬하기.swift │ ├── 짝수와 홀수.swift │ ├── 부족한 금액 계산하기.swift │ ├── 서울에서 김서방 찾기.swift │ ├── 문자열 다루기 기본.swift │ ├── 정수 제곱근 판별.swift │ └── 하샤드 수.swift └── Level 2 │ └── 최댓값과 최솟값.swift ├── .gitignore ├── README.md └── 이것이 코딩테스트다 ├── ch06_정렬 └── 위에서 아래로.swift └── ch03_그리디 └── 거스름돈.swift /BOJ/13000 ~ 13999/13311_행운의 편지.swift: -------------------------------------------------------------------------------- 1 | print(-1) 2 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11942_고려대는 사랑입니다.swift: -------------------------------------------------------------------------------- 1 | print("고려대학교") 2 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27465_소수가 아닌 수.swift: -------------------------------------------------------------------------------- 1 | print(1000000000) 2 | -------------------------------------------------------------------------------- /BOJ/7000 ~ 7999/7287_등록.swift: -------------------------------------------------------------------------------- 1 | print("169") 2 | print("mandos95") 3 | -------------------------------------------------------------------------------- /BOJ/21000 ~ 21999/21553_암호 만들기.swift: -------------------------------------------------------------------------------- 1 | readLine();print(readLine()!) 2 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24078_余り (Remainder).swift: -------------------------------------------------------------------------------- 1 | print(Int(readLine()!)! % 21) 2 | -------------------------------------------------------------------------------- /BOJ/30000 ~ 30999/30328_Java Warriors.swift: -------------------------------------------------------------------------------- 1 | print(Int(readLine()!)! * 4000) -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10926_??!.swift: -------------------------------------------------------------------------------- 1 | let id = readLine()! 2 | print(id + "??!") 3 | -------------------------------------------------------------------------------- /BOJ/23000 ~ 23999/23234_The World Responds.swift: -------------------------------------------------------------------------------- 1 | print("The wordl says hello!") 2 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27323_직사각형.swift: -------------------------------------------------------------------------------- 1 | print(Int(readLine()!)! * Int(readLine()!)!) 2 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27389_Metronome.swift: -------------------------------------------------------------------------------- 1 | let n = Double(readLine()!)! 2 | print(n/4) -------------------------------------------------------------------------------- /BOJ/8000 ~ 8999/8545_Zadanie próbne.swift: -------------------------------------------------------------------------------- 1 | print(String(readLine()!.reversed())) 2 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2557_Hello World.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | print("Hello World!") 3 | -------------------------------------------------------------------------------- /BOJ/25000 ~ 25999/25311_UCPC에서 가장 쉬운 문제 번호는?.swift: -------------------------------------------------------------------------------- 1 | _ = readLine() 2 | print("A") 3 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31611_ 火曜日 (Tuesday).swift: -------------------------------------------------------------------------------- 1 | print(Int(readLine()!)!%7==2 ? 1 : 0) 2 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24082_立方体 (Cube).swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | print(n * n * n) 3 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27433_팩토리얼 2.swift: -------------------------------------------------------------------------------- 1 | print((1...(max(Int(readLine()!)!, 1))).reduce(1,*)) 2 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31606_果物 (Fruit).swift: -------------------------------------------------------------------------------- 1 | print(Int(readLine()!)!+Int(readLine()!)!+3) 2 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31614_分 (Minutes).swift: -------------------------------------------------------------------------------- 1 | print(Int(readLine()!)!*60+Int(readLine()!)!) 2 | -------------------------------------------------------------------------------- /BOJ/9000 ~ 9999/9659_돌 게임 5.swift: -------------------------------------------------------------------------------- 1 | Int(readLine()!)! % 2 == 1 ? print("SK") : print("CY") 2 | -------------------------------------------------------------------------------- /BOJ/9000 ~ 9999/9660_돌 게임 6.swift: -------------------------------------------------------------------------------- 1 | print([0,2].contains(Int(readLine()!)!%7) ?"CY":"SK") 2 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14491_9진수.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | print(String(n, radix: 9)) 3 | -------------------------------------------------------------------------------- /BOJ/15000 ~ 15999/15000_CAPS.swift: -------------------------------------------------------------------------------- 1 | let string = readLine()! 2 | print(string.uppercased()) 3 | -------------------------------------------------------------------------------- /BOJ/23000 ~ 23999/23530_Not A + B.swift: -------------------------------------------------------------------------------- 1 | let t = Int(readLine()!)!; for _ in 0.. Int { 2 | return Int(s)! 3 | } 4 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10821_정수의 개수.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: ",") 2 | print(input.count) 3 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11023_더하기 3.swift: -------------------------------------------------------------------------------- 1 | print(readLine()!.split(separator: " ").map { Int($0)! }.reduce(0, +)) 2 | -------------------------------------------------------------------------------- /BOJ/20000 ~ 20999/20944_팰린드롬 척화비.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | print(String(repeating: "a", count: n)) 3 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24262_알고리즘 수업 - 알고리즘의 수행 시간 1.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | print(1) 3 | print(0) 4 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24263_알고리즘 수업 - 알고리즘의 수행 시간 2.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | print(n) 3 | print(1) 4 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24264_알고리즘 수업 - 알고리즘의 수행 시간 3.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | print(n * n) 3 | print(2) 4 | -------------------------------------------------------------------------------- /BOJ/6000 ~ 6999/6438_Reverse Text.swift: -------------------------------------------------------------------------------- 1 | for _ in 0.. Int { 4 | return 2023 - age 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열로 변환.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> String { 4 | return "\(n)" 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 1/문자열 내림차순으로 배치하기.swift: -------------------------------------------------------------------------------- 1 | func solution(_ s:String) -> String { 2 | return String(s.sorted(by: >)) 3 | } 4 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1402_아무래도이문제는A번난이도인것같다.swift: -------------------------------------------------------------------------------- 1 | for _ in 0.. Int { 4 | return Int(flo) 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10817_세 수.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! }.sorted(by: >) 2 | print(input[1]) 3 | -------------------------------------------------------------------------------- /BOJ/13000 ~ 13999/13297_Quick Estimates.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | for _ in 0.. Int { 4 | return M * N - 1 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10171_고양이.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | print("\\ /\\") 3 | print(" ) ( ')") 4 | print("( / )") 5 | print(" \\(__)|") 6 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2742_찍기 N.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let n = Int(readLine()!)! 3 | for i in (1...n).reversed(){ 4 | print(i) 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2903_중앙 이동 알고리즘.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let n = Int(readLine()!)! 3 | let line = pow(2, n) + 1 4 | print(line * line) 5 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24568_Cupcake Party.swift: -------------------------------------------------------------------------------- 1 | let r = Int(readLine()!)! 2 | let s = Int(readLine()!)! 3 | 4 | print((r * 8 + s * 3) - 28) 5 | -------------------------------------------------------------------------------- /BOJ/25000 ~ 25999/25628_햄버거 만들기.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | print(min(input[0] / 2, input[1])) 3 | -------------------------------------------------------------------------------- /BOJ/26000 ~ 26999/26489_Gum Gum for Jay Jay.swift: -------------------------------------------------------------------------------- 1 | var answer = 0 2 | while let _ = readLine() { 3 | answer += 1 4 | } 5 | print(answer) 6 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27332_11 月 (November).swift: -------------------------------------------------------------------------------- 1 | let a = Int(readLine()!)! 2 | let b = Int(readLine()!)! 3 | print(a + b * 7 < 31 ? 1 : 0) 4 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27866_문자와 문자열.swift: -------------------------------------------------------------------------------- 1 | let word = readLine()! 2 | let index = Int(readLine()!)! - 1 3 | print(word.map { $0 }[index]) 4 | -------------------------------------------------------------------------------- /BOJ/32000 ~ 32999/32025_체육은 수학과목 입니다.swift: -------------------------------------------------------------------------------- 1 | let h = Double(readLine()!)! 2 | let w = Double(readLine()!)! 3 | print(Int(min(h, w)/2 * 100)) 4 | -------------------------------------------------------------------------------- /BOJ/4000 ~ 4999/4922_Walk Like an Egyptian.swift: -------------------------------------------------------------------------------- 1 | while let n = Int(readLine()!), n != 0 { 2 | print("\(n) => \(n * n - (n - 1))") 3 | } 4 | -------------------------------------------------------------------------------- /BOJ/6000 ~ 6999/6887_Squares.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | print("The largest square has side length \(Int(sqrt(Double(readLine()!)!))).") 3 | -------------------------------------------------------------------------------- /BOJ/9000 ~ 9999/9316_Hello Judge.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | 3 | for i in 1...n{ 4 | print("Hello World, Judge \(i)!") 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/n 번째 원소까지.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[String]) -> String { 4 | return arr.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/두 수의 곱.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num1:Int, _ num2:Int) -> Int { 4 | return num1 * num2 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/두 수의 차.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num1:Int, _ num2:Int) -> Int { 4 | return num1 - num2 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/두 수의 합.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num1:Int, _ num2:Int) -> Int { 4 | return num1 + num2 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/몫 구하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num1:Int, _ num2:Int) -> Int { 4 | return num1 / num2 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열을 정수로 변환하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n_str:String) -> Int { 4 | return Int(n_str)! 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/편지.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ message:String) -> Int { 4 | return message.count * 2 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/홀짝 구분하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let a = Int(readLine()!)! 4 | print("\(a) is \(a % 2 == 0 ? "even" : "odd")") 5 | -------------------------------------------------------------------------------- /Programmers/Level 1/자릿수 더하기.swift: -------------------------------------------------------------------------------- 1 | func solution(_ n:Int) -> Int 2 | { 3 | return String(n).map { Int(String($0))! }.reduce(0, +) 4 | } 5 | -------------------------------------------------------------------------------- /Programmers/Level 1/평균 구하기.swift: -------------------------------------------------------------------------------- 1 | func solution(_ arr:[Int]) -> Double { 2 | return Double(arr.reduce(0, +)) / Double(arr.count) 3 | } 4 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1427_소트인사이드.swift: -------------------------------------------------------------------------------- 1 | let nums = readLine()!.map { Int(String($0))! }.sorted(by: >) 2 | print(nums.map { String($0) }.reduce("", +)) 3 | -------------------------------------------------------------------------------- /BOJ/16000 ~ 16999/16485_작도하자! - ②.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Double($0)! } 2 | 3 | print(input[0] / input[1]) 4 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2739_구구단.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let n = Int(readLine()!)! 3 | for i in 1...9{ 4 | print("\(n) * \(i) = \(n * i)") 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/21000 ~ 21999/21964_선린인터넷고등학교 교가.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let input = readLine()!.map { $0 } 3 | print(String(input[(n - 5)...])) 4 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27106_Making Change.swift: -------------------------------------------------------------------------------- 1 | let n = 100 - Int(readLine()!)! 2 | print(n / 25, n % 25 / 10, n % 25 % 10 / 5, n % 25 % 10 % 5) 3 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31668_특별한 가지.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let m = Int(readLine()!)! 3 | let k = Int(readLine()!)! 4 | print(m / n * k) 5 | -------------------------------------------------------------------------------- /BOJ/5000 ~ 5999/5337_웰컴.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | print(". . .") 3 | print("| | _ | _. _ ._ _ _") 4 | print("|/\\|(/.|(_.(_)[ | )(/.") 5 | -------------------------------------------------------------------------------- /BOJ/5000 ~ 5999/5522_카드 게임.swift: -------------------------------------------------------------------------------- 1 | var sum = 0 2 | for _ in 1...5{ 3 | let num = Int(readLine()!)! 4 | sum += num 5 | } 6 | print(sum) 7 | -------------------------------------------------------------------------------- /BOJ/8000 ~ 8999/8741_이진수 합.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | print(String(repeating: "1", count: n) + String(repeating: "0", count: n - 1)) 3 | -------------------------------------------------------------------------------- /Programmers/Level 0/0 떼기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n_str:String) -> String { 4 | return String(Int(n_str)!) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/n의 배수.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num:Int, _ n:Int) -> Int { 4 | return num % n == 0 ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/나머지 구하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num1:Int, _ num2:Int) -> Int { 4 | return num1 % num2 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열 뒤집기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num_list:[Int]) -> [Int] { 4 | return num_list.reversed() 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1964_오각형, 오각형, 오각형....swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let result = (4 * n + 3 * n * (n - 1) / 2 + 1) % 45678 3 | print(result) 4 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11719_그대로 출력하기 2.swift: -------------------------------------------------------------------------------- 1 | while true{ 2 | guard let line = readLine() else { 3 | break 4 | } 5 | print(line) 6 | } 7 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14264_정육각형과 삼각형.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let num = Double(readLine()!)! 3 | let s = (num * num * sqrt(3)) / 4.0 4 | print(s) 5 | -------------------------------------------------------------------------------- /BOJ/15000 ~ 15999/15372_A Simple Problem.swift: -------------------------------------------------------------------------------- 1 | for _ in 0..= price[1] ? "Yes" : "No") 3 | -------------------------------------------------------------------------------- /BOJ/28000 ~ 28999/28352_10!.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var f = 1 3 | for i in 1...n { 4 | f *= i 5 | } 6 | print(f / (7 * 24 * 60 * 60)) 7 | -------------------------------------------------------------------------------- /BOJ/3000 ~ 3999/3046_R2.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = readLine()!.split(separator: " ").map { Int($0)! } 3 | print(input[1] * 2 - input[0]) 4 | -------------------------------------------------------------------------------- /BOJ/8000 ~ 8999/8370_Plane.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map{ Int($0)! } 2 | print(input[0] * input[1] + input[2] * input[3]) 3 | -------------------------------------------------------------------------------- /BOJ/9000 ~ 9999/9655_돌 게임.swift: -------------------------------------------------------------------------------- 1 | let num = Int(readLine()!)! 2 | 3 | if num % 2 == 1 { 4 | print("SK") 5 | } else { 6 | print("CY") 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/9000 ~ 9999/9656_돌 게임2.swift: -------------------------------------------------------------------------------- 1 | let num = Int(readLine()!)! 2 | 3 | if num % 2 == 1 { 4 | print("CY") 5 | } else { 6 | print("SK") 7 | } 8 | -------------------------------------------------------------------------------- /Programmers/Level 0/개미 군단.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ hp:Int) -> Int { 4 | return hp / 5 + hp % 5 / 3 + hp % 5 % 3 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자 리스트를 문자열로 변환하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[String]) -> String { 4 | return arr.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열 두배 만들기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ numbers:[Int]) -> [Int] { 4 | return numbers.map { $0 * 2 } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/소문자로 바꾸기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ myString:String) -> String { 4 | return myString.lowercased() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/약수 구하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> [Int] { 4 | return (1...n).filter { n % $0 == 0 } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/카운트 업.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ start:Int, _ end:Int) -> [Int] { 4 | return [Int](start...end) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/피자 나눠 먹기 (1).swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | return n % 7 == 0 ? n / 7 : n / 7 + 1 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 1/없는 숫자 더하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ numbers:[Int]) -> Int { 4 | return 45 - numbers.reduce(0, +) 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2420_사파리월드.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = readLine()!.split(separator: " ").map { Int($0)! } 3 | print(abs(input[0] - input[1])) 4 | -------------------------------------------------------------------------------- /BOJ/20000 ~ 20999/20833_Kuber.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var answer = 0 3 | for i in 1...n { 4 | answer += i * i * i 5 | } 6 | print(answer) 7 | -------------------------------------------------------------------------------- /BOJ/21000 ~ 21999/21734_SMUPC의 등장.swift: -------------------------------------------------------------------------------- 1 | readLine()!.forEach {print(String(repeating:$0,count:"\($0.asciiValue!)".map {Int(String($0))!}.reduce(0,+)))} 2 | -------------------------------------------------------------------------------- /BOJ/23000 ~ 23999/23825_SASA 모형을 만들어보자.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | print(min(input[0] / 2, input[1] / 2)) 3 | -------------------------------------------------------------------------------- /BOJ/26000 ~ 26999/26545_Mathmatics.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var ans = 0 3 | for _ in 0.. [Int] { 4 | return strlist.map { $0.count } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/순서쌍의 개수.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | return (1...n).filter { n % $0 == 0 }.count 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/숫자 비교하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num1:Int, _ num2:Int) -> Int { 4 | return num1 == num2 ? 1 : -1 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/아이스 아메리카노.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ money:Int) -> [Int] { 4 | return [money / 5500, money % 5500] 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/짝수는 싫어요.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> [Int] { 4 | return [Int](1...n).filter { $0 % 2 == 1} 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | main.swift 3 | 4 | *.pbxproj 5 | 6 | *.xcworkspacedata 7 | 8 | *.xcuserstate 9 | 10 | *.plist 11 | 12 | *.xcbkptlist 13 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11908_카드.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | print(readLine()!.split(separator: " ").map { Int($0)! }.sorted(by: <)[0.. [Int] { 4 | return Array(num_list.sorted()[5...]) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/뒤에서 5등까지.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num_list:[Int]) -> [Int] { 4 | return Array(num_list.sorted()[0..<5]) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 뒤집기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> String { 4 | return String(my_string.reversed()) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열 만들기 1.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int, _ k:Int) -> [Int] { 4 | return (1...n).filter { $0 % k == 0 } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/정수 찾기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num_list:[Int], _ n:Int) -> Int { 4 | return num_list.contains(n) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/주사위의 개수.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ box:[Int], _ n:Int) -> Int { 4 | return box.map { $0 / n }.reduce(1, *) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/중앙값 구하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ array:[Int]) -> Int { 4 | return array.sorted(by: <)[array.count / 2] 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/카운트 다운.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ start:Int, _ end:Int) -> [Int] { 4 | return [Int](end...start).reversed() 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/16000 ~ 16999/16483_접시 안의 원.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let t = Double(readLine()!)! 3 | 4 | let result = round((t * 0.5) * (t * 0.5)) 5 | print(Int(result)) 6 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2355_시그마.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | print((input[0] + input[1]) * (abs(input[0] - input[1]) + 1) / 2) 3 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24083_短針 (Hour Hand).swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let result = (n + Int(readLine()!)!) % 12 3 | result == 0 ? print(12) : print(result) 4 | -------------------------------------------------------------------------------- /BOJ/26000 ~ 26999/26307_Correct.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let h = input[0] - 9, m = input[1] 3 | print(h * 60 + m) 4 | -------------------------------------------------------------------------------- /BOJ/5000 ~ 5999/5554_심부름 가는 길.swift: -------------------------------------------------------------------------------- 1 | var sum = 0 2 | for _ in 1...4{ 3 | let a = Int(readLine()!)! 4 | sum += a 5 | } 6 | print(sum/60) 7 | print(sum%60) 8 | -------------------------------------------------------------------------------- /BOJ/6000 ~ 6999/6840_Who is in the middle?.swift: -------------------------------------------------------------------------------- 1 | var arr: [Int] = [] 2 | for _ in 0..<3 { 3 | arr.append(Int(readLine()!)!) 4 | } 5 | print(arr.sorted()[1]) 6 | -------------------------------------------------------------------------------- /BOJ/7000 ~ 7999/7567_그릇.swift: -------------------------------------------------------------------------------- 1 | // 2 | // 7567_그릇.swift 3 | // algorithm_swift 4 | // 5 | // Created by 김민석 on 2021/08/14. 6 | // 7 | 8 | import Foundation 9 | -------------------------------------------------------------------------------- /Programmers/Level 0/flag에 따라 다른 값 반환하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ a:Int, _ b:Int, _ flag:Bool) -> Int { 4 | flag ? a + b : a - b 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/n 번째 원소부터.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num_list:[Int], _ n:Int) -> [Int] { 4 | return Array(num_list[(n - 1)...]) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/두 수의 연산값 비교하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ a:Int, _ b:Int) -> Int { 4 | return max(Int("\(a)\(b)")!, 2 * a * b) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열안에 문자열.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ str1:String, _ str2:String) -> Int { 4 | return str1.contains(str2) ? 1 : 2 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/부분 문자열.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ str1:String, _ str2:String) -> Int { 4 | return str2.contains(str1) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/양꼬치.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int, _ k:Int) -> Int { 4 | return n * 12_000 + k * 2_000 - (n / 10) * 2_000 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/자릿수 더하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | return String(n).map { Int(String($0))! }.reduce(0, +) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/중복된 숫자 개수.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ array:[Int], _ n:Int) -> Int { 4 | return array.filter { $0 == n }.count 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/첫 번째로 나오는 음수.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num_list:[Int]) -> Int { 4 | return num_list.firstIndex { $0 < 0 } ?? -1 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1676_팩토리얼 0의 개수.swift: -------------------------------------------------------------------------------- 1 | var n = Int(readLine()!)! 2 | var count = 0 3 | 4 | while n >= 5 { 5 | count += n / 5 6 | n /= 5 7 | } 8 | print(count) 9 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11382_꼬마 정민.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = readLine()!.components(separatedBy: " ").map{ Int($0)! } 3 | print(input[0] + input[1] + input[2]) 4 | -------------------------------------------------------------------------------- /BOJ/16000 ~ 16999/16430_제리와 톰.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = readLine()!.components(separatedBy: " ").map{ Int($0)! } 3 | print(input[1]-input[0], input[1]) 4 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17427_약수의 합.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var answer = 0 3 | 4 | for i in 1...n { 5 | answer += (n / i) * i 6 | } 7 | 8 | print(answer) 9 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17608_막대기.swift: -------------------------------------------------------------------------------- 1 | // 2 | // 17608_막대기.swift 3 | // algorithm_swift 4 | // 5 | // Created by 김민석 on 2021/07/24. 6 | // 7 | 8 | import Foundation 9 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2052_지수연산.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let n = Double(readLine()!)! 3 | let result = 1.0 / pow(2.0, n) 4 | print(String(format: "%.\(Int(n))f", result)) 5 | -------------------------------------------------------------------------------- /BOJ/20000 ~ 20999/20352_Circus.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = Double(readLine()!)! 3 | let result = sqrt(input / Double.pi) * 2 * Double.pi 4 | print(result) 5 | -------------------------------------------------------------------------------- /BOJ/26000 ~ 26999/26532_Acres.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let a = input[0], b = input[1] 3 | print(a * b / 4840 / 5 + 1) 4 | -------------------------------------------------------------------------------- /BOJ/28000 ~ 28999/28444_HI-ARC=?.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | print(input[0] * input[1] - input[2] * input[3] * input[4]) 3 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31261_НАМИСЛИХ СИ ЧИСЛО.swift: -------------------------------------------------------------------------------- 1 | let ab = readLine()!.split(separator: " ").map { Int($0)! } 2 | let a = ab[0], b = ab[1] 3 | print(((b + a) * a + a) * a) 4 | -------------------------------------------------------------------------------- /BOJ/4000 ~ 4999/4740_거울, 오! 거울.swift: -------------------------------------------------------------------------------- 1 | while let input = readLine() { 2 | if input == "***" { 3 | break 4 | } 5 | print(String(input.reversed())) 6 | } 7 | -------------------------------------------------------------------------------- /Programmers/Level 0/ad 제거하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ strArr:[String]) -> [String] { 4 | return strArr.filter { !$0.contains("ad") } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/n의 배수 고르기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int, _ numlist:[Int]) -> [Int] { 4 | return numlist.filter { $0 % n == 0 } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/공 던지기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ numbers:[Int], _ k:Int) -> Int { 4 | return numbers[(2 * (k - 1)) % numbers.count] 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/대문자로 바꾸기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ myString:String) -> String { 4 | return myString.map { $0.uppercased() }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 뒤에 n글자.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ n:Int) -> String { 4 | return String(my_string.suffix(n)) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열의 앞의 n글자.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ n:Int) -> String { 4 | return String(my_string.prefix(n)) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/직각삼각형 출력하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let n = Int(readLine()!)! 4 | 5 | for i in 1...n { 6 | print(String(repeating: "*", count: i)) 7 | } 8 | -------------------------------------------------------------------------------- /Programmers/Level 1/3진법 뒤집기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | return Int(String(String(n, radix: 3).reversed()),radix: 3)! 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 1/두 정수 사이의 합.swift: -------------------------------------------------------------------------------- 1 | func solution(_ a:Int, _ b:Int) -> Int64 { 2 | return a < b ? Int64((a...b).reduce(0, +)) : Int64((b...a).reduce(0, +)) 3 | } 4 | -------------------------------------------------------------------------------- /Programmers/Level 1/정수 내림차순으로 배치하기.swift: -------------------------------------------------------------------------------- 1 | func solution(_ n:Int64) -> Int64 { 2 | let result = String(n).sorted(by: >) 3 | return Int64(String(result)) ?? 0 4 | } 5 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10172_개.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | print("|\\_/|") 3 | print("|q p| /}") 4 | print("( 0 )\"\"\"\\") 5 | print("|\"^\"` |") 6 | print("||_/=\\\\__|") 7 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10824_네 수.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ") 2 | let a = input[0] + input[1] 3 | let b = input[2] + input[3] 4 | print(Int(a)! + Int(b)!) 5 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10952_A+B - 4.swift: -------------------------------------------------------------------------------- 1 | while let line = readLine() { 2 | let input = line.split(separator: " ").map {Int($0)!} 3 | print(input[0] + input[1]) 4 | } 5 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14909_양수 개수 세기.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int(String($0))! } 2 | let filter = input.filter { $0 > 0 } 3 | print(filter.count) 4 | -------------------------------------------------------------------------------- /BOJ/15000 ~ 15999/15885_고장난 시계.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Double($0)! } 2 | let a = input[0], b = input[1] 3 | print(Int(abs(a / b - 1) * 2)) 4 | -------------------------------------------------------------------------------- /BOJ/18000 ~ 18999/18310_안테나.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let array = readLine()!.split(separator: " ").map { Int($0)! }.sorted(by: <) 3 | print(array[(n - 1) / 2]) 4 | -------------------------------------------------------------------------------- /BOJ/18000 ~ 18999/18698_The Walking Adam.swift: -------------------------------------------------------------------------------- 1 | for _ in 0.. Int { 4 | return number.map { Int(String($0))! }.reduce(0, +) % 9 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/대소문자 바꿔서 출력하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let s1 = readLine()! 4 | print(s1.map { $0.isUppercase ? $0.lowercased() : $0.uppercased() }.reduce("", +)) 5 | -------------------------------------------------------------------------------- /Programmers/Level 0/두 수의 나눗셈.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num1:Int, _ num2:Int) -> Int { 4 | return Int((Double(num1) / Double(num2)) * 1000) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열 자르기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ numbers:[Int], _ num1:Int, _ num2:Int) -> [Int] { 4 | return [Int](numbers[num1...num2]) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열의 원소만큼 추가하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[Int]) -> [Int] { 4 | return arr.flatMap { [Int](repeating: $0, count: $0) } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열의 유사도.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ s1:[String], _ s2:[String]) -> Int { 4 | return s2.filter { s1.contains($0) }.count 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/순서 바꾸기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num_list:[Int], _ n:Int) -> [Int] { 4 | return Array(num_list[n...] + num_list[.. Int { 4 | return n % slice == 0 ? n / slice : n / slice + 1 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/피자 나눠 먹기 (3).swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ slice:Int, _ n:Int) -> Int { 4 | return n % slice == 0 ? n / slice : n / slice + 1 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/15000 ~ 15999/15232_Rectangles.swift: -------------------------------------------------------------------------------- 1 | let r = Int(readLine()!)! 2 | let c = Int(readLine()!)! 3 | 4 | for _ in 0.. 1 ? 1 : 0 } 4 | print(answer) 5 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17263_Sort 마스터 배지훈.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let input = readLine()!.split(separator: " ").map { Int(String($0))! }.sorted(by: >) 3 | print(input[0]) 4 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17598_Animal King Election.swift: -------------------------------------------------------------------------------- 1 | var tiger = 0 2 | for _ in 0..<9 { 3 | tiger += readLine()! == "Tiger" ? 1 : 0 4 | } 5 | print(tiger > 4 ? "Tiger" : "Lion") 6 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2010_플러그.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var com = 0 3 | for _ in 0.. b ? b * 2 + 1 : a * 2 - 1) 4 | -------------------------------------------------------------------------------- /BOJ/30000 ~ 30999/30310_Finding Forks.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let fork = readLine()!.split(separator: " ").map { Int($0)! }.sorted() 3 | print(fork[0] + fork[1]) 4 | 5 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31403_A + B - C.swift: -------------------------------------------------------------------------------- 1 | let a = readLine()! 2 | let b = readLine()! 3 | let c = readLine()! 4 | print(Int(a)! + Int(b)! - Int(c)!) 5 | print(Int(a + b)! - Int(c)!) 6 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31429_SUAPC 2023 Summer.swift: -------------------------------------------------------------------------------- 1 | print(["12 1600","11 894","11 1327","10 1311","9 1004","9 1178","9 1357","8 837","7 1055","6 556","6 773"][Int(readLine()!)!-1]) 2 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31833_온데간데없을뿐더러.swift: -------------------------------------------------------------------------------- 1 | readLine();print(min(Int(readLine()!.split{$0==" "}.map{String($0)}.joined())!,Int(readLine()!.split{$0==" "}.map{String($0)}.joined())!)) 2 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31922_이 대회는 이제 제 겁니다.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let a = input[0], p = input[1], c = input[2] 3 | print(max(a+c, p)) 4 | -------------------------------------------------------------------------------- /BOJ/6000 ~ 6999/6749_Next in line.swift: -------------------------------------------------------------------------------- 1 | let youngestChild = Int(readLine()!)! 2 | let milddleChild = Int(readLine()!)! 3 | print(milddleChild + (milddleChild - youngestChild)) 4 | -------------------------------------------------------------------------------- /Programmers/Level 0/369게임.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ order:Int) -> Int { 4 | return "\(order)".filter { $0 == "3" || $0 == "6" || $0 == "9" }.count 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/가장 큰 수 찾기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ array:[Int]) -> [Int] { 4 | return [array.max()!, array.firstIndex(of: array.max()!)!] 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/간단한 논리 연산.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ x1:Bool, _ x2:Bool, _ x3:Bool, _ x4:Bool) -> Bool { 4 | return (x1 || x2) && (x3 || x4) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/공배수.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ number:Int, _ n:Int, _ m:Int) -> Int { 4 | return (number % n == 0 && number % m == 0) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 곱하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ k:Int) -> String { 4 | return String(repeating: my_string, count: k) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 정렬하기 (2).swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> String { 4 | return String(my_string.lowercased().sorted(by: <)) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/조건에 맞게 수열 변환하기 3.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[Int], _ k:Int) -> [Int] { 4 | return arr.map { k % 2 == 0 ? $0 + k : $0 * k } 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10173_니모를 찾아서.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | while let line = readLine(), line != "EOI" { 3 | print(line.lowercased().contains("nemo") ? "Found" : "Missing") 4 | } 5 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11179_2진수 뒤집기.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let binaryN = String(n, radix: 2) 3 | let reverse = String(binaryN.reversed()) 4 | print(Int(reverse, radix: 2)!) 5 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17783_Breaking Branches.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | if n % 2 == 0 { 3 | print("Alice") 4 | print(n / 2) 5 | } else { 6 | print("Bob") 7 | } 8 | 9 | -------------------------------------------------------------------------------- /BOJ/25000 ~ 25999/25238_가희와 방어율 무시.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Double($0)! } 2 | input[0] - (input[0] * (input[1] / 100)) >= 100 ? print(0) : print(1) 3 | -------------------------------------------------------------------------------- /BOJ/25000 ~ 25999/25314_코딩은 체육과목 입니다.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var answer = [String](repeating: "long", count: n / 4) 3 | print(answer.joined(separator: " ") + " int") 4 | 5 | -------------------------------------------------------------------------------- /BOJ/4000 ~ 4999/4458_첫 글자를 대문자로.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | for _ in 0.. String { 4 | return rny_string.replacingOccurrences(of: "m", with: "rn") 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/가위 바위 보.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ rsp:String) -> String { 4 | return rsp.map { $0 == "0" ? "5" : $0 == "5" ? "2" : "0" }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/공백으로 구분하기 1.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> [String] { 4 | return my_string.split { $0 == " " }.map { String($0) } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/공백으로 구분하기 2.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> [String] { 4 | return my_string.split { $0 == " " }.map { String($0) } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 붙여서 출력하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let inp = readLine()!.components(separatedBy: [" "]).map { $0 } 4 | let (s1, s2) = (inp[0], inp[1]) 5 | print(s1+s2) 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 섞기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ str1:String, _ str2:String) -> String { 4 | return zip(str1, str2).map { "\($0)\($1)" }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 정수의 합.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ rny_string:String) -> String { 4 | return rny_string.replacingOccurrences(of: "m", with: "rn") 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열 만들기 3.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[Int], _ intervals:[[Int]]) -> [Int] { 4 | return intervals.flatMap { arr[$0[0]...$0[1]] } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/부분 문자열인지 확인하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ target:String) -> Int { 4 | return my_string.contains(target) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/숨어있는 숫자의 덧셈.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> Int { 4 | return my_string.compactMap { Int(String($0)) }.reduce(0, +) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/숫자 찾기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num:Int, _ k:Int) -> Int { 4 | return "a\(num)".map { $0 }.firstIndex(of: Character("\(k)")) ?? -1 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/커피 심부름.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ order:[String]) -> Int { 4 | return order.map { $0.contains("latte") ? 5000 : 4500 }.reduce(0, +) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/합성수 찾기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | return (1...n).filter { i in (1...i).filter { i % $0 == 0 }.count > 2 }.count 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10823_더하기 2.swift: -------------------------------------------------------------------------------- 1 | var str = "" 2 | while let string = readLine() { 3 | str += string 4 | } 5 | print(str.split(separator: ",").compactMap { Int($0)! }.reduce(0, +)) 6 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14723_이산수학 과제.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var i = 1 3 | while i * (i + 1) / 2 < n { i += 1 } 4 | let b = n - (i - 1) * i / 2 5 | let a = i + 1 - b 6 | print(a, b) 7 | -------------------------------------------------------------------------------- /BOJ/16000 ~ 16999/16486_운동장 한 바퀴.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let d1 = Double(readLine()!)! 3 | let d2 = Double(readLine()!)! 4 | let sum = ((d2 * 2) * Double.pi) + (d1 * 2) 5 | print(sum) 6 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17249_태보태보 총난타.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let teabo = readLine()!.split(separator: "0") 3 | print(teabo[0].filter { $0 == "@"}.count, teabo[1].filter { $0 == "@"}.count) 4 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2440_별 찍기 - 3.swift: -------------------------------------------------------------------------------- 1 | let input = Int(readLine()!)! 2 | for i in 0.. [Int] { 4 | return myString.components(separatedBy: "x").map { String($0).count } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/꼬리 문자열.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ str_list:[String], _ ex:String) -> String { 4 | return str_list.filter { !$0.contains(ex) }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/더 크게 합치기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ a:Int, _ b:Int) -> Int { 4 | return "\(a)\(b)" > "\(b)\(a)" ? Int("\(a)\(b)")! : Int("\(b)\(a)")! 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/모음 제거.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> String { 4 | return my_string.filter { !["a", "e", "i", "o", "u"].contains($0) } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열의 원소 삭제하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[Int], _ delete_list:[Int]) -> [Int] { 4 | return arr.filter { !delete_list.contains($0) } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열의 평균값.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ numbers:[Int]) -> Double { 4 | return numbers.map { Double($0) }.reduce(0, +) / Double(numbers.count) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/세균 증식.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> String { 4 | return my_string.filter { !["a", "e", "i", "o", "u"].contains($0) } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/접두사인지 확인하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ is_prefix:String) -> Int { 4 | return my_string.hasPrefix(is_prefix) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/접미사 배열.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> [String] { 4 | return my_string.indices.map { String(my_string[$0...]) }.sorted() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/접미사인지 확인하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ is_suffix:String) -> Int { 4 | return my_string.hasSuffix(is_suffix) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1834_나머지와 몫이 같은 수.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var step = 1 3 | var sum = 0 4 | for _ in 0.. [String] { 4 | return stride(from: 0, through: names.count - 1, by: 5).map { names[$0] } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/A로 B 만들기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ before:String, _ after:String) -> Int { 4 | return before.sorted(by: >) == after.sorted(by: >) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/l로 만들기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ myString:String) -> String { 4 | return myString.map { $0.asciiValue! < 108 ? "l" : String($0) }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/길이에 따른 연산.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num_list:[Int]) -> Int { 4 | return num_list.count > 10 ? num_list.reduce(0, +) : num_list.reduce(1, *) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 잘라서 정렬하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ myString:String) -> [String] { 4 | return myString.split { $0 == "x" }.map { String($0) }.sorted() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/외계행성의 나이.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ age:Int) -> String { 4 | return "\(age)".map { String(UnicodeScalar(Int(String($0))! + 96)!) }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/진료 순서 정하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ emergency:[Int]) -> [Int] { 4 | return emergency.map { emergency.sorted(by: >).firstIndex(of: $0)! + 1 } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/최댓값 만들기 (1).swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ numbers:[Int]) -> Int { 4 | let numbers = numbers.sorted(by: >) 5 | return numbers[0] * numbers[1] 6 | } 7 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1085_직사각형에서 탈출.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let x = input[0], y = input[1], w = input[2], h = input[3] 3 | print(min(x, y, w - x, h - y)) 4 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10569_다면체.swift: -------------------------------------------------------------------------------- 1 | let t = Int(readLine()!)! 2 | for _ in 0.. Int { 4 | return array.map { String($0) }.joined().map { String($0) }.filter { $0 == "7" }.count 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/a와 b 출력하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let n = readLine()!.components(separatedBy: [" "]).map { Int($0)! } 4 | let (a, b) = (n[0], n[1]) 5 | 6 | print("a = \(a)\nb = \(b)") 7 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 묶기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ strArr:[String]) -> Int { 4 | return Dictionary(strArr.map { ($0.count, 1) }, uniquingKeysWith: +).values.max()! 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/원하는 문자열 찾기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ myString:String, _ pat:String) -> Int { 4 | return myString.uppercased().contains(pat.uppercased()) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/이진수 더하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ bin1:String, _ bin2:String) -> String { 4 | return String(Int(bin1, radix: 2)! + Int(bin2, radix: 2)!, radix: 2) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/특정 문자 제거하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ letter:String) -> String { 4 | return my_string.components(separatedBy: letter).joined() 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1000_A+B.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let line = readLine()! 3 | let lineArr = line.components(separatedBy: " ") 4 | let a = Int(lineArr[0])! 5 | let b = Int(lineArr[1])! 6 | print(a + b) 7 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1001_A-B.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let line = readLine()! 3 | let lineArr = line.components(separatedBy: " ") 4 | let a = Int(lineArr[0])! 5 | let b = Int(lineArr[1])! 6 | print(a - b) 7 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10935_A + B - 6.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | 3 | for _ in 0.. Int { 4 | return (array + [height]).sorted { $0 > $1 }.firstIndex(of: height)! 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 정렬하기 (1).swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String) -> [Int] { 4 | return my_string.filter { $0.isNumber }.map { Int(String($0))! }.sorted(by: <) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/원소들의 곱과 합.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ num_list:[Int]) -> Int { 4 | return num_list.reduce(0, +) * num_list.reduce(0, +) > num_list.reduce(1, *) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/할 일 목록.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ todo_list:[String], _ finished:[Bool]) -> [String] { 4 | return zip(todo_list, finished).filter { !$0.1 }.map { $0.0 } 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10998_AXB.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let line = readLine()! 3 | let lineArr = line.components(separatedBy: " ") 4 | let a = Int(lineArr[0])! 5 | let b = Int(lineArr[1])! 6 | print(a * b) 7 | -------------------------------------------------------------------------------- /BOJ/12000 ~ 12999/12833_XORXORXOR.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | var a = input[0] 3 | let b = input[1] 4 | for _ in 0.. b ? "Subway" : "Bus") 4 | -------------------------------------------------------------------------------- /BOJ/28000 ~ 28999/28235_코드마스터 2023.swift: -------------------------------------------------------------------------------- 1 | let dict = [ 2 | "SONGDO": "HIGHSCHOOL", 3 | "CODE": "MASTER", 4 | "2023": "0611", 5 | "ALGORITHM": "CONTEST" 6 | ] 7 | print(dict[readLine()!]) 8 | 9 | -------------------------------------------------------------------------------- /BOJ/30000 ~ 30999/30501_관공... 어찌하여 목만 오셨소....swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let t = Int(readLine()!)! 3 | for _ in 0.. [Int] { 4 | return num_list.enumerated().filter { $0.offset % n == 0 }.map { $0.element } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 바꿔서 찾기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ myString:String, _ pat:String) -> Int { 4 | return String(myString.map { $0 == "A" ? "B" : "A" }).contains(pat) ? 1 : 0 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/삼각형의 완성조건 (1).swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ sides:[Int]) -> Int { 4 | let sides = sides.sorted(by: >) 5 | return sides[0] >= sides[1] + sides[2] ? 2 : 1 6 | } 7 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1008_A 나누기 B.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let line = readLine()! 3 | let lineArr = line.components(separatedBy: " ") 4 | let a = Double(lineArr[0])! 5 | let b = Double(lineArr[1])! 6 | print(a / b) 7 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11312_삼각 무늬 - 2.swift: -------------------------------------------------------------------------------- 1 | for _ in 0.. $1 + $0 } 3 | print(nums[0] == "0" ? "0" : nums.reduce("", +)) 4 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2292_벌집.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var step = 6 3 | var i = 1 4 | var start = 1 5 | while start < n { 6 | step = 6 * i 7 | start += step 8 | i += 1 9 | } 10 | print(i) 11 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2745_진법 변환.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let input = readLine()!.split(separator: " ").map { String($0) } 4 | let str = input[0] 5 | let num = Int(input[1])! 6 | 7 | print(Int(str, radix: num)!) 8 | -------------------------------------------------------------------------------- /BOJ/26000 ~ 26999/26531_Simple Sum.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { String($0) } 2 | let a = Int(input[0])!, b = Int(input[2])!, c = Int(input[4])! 3 | print(a + b == c ? "YES" : "NO") 4 | 5 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27262_Лифт.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let n = input[0], k = input[1], a = input[2], b = input[3] 3 | print(abs(1 - k) * b + (n - 1) * b, (n - 1) * a) 4 | -------------------------------------------------------------------------------- /BOJ/28000 ~ 28999/28097_모범생 포닉스.swift: -------------------------------------------------------------------------------- 1 | let t = Int(readLine()!)! 2 | let times = readLine()!.split(separator: " ").map { Int($0)! } 3 | let sum = times.reduce(0, +) + (t - 1) * 8 4 | print(sum / 24, sum % 24) 5 | 6 | -------------------------------------------------------------------------------- /BOJ/9000 ~ 9999/9699_RICE SACK.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | 3 | for i in 1...n { 4 | let input = readLine()!.split(separator: " ").map { Int($0)! } 5 | print("Case #\(i): \(input.max()!)") 6 | } 7 | -------------------------------------------------------------------------------- /Programmers/Level 0/2의 영역.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[Int]) -> [Int] { 4 | return arr.firstIndex(of: 2) == nil ? [-1] : Array(arr[arr.firstIndex(of: 2)!...arr.lastIndex(of: 2)!]) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/A 강조하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ myString:String) -> String { 4 | return myString.map { $0 == "a" || $0 == "A" ? $0.uppercased() : $0.lowercased() }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/k의 개수.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ i:Int, _ j:Int, _ k:Int) -> Int { 4 | return (i...j).map { String($0) }.reduce("", +).filter { $0 == Character("\(k)") }.count 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/문자열 반복해서 출력하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let inp = readLine()!.components(separatedBy: [" "]).map { $0 } 4 | let (s1, a) = (inp[0], Int(inp[1])!) 5 | print(String(repeating: s1, count: a)) 6 | -------------------------------------------------------------------------------- /Programmers/Level 2/최댓값과 최솟값.swift: -------------------------------------------------------------------------------- 1 | func solution(_ s:String) -> String { 2 | let num = s.split(separator: " ").map { Int($0)! } 3 | var answer = "\(num.min()!) \(num.max()!)" 4 | return answer 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/13000 ~ 13999/13235_팰린드롬.swift: -------------------------------------------------------------------------------- 1 | func isPalindrome(_ word: String) -> Bool { 2 | return word == String(word.reversed()) 3 | } 4 | 5 | let word = readLine()! 6 | isPalindrome(word) ? print("true") : print("false") 7 | -------------------------------------------------------------------------------- /BOJ/13000 ~ 13999/13985_Equality.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = readLine()!.compactMap{ Int(String($0)) } 3 | if input[2] == (input[0] + input[1]){ 4 | print("YES") 5 | } else { 6 | print("NO") 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14215_세 막대.swift: -------------------------------------------------------------------------------- 1 | var tri = readLine()!.split(separator: " ").map { Int($0)! } 2 | tri.sort() 3 | if tri[2] >= tri[0] + tri[1] { 4 | tri[2] = tri[0] + tri[1] - 1 5 | } 6 | print(tri.reduce(0, +)) 7 | -------------------------------------------------------------------------------- /BOJ/16000 ~ 16999/16212_정열적인 정렬.swift: -------------------------------------------------------------------------------- 1 | let t = Int(readLine()!)! 2 | let nums = readLine()!.split(separator: " ").map { Int(String($0))! } 3 | 4 | for num in nums.sorted() { 5 | print(num, terminator: " ") 6 | } 7 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2752_세수정렬.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | var input = readLine()!.split(separator: " ").map { Int($0)! } 3 | input = input.sorted() 4 | for i in 0..) 6 | print(input[2]) 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/21000 ~ 21999/21300_Bottle Return.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = readLine()!.components(separatedBy: " ").map{Int($0)!} 3 | var sum = 0 4 | for i in 0..<6{ 5 | sum += input[i] 6 | } 7 | print(sum * 5) 8 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27328_三方比較 (Three-Way Comparison).swift: -------------------------------------------------------------------------------- 1 | let a = Int(readLine()!)! 2 | let b = Int(readLine()!)! 3 | 4 | if a < b { 5 | print(-1) 6 | } else if a > b { 7 | print(1) 8 | } else { 9 | print(0) 10 | } -------------------------------------------------------------------------------- /BOJ/29000 ~ 29999/29766_DKSH 찾기.swift: -------------------------------------------------------------------------------- 1 | let s = readLine()!.map { $0 } 2 | var count = 0 3 | for i in 0.. Int { 4 | return arr.enumerated().first { $0.element == 1 && $0.offset > idx }.map { $0.offset } ?? -1 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/암호 해독.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ cipher:String, _ code:Int) -> String { 4 | return String(cipher.enumerated().filter { $0.offset + 1 % code == 0 }.map { $0.element }) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/주사위 게임 1.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ a:Int, _ b:Int) -> Int { 4 | return a % 2 == 1 && b % 2 == 1 ? a * a + b * b : a % 2 == 1 || b % 2 == 1 ? 2 * (a + b) : abs(a - b) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 1/나누어 떨어지는 숫자 배열.swift: -------------------------------------------------------------------------------- 1 | func solution(_ arr:[Int], _ divisor:Int) -> [Int] { 2 | return arr.filter { $0 % divisor == 0 }.sorted().count == 0 ? [-1] : arr.filter { $0 % divisor == 0 }.sorted() 3 | } 4 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1748_수 이어쓰기 1.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | var n = Int(readLine()!)! 3 | var i = 1 4 | var result = 0 5 | 6 | while i <= n { 7 | result += (n - i + 1) 8 | i = i * 10 9 | } 10 | print(result) 11 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11320_삼각 무늬 - 1.swift: -------------------------------------------------------------------------------- 1 | for _ in 0.. = Set(["I", "O", "S", "H", "Z", "X", "N"]) 3 | print(words == letters ? "YES" : "NO") 4 | -------------------------------------------------------------------------------- /BOJ/8000 ~ 8999/8674_Tabliczka.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | if input[0] % 2 == 0 || input[1] % 2 == 0 { 3 | print(0) 4 | } else { 5 | print(min(input[0], input[1])) 6 | } 7 | -------------------------------------------------------------------------------- /Programmers/Level 0/qr code.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ q:Int, _ r:Int, _ code:String) -> String { 4 | return code.enumerated().filter { $0.offset % q == r }.map { String($0.element) }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/글자 이어 붙여 문자열 만들기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ index_list:[Int]) -> String { 4 | return index_list.reduce("") { $0 + my_string.map { String($0) }[$1] } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/수열과 구간 쿼리 3.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[Int], _ queries:[[Int]]) -> [Int] { 4 | var arr = arr 5 | queries.forEach { array.swapAt($0[0], $0[1]) } 6 | return arr 7 | } 8 | -------------------------------------------------------------------------------- /Programmers/Level 1/x만큼 간격이 있는 n개의 숫자.swift: -------------------------------------------------------------------------------- 1 | func solution(_ x:Int, _ n:Int) -> [Int64] { 2 | var result: [Int64] = [] 3 | for i in 1...n { 4 | result.append(Int64(x * i)) 5 | } 6 | return result 7 | } 8 | -------------------------------------------------------------------------------- /Programmers/Level 1/수박수박수박수박수박수?.swift: -------------------------------------------------------------------------------- 1 | func solution(_ n:Int) -> String { 2 | var result = "" 3 | (0.. [Int] { 2 | var result = arr 3 | result.remove(at: result.firstIndex(of: result.min()!)!) 4 | return result.count == 0 ? [-1] : result 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1259_팰린드롬수.swift: -------------------------------------------------------------------------------- 1 | func isPalindrome(n: String) -> Bool { 2 | return n == String(n.reversed()) 3 | } 4 | 5 | while let n = readLine(), n != "0" { 6 | isPalindrome(n: n) ? print("yes") : print("no") 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10833_사과.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var sum = 0 3 | for _ in 0..= time + 1 { 6 | print(0) 7 | } else { 8 | print(1) 9 | } 10 | -------------------------------------------------------------------------------- /BOJ/29000 ~ 29999/29751_삼각형.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let input = readLine()!.split(separator: " ").map { Double($0)! } 4 | let w = input[0], h = input[1] 5 | let area = w * h / 2 6 | print(String(format: "%.1f", area)) 7 | -------------------------------------------------------------------------------- /BOJ/5000 ~ 5999/5013_Death Knight Hero.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let n = Int(readLine()!)! 4 | var answer = 0 5 | for _ in 0.. = [] 3 | str.forEach { set.insert($0) } 4 | set.remove(" ") 5 | set.count == 26 ? print("Y") : print("N") 6 | } 7 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열 만들기 5.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ intStrs:[String], _ k:Int, _ s:Int, _ l:Int) -> [Int] { 4 | return intStrs.map { Int(String($0.map { $0 }[s.. k } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/짝수의 합.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | var answer = 0 5 | for i in 0...n { 6 | if i % 2 == 0 { answer += i } 7 | } 8 | return answer 9 | } 10 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1568_새.swift: -------------------------------------------------------------------------------- 1 | var n = Int(readLine()!)! 2 | var k = 0, time = 0 3 | while true { 4 | k += 1 5 | if n == 0 { break } 6 | if n < k { k = 1 } 7 | n -= k 8 | time += 1 9 | } 10 | print(time) 11 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11648_지속.swift: -------------------------------------------------------------------------------- 1 | var num = readLine()! 2 | var answer = 0 3 | while num.count != 1 { 4 | let nums = num.map { Int(String($0))! }.reduce(1, *) 5 | num = String(nums) 6 | answer += 1 7 | } 8 | print(answer) 9 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11931_수 정렬하기.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var nums: [Int] = [] 3 | for _ in 0..) 7 | for i in 0.. = [ 2 | "q", "w", "e", "r", "t", "a", "s", "d", "f", "g", "z", "x", "c", "v" 3 | ] 4 | 5 | let s = readLine()! 6 | print(set.contains(readLine()!.last!) ? 1 : 0) 7 | -------------------------------------------------------------------------------- /BOJ/26000 ~ 26999/26040_특정 대문자를 소문자로 바꾸기.swift: -------------------------------------------------------------------------------- 1 | let str = readLine()!.map { String($0) } 2 | let uppers = readLine()!.split(separator: " ").map { String($0) } 3 | print(str.map { uppers.contains($0) ? $0.lowercased() : $0 }.joined()) 4 | -------------------------------------------------------------------------------- /BOJ/27000 ~ 27999/27267_Сравнение комнат.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split { $0 == " " }.map { Int($0)! } 2 | let a = input[0], b = input[1], c = input[2], d = input[3] 3 | print(a * b == c * d ? "E" : a * b > c * d ? "M" : "P") 4 | -------------------------------------------------------------------------------- /BOJ/30000 ~ 30999/30468_호반우가 학교에 지각한 이유 1.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let s = input[0], d = input[1], i = input[2], l = input[3], n = input[4] 3 | print(max(0, n * 4 - (s + d + i + l))) 4 | -------------------------------------------------------------------------------- /BOJ/30000 ~ 30999/30792_gahui and sousenkyo 2.swift: -------------------------------------------------------------------------------- 1 | readLine(); 2 | let score = Int(readLine()!)! 3 | let array = (readLine()!.split{ $0 == " " }.map{ Int($0)! } + [score]).sorted(by: >) 4 | print(array.firstIndex(of: score)! + 1) 5 | -------------------------------------------------------------------------------- /BOJ/6000 ~ 6999/6794_What is n, Daddy?.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var answer = 0 3 | 4 | for i in 0...5 { 5 | for j in i...5 { 6 | if i + j == n { answer += 1 } 7 | } 8 | } 9 | 10 | print(answer) 11 | -------------------------------------------------------------------------------- /Programmers/Level 0/글자 지우기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ myString: String, _ indices:[Int]) -> String { 4 | return String(myString.enumerated().filter { !indices.contains($0.offset) }.map { $0.element }) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/로그인 성공?.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ id_pw:[String], _ db:[[String]]) -> String { 4 | return db.contains(id_pw) ? "login" : db.map { $0[0] }.contains(id_pw[0]) ? "wrong pw" : "fail" 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/제곱수 판별하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | for i in 1...100000 { 5 | if i * i == n { 6 | return 1 7 | } 8 | } 9 | return 2 10 | } 11 | -------------------------------------------------------------------------------- /Programmers/Level 0/특정한 문자를 대문자로 바꾸기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_string:String, _ alp:String) -> String { 4 | return my_string.map { String($0) == alp ? $0.uppercased() : $0.lowercased() }.joined() 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 1/자연수 뒤집어 배열로 만들기.swift: -------------------------------------------------------------------------------- 1 | func solution(_ n:Int64) -> [Int] { 2 | var result: [Int] = [] 3 | for num in String(n).reversed() { 4 | result.append(Int(String(num))!) 5 | } 6 | return result 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1712_손익분기점.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = readLine()!.split(separator: " ").map { Int($0)! } 3 | 4 | if input[1] >= input[2]{ 5 | print(-1) 6 | } else { 7 | print(input[0] / (input[2]-input[1]) + 1) 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14545_Square.swift: -------------------------------------------------------------------------------- 1 | let t = Int(readLine()!)! 2 | 3 | for _ in 0.. 9 { 6 | print("happy") 7 | } else { 8 | print("sad") 9 | } 10 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2753_윤년.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let year = Int(readLine()!)! 3 | 4 | if year % 4 == 0 && year % 100 != 0{ 5 | print(1) 6 | } else if year % 400 == 0{ 7 | print(1) 8 | } else{ 9 | print(0) 10 | } 11 | -------------------------------------------------------------------------------- /BOJ/23000 ~ 23999/23235_The Fastest Sorting Algorithm In The World.swift: -------------------------------------------------------------------------------- 1 | var i = 1 2 | while let input = readLine() { 3 | if input == "0" { 4 | break 5 | } 6 | print("Case \(i): Sorting... done!") 7 | i += 1 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/23000 ~ 23999/23795_사장님 도박은 재미로 하셔야 합니다.swift: -------------------------------------------------------------------------------- 1 | var sum = 0 2 | while let input = Int(readLine()!) { 3 | if input == -1 { 4 | print(sum) 5 | break 6 | } else { 7 | sum += input 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24723_녹색거탑.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | func powN(_ n: Int) -> Int { 3 | var answer = 1 4 | for _ in 0..) 4 | print(array[k - 1]) 5 | -------------------------------------------------------------------------------- /BOJ/29000 ~ 29999/29986_Altura Mínima.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let n = input[0], target = input[1] 3 | print(readLine()!.split(separator: " ").map { Int($0)! }.filter { $0 <= target }.count) 4 | -------------------------------------------------------------------------------- /BOJ/4000 ~ 4999/4562_No Brainer.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | 3 | for _ in 0.. [String] { 4 | return strArr.enumerated().map { $0.offset % 2 == 0 ? $0.element.lowercased() : $0.element.uppercased() } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열의 길이를 2의 거듭제곱으로 만들기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ arr:[Int]) -> [Int] { 4 | return arr + [Int](repeating: 0, count: (0...10).map { 1 << $0 }.filter { $0 >= arr.count }.first! - arr.count) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/피자 나눠 먹기 (2).swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | for i in 1...n { 5 | if i * 6 % n == 0 { 6 | return i 7 | } 8 | } 9 | return 0 10 | } 11 | -------------------------------------------------------------------------------- /Programmers/Level 1/내적.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ a:[Int], _ b:[Int]) -> Int { 4 | var result = 0 5 | for i in 0.. Int { 4 | if n < 2 { 5 | return n 6 | } 7 | return fibo(n: n - 2) + fibo(n: n - 1) 8 | } 9 | print(fibo(n: input)) 10 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10872 팩토리얼.swift: -------------------------------------------------------------------------------- 1 | let input = Int(readLine()!)! 2 | 3 | func factorial(n : Int) -> Int { 4 | if n == 0 { 5 | return 1 6 | } 7 | return n * factorial(n: n - 1) 8 | } 9 | print(factorial(n: input)) 10 | -------------------------------------------------------------------------------- /BOJ/13000 ~ 13999/13877_이건 무슨 진법이지?.swift: -------------------------------------------------------------------------------- 1 | for _ in 0.. String { 4 | return stride(from: c - 1, to: myString.count, by: m).map { myString.map { String($0) }[$0] }.reduce("", +) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/직사각형 넓이 구하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ dots:[[Int]]) -> Int { 4 | let x = dots.map { $0[0] } 5 | let y = dots.map { $0[1] } 6 | return (x.max()! - x.min()!) * (y.max()! - y.min()!) 7 | } 8 | -------------------------------------------------------------------------------- /Programmers/Level 0/최댓값 만들기 (2).swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ numbers:[Int]) -> Int { 4 | let numbers = numbers.sorted(by: >) 5 | return max(numbers[0] * numbers[1], numbers[numbers.count - 2] * numbers.last!) 6 | } 7 | -------------------------------------------------------------------------------- /Programmers/Level 0/홀짝에 따라 다른 값 반환하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | return n % 2 == 0 ? (1...n).filter { $0 % 2 == 0 }.map { $0 * $0 }.reduce(0, +) : (1...n).filter { $0 % 2 == 1 }.reduce(0, +) 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 1/나머지가 1이 되는 수 찾기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> Int { 4 | for i in 1.. [String] { 2 | return strings.sorted { $0 < $1 }.sorted { $0[$0.index($0.startIndex, offsetBy: n)] < $1[$1.index($1.startIndex, offsetBy: n)] } 3 | } 4 | -------------------------------------------------------------------------------- /Programmers/Level 1/짝수와 홀수.swift: -------------------------------------------------------------------------------- 1 | func solution(_ num:Int) -> String { 2 | if num == 0 { 3 | return "Even" 4 | } else if num % 2 == 0 { 5 | return "Even" 6 | } else { 7 | return "Odd" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BOJ/13000 ~ 13999/13752_히스토그램.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | for _ in 0.. 30 { 7 | print("Red") 8 | } else { 9 | print("Yellow") 10 | } 11 | -------------------------------------------------------------------------------- /BOJ/25000 ~ 25999/25756_방어율 무시 계산하기.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let a = readLine()!.split(separator: " ").map { Double($0)! } 3 | var v: Double = 0 4 | 5 | for i in 0.. Int { 4 | return zip((0.. String { 4 | var myString = my_string.map { $0 } 5 | myString.swapAt(num1, num2) 6 | return String(myString) 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10987_모음의 개수.swift: -------------------------------------------------------------------------------- 1 | let str = readLine()! 2 | var count = 0 3 | for i in str { 4 | switch i { 5 | case "a","e","i","o","u": 6 | count += 1 7 | default: 8 | continue 9 | } 10 | } 11 | print(count) 12 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14495_피보나치 비스무리한 수열.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var fibo = [Int](repeating: 0, count: 117) 3 | fibo[1] = 1; fibo[2] = 1; fibo[3] = 1; 4 | for i in 4...116 { 5 | fibo[i] = fibo[i - 3] + fibo[i - 1] 6 | } 7 | print(fibo[n]) 8 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14645_와이버스 부릉부릉.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let num = readLine()!.components(separatedBy: " ").map{ Int($0)! } 3 | for _ in 0.. 100 { 5 | print(-1) 6 | } else if result < 100 { 7 | print(1) 8 | } else { 9 | print(0) 10 | } 11 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24387_ИЗЛОЖЕНИЕ НА ПЧЕЛЕН МЕД.swift: -------------------------------------------------------------------------------- 1 | let a = readLine()!.split(separator: " ").map { Int($0)! }.sorted(by: <) 2 | let b = readLine()!.split(separator: " ").map { Int($0)! }.sorted(by: <) 3 | print(a[0] * b[0] + a[1] * b[1] + a[2] * b[2]) 4 | -------------------------------------------------------------------------------- /BOJ/26000 ~ 26999/26332_Buying in Bulk.swift: -------------------------------------------------------------------------------- 1 | for _ in 0.. [String] { 4 | return picture.map { $0.map { String(repeating: $0, count: k) }.joined() }.flatMap { Array(repeating: $0, count: k) } 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열 회전시키기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ numbers:[Int], _ direction:String) -> [Int] { 4 | return direction == "left" ? numbers[1...] + [numbers.first!] : [numbers.last!] + numbers[0.. [String] { 4 | let answer = myStr.components(separatedBy: ["a", "b", "c"]).filter { !$0.isEmpty } 5 | return answer.isEmpty ? ["EMPTY"] : answer 6 | } 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 알고리즘 문제풀이 2 | - Swift 언어를 사용하여 문제 푸는것을 연습합니다. (생성일 2021.06.10) 3 | ----------- 4 | 5 | * BOJ (백준 온라인 저지) 6 | * Programmers (프로그래머스) 7 | * swift 문법 8 | * 스위프트 프로그래밍 (3판) 야곰 책으로 진행 9 | * 이것이 코딩테스트다 10 | * 파이썬으로 작성된 코드를 Swift로 해석해서 진행 -------------------------------------------------------------------------------- /이것이 코딩테스트다/ch06_정렬/위에서 아래로.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var nums: [Int] = [] 3 | for _ in 0.. $1 } 7 | 8 | for num in nums { 9 | print(num, terminator:" ") 10 | } 11 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10797_10부제.swift: -------------------------------------------------------------------------------- 1 | let num = Int(readLine()!)! 2 | let input = readLine()!.split(separator: " ").map { Int($0)! } 3 | var cnt = 0 4 | for i in 0..<5{ 5 | if input[i] == num{ 6 | cnt += 1 7 | } 8 | } 9 | print(cnt) 10 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10950_A + B - 3.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let n = Int(readLine()!)! 3 | for _ in 1...n{ 4 | let input = readLine()!.components(separatedBy: " ") 5 | let a = Int(input[0])! 6 | let b = Int(input[1])! 7 | print(a + b) 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17350_2루수 이름이 뭐야.swift: -------------------------------------------------------------------------------- 1 | var anj = false 2 | for _ in 0.. 2 { 6 | for i in 3...n { 7 | dp[i] = dp[i - 1] + dp[i - 2] 8 | } 9 | } 10 | print(dp[n]) 11 | -------------------------------------------------------------------------------- /BOJ/13000 ~ 13999/13771_Presents.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | let n = Int(readLine()!)! 4 | var prices = [Double]() 5 | for _ in 0.. input[1] - input[0] { 4 | print(input[2] - input[1] - 1) 5 | } else { 6 | print(input[1] - input[0] - 1) 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/21000 ~ 21999/21212_Cakes.swift: -------------------------------------------------------------------------------- 1 | var answer = Int.max 2 | for _ in 0.. Int { 2 | return num * num * num * num * num 3 | } 4 | 5 | let n = readLine()! 6 | var sum = 0 7 | 8 | for i in n { 9 | sum += five_pow(Int(String(i))!) 10 | } 11 | print(sum) 12 | -------------------------------------------------------------------------------- /BOJ/25000 ~ 25999/25372_성택이의 은밀한 비밀번호.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | for _ in 0.. 5 && word.count < 10 { 5 | print("yes") 6 | } else { 7 | print("no") 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BOJ/30000 ~ 30999/30822_UOSPC 세기.swift: -------------------------------------------------------------------------------- 1 | _ = readLine(); 2 | let dict = Dictionary(readLine()!.map { ($0, 1) }, uniquingKeysWith: +) 3 | print(min(dict["u", default: 0], dict["o", default: 0], dict["s", default: 0], dict["p", default: 0], dict["c", default: 0])) 4 | -------------------------------------------------------------------------------- /BOJ/9000 ~ 9999/9243_파일 완전 삭제.swift: -------------------------------------------------------------------------------- 1 | let isEven = Int(readLine()!)! % 2 == 0 2 | let before = String(readLine()!.map { isEven ? $0 : $0 == "0" ? "1" : "0" }) 3 | let after = readLine()! 4 | before == after ? print("Deletion succeeded") : print("Deletion failed") 5 | -------------------------------------------------------------------------------- /Programmers/Level 0/배열 만들기 2.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ l:Int, _ r:Int) -> [Int] { 4 | let answer = (l...r).map { $0 }.filter { Set(String($0).map{ $0 }).isSubset(of: Set(["0", "5"])) } 5 | return answer.isEmpty ? [-1] : answer 6 | } 7 | -------------------------------------------------------------------------------- /Programmers/Level 0/옷가게 할인 받기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ price:Int) -> Int { 4 | return price >= 100_000 ? price >= 300_000 ? price >= 500_000 ? Int(Double(price) * 0.8) : Int(Double(price) * 0.9) : Int(Double(price) * 0.95) : price 5 | } 6 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10174_팰린드롬.swift: -------------------------------------------------------------------------------- 1 | func isPalindrome(str: String) -> Bool { 2 | return str == String(str.reversed()) 3 | } 4 | 5 | let n = Int(readLine()!)! 6 | for _ in 0..= 0 } 3 | if array.isEmpty { 4 | print(0) 5 | } else { 6 | print(array.reduce(0, +) / Double(array.count)) 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17294_귀여운 수~ε٩(๑> ₃ <)۶з.swift: -------------------------------------------------------------------------------- 1 | let nums = readLine()!.map { Int(String($0))! } 2 | var d: Set = [] 3 | for i in 0..") 7 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17863_FYI.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | var num = readLine()! 3 | let numRange = num.index(num.startIndex, offsetBy: 0) ... num.index(num.startIndex, offsetBy: 2) 4 | if num[numRange] == "555"{ 5 | print("YES") 6 | } else{ 7 | print("NO") 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/18000 ~ 18999/18398_HOMWRK.swift: -------------------------------------------------------------------------------- 1 | for _ in 0..= 2 { 7 | break 8 | } 9 | } 10 | print("\(x):\(y)") 11 | -------------------------------------------------------------------------------- /BOJ/3000 ~ 3999/3062_수 뒤집기.swift: -------------------------------------------------------------------------------- 1 | for _ in 0.. m / 2 ? 1 : 0 6 | } 7 | print(answer) 8 | -------------------------------------------------------------------------------- /BOJ/6000 ~ 6999/6825_Body Mass Index.swift: -------------------------------------------------------------------------------- 1 | let w = Double(readLine()!)! 2 | let h = Double(readLine()!)! 3 | let bmi = w / (h * h) 4 | if bmi > 25 { print("Overweight") } 5 | else if bmi >= 18.5 && bmi <= 25 { print("Normal weight") } 6 | else { print("Underweight") } 7 | -------------------------------------------------------------------------------- /BOJ/8000 ~ 8999/8387_Dyslexia.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let word1 = readLine()!.map { $0 } 3 | let word2 = readLine()!.map { $0 } 4 | var answer = 0 5 | 6 | for i in 0.. Int { 4 | var answer = 0 5 | for number in numbers where answer <= n { 6 | answer += number 7 | } 8 | return answer 9 | } 10 | -------------------------------------------------------------------------------- /Programmers/Level 0/날짜 비교하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ date1:[Int], _ date2:[Int]) -> Int { 4 | let d1 = date1[0] * 360 + date1[1] * 30 + date1[2] 5 | let d2 = date2[0] * 360 + date2[1] * 30 + date2[2] 6 | return d1 < d2 ? 1 : 0 7 | } 8 | -------------------------------------------------------------------------------- /Programmers/Level 1/부족한 금액 계산하기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ price:Int, _ money:Int, _ count:Int) -> Int64{ 4 | return Int64(money - (price * (count * (count + 1)) / 2)) > 0 ? 0 : Int64(money - (price * (count * (count + 1)) / 2)) * -1 5 | } 6 | -------------------------------------------------------------------------------- /Programmers/Level 1/서울에서 김서방 찾기.swift: -------------------------------------------------------------------------------- 1 | func solution(_ seoul:[String]) -> String { 2 | var idx = 0 3 | for i in 0..= 0 }.max() ?? 0 5 | } 6 | print(result) 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/14000 ~ 14999/14489_치킨 두 마리 (...).swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let chicken = Int(readLine()!)! * 2 3 | let sum = input.reduce(0, +) 4 | if sum >= chicken { 5 | print(sum - chicken) 6 | } else { 7 | print(sum) 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/15000 ~ 15999/15726_이칙연산.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let input = readLine()!.split(separator: " ").map { Double($0)! } 3 | var result = [0.0, 0.0] 4 | result[0] = input[0] * input[1] / input[2] 5 | result[1] = input[0] / input[1] * input[2] 6 | print(Int(result.max()!)) 7 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17614_369.swift: -------------------------------------------------------------------------------- 1 | let nums = Int(readLine()!)! 2 | var count = 0 3 | for num in 1...nums { 4 | for i in String(num) { 5 | if i == "3" || i == "6" || i == "9" { 6 | count += 1 7 | } 8 | } 9 | } 10 | print(count) 11 | -------------------------------------------------------------------------------- /BOJ/19000 ~ 19999/19944_뉴비의 기준은 뭘까?.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | if input[1] < 3 { 3 | print("NEWBIE!") 4 | } else if input[1] > 2 && input[1] <= input[0] { 5 | print("OLDBIE!") 6 | } else { 7 | print("TLE!") 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2442_별 찍기 - 5.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | for i in 1...n { 3 | for _ in i.. 2000.0{ 5 | pay = 2000.0 6 | } 7 | if pay < 100.0 { 8 | pay = 100.0 9 | } 10 | print(String(format: "%.2f", pay)) 11 | -------------------------------------------------------------------------------- /BOJ/21000 ~ 21999/21657_숫자의 개수 2.swift: -------------------------------------------------------------------------------- 1 | let a = Int(readLine()!)! 2 | let b = Int(readLine()!)! 3 | let c = Int(readLine()!)! 4 | let dict = Dictionary("\(a*b*c)".map { (String($0), 1) }, uniquingKeysWith: +) 5 | for i in 0...9 { 6 | print(dict["\(i)", default: 0]) 7 | } 8 | -------------------------------------------------------------------------------- /BOJ/23000 ~ 23999/23080_스키테일 암호.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | let password = readLine()!.map { $0 } 3 | var index = 0 4 | var answer = "" 5 | while index < password.count { 6 | answer += String(password[index]) 7 | index += n 8 | } 9 | print(answer) 10 | -------------------------------------------------------------------------------- /BOJ/23000 ~ 23999/23343_JavaScript.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { String($0) } 2 | let word1 = input[0], word2 = input[1] 3 | 4 | if let num1 = Int(word1), let num2 = Int(word2) { 5 | print(num1 - num2) 6 | } else { 7 | print("NaN") 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/24000 ~ 24999/24356_ЧАСОВНИК.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let t1 = input[0], m1 = input[1], t2 = input[2], m2 = input[3] 3 | var time = (t2 - t1) * 60 + (m2 - m1) 4 | if time < 0 { time += 1440 } 5 | print(time, time / 30) 6 | -------------------------------------------------------------------------------- /BOJ/28000 ~ 28999/28490_Area.swift: -------------------------------------------------------------------------------- 1 | let t = Int(readLine()!)! 2 | var answer = 0 3 | for _ in 0..= 0 ? print(1) : print(0) 7 | -------------------------------------------------------------------------------- /BOJ/25000 ~ 25999/25784_Easy-to-Solve Expressions.swift: -------------------------------------------------------------------------------- 1 | let nums = readLine()!.split(separator: " ").map { Int($0)! }.sorted() 2 | if nums[0] + nums[1] == nums[2] { 3 | print(1) 4 | } else if nums[0] * nums[1] == nums[2] { 5 | print(2) 6 | } else { 7 | print(3) 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31821_학식 사주기.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var a: [Int] = [] 3 | for _ in 0.. [Int] { 4 | var answer = [Int](repeating: 0, count: 52) 5 | myString.forEach { answer[Int($0.asciiValue! - ($0.isUppercase ? 65 : 71))] += 1 } 6 | return answer 7 | } 8 | -------------------------------------------------------------------------------- /Programmers/Level 0/한 번만 등장한 문자.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ s:String) -> String { 4 | let dict = Dictionary(s.map { ($0, 1) }, uniquingKeysWith: +) 5 | let answer = String(dict.filter { $0.value == 1 }.keys.sorted(by: <)) 6 | return answer 7 | } 8 | -------------------------------------------------------------------------------- /이것이 코딩테스트다/ch03_그리디/거스름돈.swift: -------------------------------------------------------------------------------- 1 | var n = 1260 2 | var count = 0 3 | 4 | // 큰 단위의 화폐부터 차례대로 확인 5 | var coinType = [500, 100, 50, 10] 6 | 7 | for coin in coinType { 8 | count += n / coin // 해당 화폐로 거슬러 줄 수 있는 동전의 개수 세기 9 | n %= coin 10 | } 11 | 12 | print(count) 13 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10773_제로.swift: -------------------------------------------------------------------------------- 1 | var stack: [Int] = [] 2 | for _ in 0..= n / 2 + 1 { 7 | print("Junhee is cute!") 8 | } else { 9 | print("Junhee is not cute!") 10 | } 11 | -------------------------------------------------------------------------------- /BOJ/12000 ~ 12999/12780_원피스.swift: -------------------------------------------------------------------------------- 1 | let h = readLine()!.map { $0 } 2 | let n = readLine()! 3 | let c = n.count 4 | 5 | var answer = 0 6 | 7 | for i in 0...h.count - c { 8 | if String(h[i..= y{ 7 | break 8 | } 9 | cnt += 1 10 | } 11 | print(cnt) 12 | -------------------------------------------------------------------------------- /BOJ/15000 ~ 15999/15781_헬멧과 조끼.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let helmet = readLine()!.split(separator: " ").map { Int($0)! } 3 | let jacket = readLine()!.split(separator: " ").map { Int($0)! } 4 | 5 | print(helmet.max()! + jacket.max()!) 6 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17869_Simple Collatz Sequence.swift: -------------------------------------------------------------------------------- 1 | var n = Int(readLine()!)! 2 | var count = 0 3 | while true { 4 | if n == 1 { 5 | break 6 | } else { 7 | n = n % 2 == 0 ? n / 2 : n + 1 8 | count += 1 9 | } 10 | } 11 | print(count) 12 | -------------------------------------------------------------------------------- /BOJ/18000 ~ 18999/18127_모형결정.swift: -------------------------------------------------------------------------------- 1 | let input = readLine()!.split(separator: " ").map { Int($0)! } 2 | let a = input[0], b = input[1] 3 | let d = a - 2 4 | var answer = 1 5 | var step = 1 6 | for _ in 1...b { 7 | step += d 8 | answer += step 9 | } 10 | print(answer) 11 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2231_분해합.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | var num = 0 3 | for i in 1...n { 4 | let createNumber = String(i).map { Int(String($0))! }.reduce(0, +) + i 5 | if createNumber == n { 6 | num = i 7 | break 8 | } 9 | } 10 | print(num) 11 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2439_별 찍기 - 2.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | for i in 1...n{ 3 | for _ in stride(from: n, to: i, by: -1){ 4 | print(" ",terminator: "") 5 | } 6 | for _ in 1...i{ 7 | print("*",terminator: "") 8 | } 9 | print() 10 | } 11 | -------------------------------------------------------------------------------- /BOJ/2000 ~ 2999/2920_음계.swift: -------------------------------------------------------------------------------- 1 | var input = readLine()!.split(separator: " ").map { Int($0)! } 2 | 3 | if input == input.sorted() { 4 | print("ascending") 5 | } else if input == input.sorted(by: >) { 6 | print("descending") 7 | } else { 8 | print("mixed") 9 | } 10 | -------------------------------------------------------------------------------- /BOJ/31000 ~ 31999/31090_2023은 무엇이 특별할까?.swift: -------------------------------------------------------------------------------- 1 | let t = Int(readLine()!)! 2 | for _ in 0.. even ? 0 : odd < even ? 1 : -1) 9 | -------------------------------------------------------------------------------- /BOJ/8000 ~ 8999/8815_Test.swift: -------------------------------------------------------------------------------- 1 | let t = Int(readLine()!)! 2 | let answer = "BCBCDCDADABA".map { String($0) } 3 | for _ in 0.. String { 4 | return String(my_string.map { $0 }[0.. String { 4 | var myString = myString.map { $0 } 5 | myString.replaceSubrange(s...e, with: myString[s...e].reversed()) 6 | return String(myString) 7 | } 8 | -------------------------------------------------------------------------------- /Programmers/Level 0/부분 문자열 이어 붙여 문자열 만들기.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ my_strings:[String], _ parts:[[Int]]) -> String { 4 | return my_strings.enumerated().reduce("") { $0 + String($1.element.map { $0 }[parts[$1.offset][0]...parts[$1.offset][1]]) } 5 | } 6 | 7 | -------------------------------------------------------------------------------- /Programmers/Level 0/외계어 사전.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ spell:[String], _ dic:[String]) -> Int { 4 | for dic in dic { 5 | if Set(spell) == Set(dic.map { String($0) }) { 6 | return 1 7 | } 8 | } 9 | return 2 10 | } 11 | -------------------------------------------------------------------------------- /Programmers/Level 0/특별한 이차원 배열 1.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | func solution(_ n:Int) -> [[Int]] { 4 | var answer = [[Int]](repeating: [Int](repeating: 0, count: n), count: n) 5 | for i in 0.. Int { 4 | var cache = [Int](repeating: 1, count: 10) 5 | for i in 1...9 { 6 | cache[i] = (i + 1) * cache[i - 1] 7 | } 8 | return cache.filter { $0 <= n }.count 9 | } 10 | -------------------------------------------------------------------------------- /Programmers/Level 1/문자열 다루기 기본.swift: -------------------------------------------------------------------------------- 1 | func solution(_ s:String) -> Bool { 2 | if !(s.count == 4 || s.count == 6) { 3 | return false 4 | } 5 | if let isAllNumber = Int(s) { 6 | return true 7 | } else { 8 | return false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Programmers/Level 1/정수 제곱근 판별.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | func solution(_ n:Int64) -> Int64 { 3 | let result = Int64(sqrt(Double(n))) 4 | return pow(n: result) == n ? pow(n: result + 1) : -1 5 | } 6 | 7 | func pow(n: Int64) -> Int64 { 8 | return n * n 9 | } 10 | -------------------------------------------------------------------------------- /Programmers/Level 1/하샤드 수.swift: -------------------------------------------------------------------------------- 1 | func solution(_ x:Int) -> Bool { 2 | var sum = 0 3 | for i in String(x) { 4 | sum += Int(String(i)) ?? 0 5 | } 6 | if x % sum == 0 { 7 | return true 8 | } else { 9 | return false 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BOJ/1000 ~ 1999/1789_수들의 합.swift: -------------------------------------------------------------------------------- 1 | let s = Int(readLine()!)! 2 | var sum = 0 3 | if s == 1 { 4 | print(1) 5 | } else { 6 | for i in 0...s { 7 | sum += i 8 | if sum > s { 9 | print(i - 1) 10 | break 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BOJ/10000 ~ 10999/10869_사칙연산.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let line = readLine()! 3 | let lineArr = line.components(separatedBy: " ") 4 | var a = Int(lineArr[0])! 5 | var b = Int(lineArr[1])! 6 | print(a + b) 7 | print(a - b) 8 | print(a * b) 9 | print(a / b) 10 | print(a % b) 11 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11022_A+B - 8.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | let n = Int(readLine()!)! 3 | for i in 1...n{ 4 | let input = readLine()!.components(separatedBy: " ") 5 | let a = Int(input[0])! 6 | let b = Int(input[1])! 7 | print("Case #\(i): \(a) + \(b) = \(a + b)") 8 | } 9 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11726_2×n 타일링.swift: -------------------------------------------------------------------------------- 1 | var dp = [Int](repeating: 0, count: 1001) 2 | dp[1] = 1 3 | dp[2] = 2 4 | 5 | let n = Int(readLine()!)! 6 | if n > 2 { 7 | for i in 3...n { 8 | dp[i] = (dp[i - 1] + dp[i - 2]) % 10007 9 | } 10 | } 11 | 12 | print(dp[n]) 13 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11899_괄호 끼워넣기.swift: -------------------------------------------------------------------------------- 1 | let brackets = readLine()! 2 | var stack: [Character] = [] 3 | for b in brackets { 4 | if stack.last == "(" && b == ")" { 5 | stack.removeLast() 6 | } else { 7 | stack.append(b) 8 | } 9 | } 10 | print(stack.count) 11 | -------------------------------------------------------------------------------- /BOJ/11000 ~ 11999/11953_파일 옮기기.swift: -------------------------------------------------------------------------------- 1 | var basket_a = readLine()!.split(separator: " ").map { Int($0)! } 2 | var basket_b = readLine()!.split(separator: " ").map { Int($0)! } 3 | var case1 = basket_a[0] + basket_b[1] 4 | var case2 = basket_a[1] + basket_b[0] 5 | print(min(case1, case2)) 6 | -------------------------------------------------------------------------------- /BOJ/16000 ~ 16999/16861_Harshad Numbers.swift: -------------------------------------------------------------------------------- 1 | var n = Int(readLine()!)! 2 | while true { 3 | var sum = 0 4 | for str in String(n) { 5 | sum += Int(String(str))! 6 | } 7 | if n % sum == 0 { 8 | break 9 | } 10 | n += 1 11 | } 12 | print(n) 13 | -------------------------------------------------------------------------------- /BOJ/17000 ~ 17999/17010_Time to Decompress.swift: -------------------------------------------------------------------------------- 1 | let n = Int(readLine()!)! 2 | 3 | for _ in 0.. = [] 3 | let words = readLine()!.split(separator: " ").map { String($0) } 4 | words.forEach { 5 | set.insert($0.first!) 6 | set.insert($0.last!) 7 | } 8 | set.count == 1 ? print(1) : print(0) 9 | -------------------------------------------------------------------------------- /BOJ/23000 ~ 23999/23303_이 문제는 D2 입니다.swift: -------------------------------------------------------------------------------- 1 | let word = readLine()!.map { String($0.uppercased()) } 2 | var answer = "unrated" 3 | for i in 0..