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
CXX = clang++-3.9 | |
INCDIR = -I /usr/include/c++/v1 -I /home/linuxbrew/.linuxbrew/opt/boost@1.60/include | |
CFLAGS = -O2 | |
LIBS = -L /usr/lib -L /home/linuxbrew/.linuxbrew/opt/boost@1.60/lib | |
OBJS = a.out | |
STD = c++14 | |
STDLIB = libc++ | |
WARNS = -Werror -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic | |
a.out: hello.cpp |
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 <iostream> | |
using namespace std; | |
static int n; | |
int solve(); | |
int solve() { | |
int ans = n; | |
for (int i = 0; i <= n; i++) { |
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 <cstdio> | |
#include <iostream> | |
#include <queue> | |
#include <string> | |
using namespace std; | |
static int a, b; | |
int solve(); |
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 <cstdio> | |
#include <iostream> | |
#include <queue> | |
#include <string> | |
using namespace std; | |
int n; |
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 <queue> | |
#include <string> | |
using namespace std; | |
const int MAX_H = 1000; | |
const int MAX_W = 1000; |
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
require 'prime' | |
n, p_ = gets.chomp.split(" ").map(&:to_i) | |
x = Prime.prime_division(p_) | |
ans = 1 | |
x.each do |e, m| | |
ans *= e ** (m / n) | |
end | |
puts ans |
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
# TLE | |
H, W = gets.chomp.split(" ").map(&:to_i) | |
que = [] | |
visited = Array.new(H){Array.new(W, false)} | |
H.times do |i| | |
row = gets.chomp | |
W.times do |j| | |
if row[j] == "#" | |
que << [i, j] |
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
n = gets.chomp.to_i | |
s = gets.chomp | |
snow = [] | |
ice = [] | |
cnt = 1 | |
cur = "-" | |
(n - 1).times do |i| | |
if s[i + 1] == "-" | |
if cur == "-" |
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
a = [] | |
b = [] | |
s = gets.chomp | |
n = s.length | |
n.times do |i| | |
if s[i] == "2" | |
if b.empty? | |
a << 1 | |
else | |
x = b.pop |
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
c, d = gets.chomp.split(" ").map(&:to_i) | |
l, r = 140, 170 | |
ans = 0 | |
while true | |
break if l > d | |
ans += [0, [r, d].min - [l, c].max].max | |
l *= 2 | |
r *= 2 | |
end |