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
int f(int n) | |
{ | |
int p = 1, q = 1; | |
int s = 0, t = 0; // start : s, goal : t | |
while(1) | |
{ | |
p = (p*10)%n; | |
q = (q*10)%n; | |
q = (q*10)%n; | |
if(p==q) break; |
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
var_name = lambda val : [k for k, v in globals().items() if id(v) == id(val)] | |
a = 1 | |
s = var_name(a)[0] |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# Copyright (c) 2019 Tamflex | |
# Released under the MIT license | |
# https://opensource.org/licenses/mit-license.php | |
# reference: | |
# http://stackoverflow.com/questions/4458696/finding-out-what-characters-a-font-supports |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# matplotlib wrapper | |
# Copyright (c) 2019 Tamflex | |
# Released under the MIT license | |
# https://opensource.org/licenses/mit-license.php | |
__all__ = ["Figure"] |
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
template<typename T> struct Edge | |
{ | |
int src, dst; T w; | |
Edge() {}; | |
Edge(int src, int dst): src(src), dst(dst) {w=1;} | |
Edge(int src, int dst, T w): src(src), dst(dst), w(w){} | |
bool operator<(const Edge &e)const{return w != e.w ? w > e.w : (src != e.src ? src < e.src : dst < e.dst);} | |
bool operator==(const Edge &e){return src == e.src && dst == e.dst;} | |
}; |
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 P | |
{ | |
public: | |
double x,y; | |
P(){};P(double x,double y):x(x),y(y){}; | |
P &operator+=(const P&q){x+=q.x;y+=q.y;return *this;} | |
P &operator-=(const P&q){x-=q.x;y-=q.y;return *this;} | |
P operator+(const P&q){P t;t.x=x+q.x;t.y=y+q.y;return t;} | |
P operator-(const P&q){P t;t.x=x-q.x;t.y=y-q.y;return t;} | |
template<typename T> P &operator*=(T d){x*=d;y*=d;return *this;} |
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
template <long long modulo> | |
class Modulo | |
{ | |
private: | |
long long pow(long long q) | |
{ | |
long long a=1; | |
long long y=x; | |
for(;q!=0;q>>=1) | |
{ |