This file contains hidden or 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
| /* | |
| * ===================================================================================== | |
| * | |
| * Filename: stdiotest.c | |
| * | |
| * Description: test some stdio functions, such as getc(), ungetc()... | |
| * | |
| * Version: 1.0 | |
| * Created: 04/26/2012 04:42:34 PM | |
| * Revision: none |
This file contains hidden or 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
| <?php | |
| namespace Blog\Controller; | |
| use Zend\Mvc\Controller\AbstractActionController; | |
| use Zend\View\Model\ViewModel; | |
| use Zend\Authentication\AuthenticationService; | |
| use Blog\Model\BlogEntry; | |
| use Blog\Model\BlogTable; | |
| use Blog\Form\BlogForm; |
This file contains hidden or 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<stdio.h> | |
| #include<stdlib.h> | |
| #define MAX 11 | |
| int main(int argc, char *argv[]) | |
| { | |
| char* buf=(char*)malloc(MAX*sizeof(char)); | |
| char* line; | |
| FILE* fp; | |
| if(argc==1) | |
| { |
This file contains hidden or 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
| accountsservice install | |
| acl install | |
| acpi-support install | |
| acpid install | |
| activity-log-manager-common install | |
| activity-log-manager-control-center install | |
| adduser install | |
| adium-theme-ubuntu install | |
| aisleriot install | |
| alacarte install |
This file contains hidden or 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
| def countInversions(li, MAX): | |
| """ This function can count the number of inversions | |
| in the given list li of numbers ranging from 1 to | |
| MAX.""" | |
| BIT = [0]*(MAX+1) | |
| total = len(li)*(len(li)-1)/2 | |
| for number in li: | |
| temp = number | |
| if __name__ == "__main__": | |
| print BIT |
This file contains hidden or 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 sys | |
| def main(): | |
| case = int(sys.stdin.readline().strip()) | |
| while case >0: | |
| case -= 1 | |
| credit = int(sys.stdin.readline().strip('\n')) | |
| num = int(sys.stdin.readline().strip('\n')) | |
| prices = sys.stdin.readline().strip('\n').split() | |
| prices = [ int(n) for n in prices ] |
This file contains hidden or 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 sys | |
| #import pdb | |
| def onp(expr, stack = []): | |
| ''' the main logic of the onp problem. | |
| this logic doesn't check for syntax | |
| errors. ''' | |
| que = list(expr) | |
| block = [] # temporarily used | |
| for ch in que: | |
| if ch == ')': |
This file contains hidden or 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 sys | |
| operators = ['lower':['+','*'],'higher':['-','/']] | |
| def main(): | |
| casen = int(sys.stdin.readline()) | |
| while casen: | |
| expr = sys.stdin.readline().strip('\n') | |
| print process(expr) | |
| casen -= 1 | |
| def process(expr): |
This file contains hidden or 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
| def findpos(sub): | |
| # http://acm.timus.ru/problem.aspx?num=1165 | |
| s = '' | |
| li = [] | |
| for i in range(1,sub+1): | |
| i = str(i) | |
| li += i | |
| string = s.join(li) | |
| return string.find(str(sub))+1 |
This file contains hidden or 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
| " Modeline and Notes { | |
| " vim: set foldmarker={,} foldlevel=0 foldmethod=marker spell: | |
| " | |
| " _____ ______ _ ______ _ | |
| " | ___| | _ \ | | | ___ \ ( ) | |
| " | |____ ____ _ _ __ | | | |___ | |_| |_/ / __ ___ |/ ___ | |
| " | __\ \ / / _` | '_ \| | | / _ \| __| __/ '__/ _ \ / __| | |
| " | |___\ V / (_| | | | | |/ / (_) | |_| | | | | (_) | \__ \ | |
| " \____/ \_/ \__,_|_| |_|___/ \___/ \__\_| |_| \___/ |___/ | |
| " _ __ _ |