Skip to content

Instantly share code, notes, and snippets.

View VitamintK's full-sized avatar
🆒

Kevin Wang VitamintK

🆒
View GitHub Profile
@VitamintK
VitamintK / gravity_tidal_force_demo.py
Created January 19, 2021 22:05
trying to visualize tides/tidal forces/gravity/why there are two high tides on earth
from manim import *
import math
dots_per_row = 120
moon = (10,0)
m2 = 10
G = 1
class MovingDot(Dot):
def __init__(self, *args, **kwargs):
@VitamintK
VitamintK / A.py
Created May 18, 2019 16:36
google codejam round 2 2019
T = int(input())
for t in range(T):
n = int(input())
mols = []
for i in range(n):
c, j = map(int, input().split())
mols.append((c,j))
SMALL_NUM = 1/5123456789
slopes = [1+SMALL_NUM, 1-SMALL_NUM]
////////////////////////////////////////////////////////////////////////////////
//
//Private helper methods
template<class KEY,class T, int (*thash)(const KEY& a)>
int HashMap<KEY,T,thash>::hash_compress (const KEY& key) const {
return (abs(this->hash(key)) % bins);
}
# coding: utf-8
# In[54]:
from bs4 import BeautifulSoup
# In[55]:
n, m, s, x, y, z = map(int, input().split())
cost = x + y + z
import math
comps = math.ceil(s/n)
if comps * cost <= m:
print(m - comps*cost)
else :
print( m%(comps*cost))
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 91 columns, instead of 61. in line 2.
name,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89
Rand Paul,0.16,0.14,0.18,0.17,0.17,0.18,0.16,0.15,0.12,0.15,0.13,0.12,0.13,0.15,0.14,0.12,0.14,0.15,0.14,0.15,0.15,0.16,0.13,0.2,0.17,0.17,0.16,0.16,0.16,0.17,0.16,0.19,0.14,0.13,0.15,0.12,0.13,0.12,0.12,0.11,0.1,0.15,0.11,0.11,0.11,0.12,0.1,0.12,0.12,0.11,0.12,0.12,0.12,0.12,0.1,0.09,0.12,0.09,0.09,0.1,0.1,0.1,0.09,0.11,0.1,0.11,0.1,0.12,0.11,0.11,0.12,0.12,0.11,0.14,0.1,0.1,0.09,0.1,0.08,0.09,0.11,0.09,0.09,0.09,0.08,0.09,0.07,0.07,0.07,0.09
Rick Santorum,0.04,0.07,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.07,0.06,0.06,0.07,0.07,0.07,0.08,0.08,0.06,0.06,0.06,0.07,0.09,0.09,0.08,0.08,0.08,0.06,0.06,0.08,0.06,0.06,0.06,0.05,0.06,0.04,0.06,0.07,0.07,0.03,0.06,0.06,0.06,0.04,0.06,0.06,0.07,0.05,0.05,0.07,0.05,0.05,0.07,0.05,0.08,0.08,0.
cf3 =
Compile[
{},
Module[
{n1, l, max = 0, maxN = 0},
Do[
n1 = n;
l = 1;
While[
n1 != 1,
cf3 =
Compile[
{},
Module[
{n1, l, max = 0, maxN = 0},
Do[
n1 = n;
l = 1;
While[
n1 != 1,
def setUp(self):
self.mybag = Bag(['d','a','b','d','c','b','d'])
def test_len(self):
self.assertEqual(len(self.mybag), 7)
for removal in ['d','a','b','d','c','b','d']:
baglen = len(self.mybag)
self.mybag.remove(removal)
self.assertEqual(baglen - 1, len(self.mybag))
# Kevin Cao
# March 9, 2015
# define intro function
def intro():
# give rules
print ("This is a puzzle favored by Einstein. \nYou will be asked to enter a three digit number, \nwhere the hundred's digit differs from the one's digit \nby at least two. \nThe procedure will always yield 1089.")
# define function einstein
def main():
# prompt user for number