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
52 damage, 4 health, spells: Magic Missile (53 mana) | |
51 damage, 6 health, spells: Drain, Magic Missile (126 mana) | |
49 damage, 13 health, spells: Poison, Magic Missile (226 mana) | |
28 damage, 19 health, spells: Poison, Shield, Magic Missile (339 mana) | |
25 damage, 21 health, spells: Poison, Drain, Magic Missile (299 mana) | |
24 damage, 23 health, spells: Poison, Magic Missile, Magic Missile (279 mana) | |
21 damage, 26 health, spells: Poison, Shield, Magic Missile, Magic Missile (392 mana) | |
18 damage, 28 health, spells: Shield, Poison, Magic Missile, Drain, Magic Missile (465 mana) | |
17 damage, 30 health, spells: Shield, Poison, Magic Missile, Magic Missile, Magic Missile (445 mana) | |
15 damage, 35 health, spells: Shield, Recharge, Poison, Shield, Magic Missile, Poison, Magic Missile (907 mana) |
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
52 damage, 4 health, spells: Magic Missile (53 mana) | |
49 damage, 6 health, spells: Drain, Magic Missile (126 mana) | |
47 damage, 13 health, spells: Poison, Magic Missile (226 mana) | |
26 damage, 19 health, spells: Poison, Shield, Magic Missile (339 mana) | |
24 damage, 21 health, spells: Poison, Drain, Magic Missile (299 mana) | |
23 damage, 23 health, spells: Poison, Magic Missile, Magic Missile (279 mana) | |
20 damage, 24 health, spells: Poison, Shield, Drain, Magic Missile (412 mana) | |
19 damage, 26 health, spells: Poison, Shield, Magic Missile, Magic Missile (392 mana) | |
16 damage, 30 health, spells: Poison, Shield, Magic Missile, Magic Missile, Magic Missile (445 mana) | |
14 damage, 35 health, spells: Shield, Recharge, Poison, Shield, Magic Missile, Poison, Magic Missile (907 mana) |
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
Facebook Hacker Cup 2016 Qualification Round | |
Problem A: Boomerang Constellations | |
The night sky can be modeled as an infinite 2D plane. There are N stars at | |
distinct positions on this plane, the i-th of which is at coordinates (X[i], | |
Y[i]). | |
A boomerang constellation is a pair of distinct equal-length line segments | |
which share a single endpoint, such that both endpoints of each segment | |
coincide with a star's location. |
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
#include <algorithm> | |
#include <iostream> | |
#include <utility> | |
#include <vector> | |
using namespace std; | |
#define FOR(i, a, b) for(int i = int(a); i < int(b); ++i) | |
#define REP(i, n) FOR(i, 0, n) | |
#define SZ(c) (int((c).size())) |
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
# https://www.hackerrank.com/challenges/candies | |
import sys | |
N = int(sys.stdin.readline()) | |
ratings = [ int(sys.stdin.readline()) for n in range(N) ] | |
candies = [1]*N | |
for i in range(1, N): | |
if ratings[i] > ratings[i - 1]: | |
candies[i] = candies[i - 1] + 1 |
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
class A { | |
public static boolean isPrime(int i) { | |
if (i < 2) return false; | |
for (int j = 2; j <= (int) Math.sqrt(i); ++j) { | |
if (i % j == 0) return false; | |
} | |
return true; | |
} |
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
/* 1) Immediately prints the base puzzle SVG to stdout. | |
* 2) Creates a path-*.svg each * time it hits a longest path. | |
* 3) Creates a solution-*.svg for each solution. | |
*/ | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#define WIDTH 8u | |
#define HEIGHT 8u |
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
CFLAGS=-std=c99 -O3 -march=native | |
OBJS=main.o search1.o search2.o search3.o | |
main: $(OBJS) | |
cc -o $@ $(OBJS) | |
clean: | |
rm -f $(OBJS) |
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
#include <stdio.h> | |
#include <assert.h> | |
/* Calculates the square root of a nonnegative number using Newton's method. */ | |
double square_root(double a) { | |
assert(a >= 0); | |
if (a == 0) return 0; | |
double x = a, prev; | |
do { | |
prev = x; |
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
from __future__ import print_function | |
digits = [ | |
[3,3,3,5,6,3,6,3], | |
[3,6,6,3,3,5,6,3], | |
[3,3,3,3,3,2,3,3], | |
[3,3,5,3,3,3,3,3], | |
[2,3,3,3,3,3,3,3], | |
[3,6,3,3,3,2,3,2], | |
[3,3,3,4,3,3,3,3], |