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
You have N soldiers numbered from 1 to N. Each of your soldiers is either a liar or a truthful person. You have M sets of information about them. Each set of information tells you the number of liars among a certain range of your soldiers. Let L be the total number of your liar soldiers. Since you can’t find the exact value of L, you want to find the minimum and maximum value of L. | |
Input Format | |
The first line of the input contains two integers N and M. | |
Each of next M lines contains three integers: | |
A B C where the set of soldiers numbered as {A, A+1, A+2, …, B}, exactly C of them are liars. (1 <= Ai <= Bi <= n) and (0 <= Ci <= Bi-Ai). | |
Note: N and M are not more than 101, and it is guaranteed the given informations is satisfiable. | |
Output Format |
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 urllib2,os | |
os.system('cls') | |
print 'SPOJ problem pdf downloader' | |
url = 'http://www.spoj.com/problems/' | |
print 'Enter problem code' | |
prblm = raw_input() | |
prblm = prblm.upper() | |
url = url + prblm +'.pdf' | |
print 'Downloading '+url | |
pdf = urllib2.urlopen(url) |
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
You are given an input of dictionary followed by some words that use a secret dictionary. Because each word in the line shares some letters with other words, you can descramble it by figuring out which words they must be to use the same secret code. Note that each secret line can use it's own dictionary. | |
Testcases format: | |
The input contains a single integer N (<100) followed by N words in the dictionary | |
This is followed by an integer K (< 100)following which there are K alphanumeric words belonging to the secret dictionary. The maximum length of each word would be 1024 characters | |
Output the decoded string one per line | |
The input is from stdin and output to stdout | |
Sample Testcases |
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
A sstring is a string which comprises of only lowercase letters and in which no two consecutive letters are the same. | |
You are given a string (length <= 100). Print the number of sstrings lower than the given string and of the same length. | |
Input: Only 1 line which is the given string (all lowercase letters). | |
Output: Number of sstrings lower than the given string of the same length. | |
Sample Input: | |
bcd |
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
http://customizemania.com/daily-mania-orta-xfce/ |
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
All roads in a country called Ambrosia have been destroyed by floods. The current mission is to restore communication between its cities. Every city has a construction department which can deals with the roads that are connected to that city. The construction department of any city can construct only one road and can manage only one constructed road. | |
Ambrosia has cities numbered from 1 to N. We need to build roads in such a way that Ambosia becomes fully connected. This means that there will be at least one path between any pair of cities in the country. | |
The Construction department of each city provided two lists for all roads that are connected to it. One list clearly states the money needed to construct the roads and another list which states the money required manage that road. | |
Your task is to find the minimum amount of money senate will spend on the construction and managing of roads with given constraint. | |
Note : Managing is possible only for the road that has been constructed. |
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
[PHP] | |
;;;;;;;;;;;;;;;;;;; | |
; About php.ini ; | |
;;;;;;;;;;;;;;;;;;; | |
; PHP's initialization file, generally called php.ini, is responsible for | |
; configuring many of the aspects of PHP's behavior. | |
; PHP attempts to find and load this configuration from a number of locations. | |
; The following is a summary of its search order: |
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 java.util.*; | |
class Test{ | |
public static void main(String[] args){ | |
int n,c; | |
Scanner sc = new Scanner(System.in); | |
System.out.print("Enter a negative integer: "); | |
n = sc.nextInt(); | |
if(n>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
import random | |
you = 0 | |
comp = 0 | |
def rollDice(): | |
a = random.randrange(1,7) | |
b = random.randrange(1,7) | |
return [a,b] |
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 <iostream> | |
using namespace std; | |
void printPattern(int a,int b){ | |
if(a==0){ | |
return; | |
} | |
printPattern(a-1,b+1); |
OlderNewer