Skip to content

Instantly share code, notes, and snippets.

@gauravvichare
gauravvichare / routes.py
Last active January 23, 2017 17:50
Routes.py file for url shortner to remove application, controller and function name from url
routers = dict(
# base router
BASE=dict(default_application='url_shortner'),
url_shortner=dict(
default_controller='default',
default_function='index',
# function list of default controller, to distinguish between
# args and function name
functions=['index', 'user', 'download', 'call',
@gauravvichare
gauravvichare / covert.java
Created April 14, 2013 14:44
In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow three-letter numbers, etc. Th…
import java.util.Scanner;
public class convert {
public static void main(String [] args){
int i,j,count;
String[] ab;
ab = new String[10000000];
Scanner in=new Scanner (System.in);
@gauravvichare
gauravvichare / theatre.java
Created April 14, 2013 14:41
Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a. What is the least number of flagstones needed to pave the Square? It's allowed to cover the surfa…
import java.util.Scanner;
public class theatre {
public static void main(String[] args) {
double n,m,a;
Scanner in = new Scanner(System.in);
n = in.nextDouble(); // accept width of theatre square
m = in.nextDouble(); //accept length of theatre square