Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
khaiii API module | |
__author__ = 'Jamie (jamie.lim@kakaocorp.com)' | |
__copyright__ = 'Copyright (C) 2018-, Kakao Corp. All rights reserved.' | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
code template for Python 3 | |
__author__ = 'Your Name (your.email@address.info)' | |
__copyright__ = 'No copyright, just copyleft!' | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object RopeIntranet { | |
def main(args: Array[String]) { | |
val writer = new java.io.PrintWriter("a-large.out") | |
try { | |
process(io.Source.fromFile("A-large-practice.in").getLines)(writer.println) | |
} finally { | |
writer.flush() | |
writer.close() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream | |
import java.io.FileOutputStream | |
object SquareTiles extends App { | |
def solve(tiles: Array[Array[Char]]): Option[Array[Array[Char]]] = { | |
for ( | |
r <- (0 until (tiles.length - 1)); | |
c <- (0 until (tiles(r).length - 1)) | |
) { | |
tiles(r)(c) match { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ManageYourEnergy{ | |
def getLocalList(E: Long, R: Long, v: List[Long]): List[Long] = v.take(((E - 1) / R + 1).toInt) | |
def solve(E: Long,R:Long,v: List[Long]): BigInt = { | |
def inner(currE: Long, localList:List[Long], r: BigInt=0): BigInt={ | |
if(localList.isEmpty) r | |
else{ | |
val spendE = currConsume(currE, E, R, getLocalList(E,R,localList)) | |
inner(Math.min(currE - spendE + R,E), localList.tail, r + BigInt(spendE) * BigInt(localList.head)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object magic_trick extends App { | |
def solve(first_answer: Int, first_cards: List[List[Int]], second_answer: Int, second_cards: List[List[Int]]): String = { | |
val first_choice = first_cards(first_answer - 1) | |
val second_choice = second_cards(second_answer - 1) | |
val answer = (first_choice.toSet & second_choice.toSet).toList | |
answer match { | |
case head :: Nil => head.toString | |
case Nil => "Volunteer cheated!" | |
case head :: tail => "Bad magician!" | |
} |