Skip to content

Instantly share code, notes, and snippets.

@myeesan
myeesan / CurrencyNumberFormatter.java
Last active July 8, 2016 21:40
Fixture setup - Exercise system - Verify outcome - Fixture teardown
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
public class CurrencyNumberFormatter {
private Locale locale;
public CurrencyNumberFormatter(Locale locale) {
this.locale = locale;

어떤 문장에서 각각의 단어가 몇 개 존재하는지 세는 코드를 작성하시오.

예를 들어 "Will, I will be back!"

  1. will: 2
  2. i: 1
  3. be: 1
  4. back: 1

만남 약속 날짜를 계산하시오.

보통 같은 종류의 약속은 같은 요일에 잡히는 경우가 많습니다.

  1. 첫째 주 월요일
  2. 셋째 주 화요일
  3. 마지막 주 월요일

Special Case

  • teenth
import scala.io.Source
import java.io.PrintWriter
import java.io.File
object Main {
val testCase = Source.fromFile("large.in").getLines.toList.tail
val writer = new PrintWriter(new File("large.out"))
def main(args: Array[String]) {
[[syntax trees at end of parser]] // MacroMain.scala
package <empty> {
object MacroMain extends scala.AnyRef {
def <init>() = {
super.<init>();
()
};
def main(args: Array[String]): scala.Unit = {
import MyMacros._;
println(StringContext("This project was compiled on ", "").s(MyMacros()))
import scala.io.Source
import scala.math.min
import java.io.FileOutputStream
import java.io.File
import java.io.PrintWriter
object Osmos {
val in = Source.fromFile("large.in").getLines;
val out = new PrintWriter(new File("large.out"));
object Comments extends App {
var before = "";
var count = 0
var result = "";
for (c <- Source.in2) {
if (count == 0) {
object Sudoku {
val in = io.Source.fromFile("sample.in").getLines
case class Case(n: Int, _lines: List[String]) {
def lines: List[List[Int]] = {
_lines.map(_.split(" ").map(_.toInt).toList).toList
}
import scala.collection.mutable.ListBuffer
object SpaceshipDefence {
val in = io.Source.fromFile("sample.in").getLines
def main(args: Array[String]) {
case class Node(val same_color: ListBuffer[Int], val lift: ListBuffer[(Int, Int)]) {
}
import scala.io.Source
import java.io.PrintWriter
import java.io.File
object PartElf {
val in = Source.fromFile("small.in").getLines
val printer = new PrintWriter(new File("small.out"))
case class TestCase(line: String) {