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"bits/stdc++.h" | |
using namespace std; | |
main(){ | |
int vec[]={0,1,2,3,4,5,6,7},n=8,c=0; | |
set <int> mset,nset; | |
set<int>::iterator it; | |
do{ | |
mset.clear(); | |
nset.clear(); |
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
import cProfile | |
def row_check(i,j): return i//9==j//9 | |
def col_check(i,j): return (i-j)%9==0 | |
def blocks_check(i,j): return i//27==j//27 and (i%9)//3==(j%9)//3 | |
def show(grid): | |
print "".join(num+" "+" "*((i+1)%3==0)+"\n"*((i+1)%9==0) for i,num in enumerate(grid)) | |
def solve(grid): |
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
__author__ = 'wasi0013' | |
#Algorithm resources: http://crypto.interactive-maths.com/introduction-to-cryptography.html | |
def caeser_encrypt(text, key): | |
""" | |
Takes string as text and encrypts it with the key | |
>>> caeser_encrypt("Hello World",2) | |
'JGNNQ YQTNF' | |
>>> caeser_encrypt("Hello World",0) | |
'HELLO WORLD' |
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"bits/stdc++.h" | |
/* | |
Problem Name: SEND MORE MONEY riddle in Artificial Intelligence | |
Problem Category: | |
----------------- | |
Constraint Optimisation Problem | |
Problem Description: | |
-------------------- | |
SEND | |
+ MORE |
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
__author__ = "wasi0013" | |
""" | |
parses spoj's Bangladesh ranklist (http://www.spoj.com/ranks/users/BD/) to get | |
100 top users of Spoj from country Bangladesh | |
""" | |
import requests, bs4 | |
url = 'http://spoj.com/ranks/users/BD' |
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
__author__ = "wasi0013" | |
''' | |
Calculates digits of pi using the Gauss-Legendre Algorithm | |
Link: https://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_algorithm | |
''' | |
import decimal | |
import requests, bs4 |
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
__author__ = "wasi0013" | |
import glob | |
def get_dictionary(path): | |
""" | |
returns: a dictionary of words (with sorted string as key) | |
from files in the path | |
""" | |
words = set() |
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
__author__ = "wasi0013" | |
import urllib2 | |
from bs4 import BeautifulSoup | |
import re | |
from fractions import gcd | |
import random | |
def affine_encrypt(text, a, b, m=26): |
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
import tkinter as tk | |
import re | |
""" | |
This is slight modification of the script: https://gist.github.com/uroshekic/11078820 | |
Changes: | |
- Fixed value selection | |
- Added Support for tab or, enter key press to select value | |
""" | |
def matches(fieldValue, acListEntry): |
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 abc import ABC, abstractmethod | |
class Polygon(ABC): | |
@abstractmethod | |
def area(self): | |
pass | |
@abstractmethod | |
def perimeter(self): |
OlderNewer