This file contains hidden or 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
val isPrime(v: Int) = { | |
v match { | |
case v if (v <= 1) => false | |
case v if (v == 2) => true | |
case v => !(2 to (v - 1)).exists(x => v % x == 0) | |
} | |
} | |
val isPerfect(v: Int) = { | |
v == (1 until v).foldLeft(0) { (acc, i) => |
This file contains hidden or 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
! Swap Ctrl and Caps_Lock | |
remove Lock = Caps_Lock | |
remove Control = Control_L | |
keysym Control_L = Caps_Lock | |
keysym Caps_Lock = Control_L | |
add Lock = Caps_Lock | |
add Control = Control_L |
This file contains hidden or 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
public List<String> filterNames(List<String> names, int len) { | |
List<String> res = new ArrayList<>(); | |
for (String n : names) { | |
if (n.length() >= len) { | |
res.add(n.toUpperCase()); | |
} | |
} | |
return res; | |
} |
This file contains hidden or 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
module Main where | |
take' _ [] = [] | |
take' 0 _ = [] | |
take' n (x:xs) = x : take' (n - 1) xs | |
drop' _ [] = [] | |
drop' 0 xs = xs | |
drop' n (x:xs) = drop' (n - 1) xs |
This file contains hidden or 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 Arc009A { | |
def main(args: Array[String]) = { | |
val n = io.Source.stdin.getLines.next().toInt | |
var sum = 0 | |
for (i <- 0 until n) { | |
val tmp = io.Source.stdin.getLines().next().split(" ").map(_.toInt) | |
sum += tmp(0) * tmp(1) | |
} | |
println((sum * 1.05).toInt) | |
} |
This file contains hidden or 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.util.Map; | |
import java.util.Scanner; | |
import java.util.TreeMap; | |
public class Arc008B { | |
@SuppressWarnings({ "unused", "resource" }) | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int shopNameLength = sc.nextInt(); |
This file contains hidden or 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.util.Scanner; | |
public class Arc008A { | |
@SuppressWarnings("resource") | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int needs = sc.nextInt(); | |
int sets = needs / 10; | |
int bits = needs % 10; |