Algorithm for modular exponentiation
ALGORITHM 2- MODULAR EXPONENTIATIONBy @pratku123For more methods and a detailed explanation refer to the wikipedia page of Modular exponentiation.We posted this on our facebook page and thought that we...
View ArticleMaxim and Progressions
Needed one clarification regarding second test case. 1 2 1 is the given sequence. As per the question, 1 2 1 and 2 1 both are sub-sequence. As per the condition, in any sub-sequence a[i] < a[i+1]....
View ArticleCan anyone explain me LEBLOCKS question
I am facing difficulty understanding the little elephant and block question. Can anyone explain it in simple sense.
View ArticleLucky Long: problem with raw_input()
I am getting a WA if I use raw_input(). If I use raw_input.strip(),answer gets submitted!! Why are we using raw_input.strip() here? plzz help! Thanks in advance! link to question...
View ArticleChinese and eastern european domination????
How come chinese and eastern european people dominate programming competitions like codechef while we hardly ever manage top 3. Some of the times not only professionals even their high school students...
View Articlelink for live rankings
just little left for june long challenge, and then follows short one. live rankings for June 2014 long challenge: http://www.codechef.com/rankings/june14live rankings for June 2014 short challenge:...
View Articlewhich one is faster, scanf or getchar
Please explain this , I am using scanf in my C++ code for chef and functions and I am getting TLE. Help
View ArticleHOLES Getting WA
include <stdio.h>int main() { int t; scanf("%d", &t); fseek(stdin, 0, SEEK_END); while (t--) { char a[101]; int i, numberOfHoles = 0; fgets(a, 100, stdin); for(i = 0; a[i] != '\0'; i++) {...
View ArticleA SINGLE LINE LOGIC ALSO GIVING TLE FOR DCE05 question !!!!
the question link is http://www.codechef.com/problems/DCE05 my solution is below...!!! package mat; import java.lang.Math; import java.util.Scanner; public class Mat { public static void main(String[]...
View Articleexecution time
Will i please be notified about the execution time of pow function in math.h used in C language. Does it takes longer than writing a code using loops myself??
View ArticleFUNC: TLE problem
Even after aborting the calculation of root once it becomes 1. That leads to maximum 60 calls to the root function, no matter what N is. Since, (10^18)^(1/60)=1. Still I am getting TLE. Please help...!...
View ArticleFactorial and trailing non zero digit
wirte a program to find the last non-zero digit of factorial of a number
View ArticleJAVA operation of left shif
This is a java prg pls make me understand why on left shifting 2 by 32 it o/p 10class hi{public static void main(String args[]){ int a; a=2<<32; System.out.println(Integer.toBinaryString(a)); } }...
View ArticleFind out two number from a series which is composed by these two numbers
series 7,9,79,97,77,99,777,999
View Articleproblem in code??..........you can run this code of c++ and test all the...
include<iostream>using namespace std; int main() {int t,n; string s; scanf("%d",&t); while(t--) {scanf("%d",&n); string a,b; int countb=0; int countl=0; for(int i=0;i<n;i++)...
View Articlealgorithm please!!
Design a program that finds all numbers from 1 to 1000 whose prime factors, when added together, sum up to a prime number (for example, 12 has prime factors of 2, 2, and 3, which sum to 7, which is...
View ArticleHelp Understanding TCs for MAXPR
Do indices matter in case of sub-sequences in the problem? Suppose "1 1 1 1 2" is a sequence then, only "1 1 2" is not an AP. But is it counted only once or all the combinations of the same...
View Articlesame stratergy working in C but not python. What could be the reason
Getting runtime(nzec) error for solution submitted in python whereas similar approach worked in C. Am I missing something that in python. The solution for http://www.codechef.com/problems/DCE05 in...
View ArticleODDBIN - Editorial
PROBLEM LINKSPracticeContestDIFFICULTYMEDIUMEXPLANATIONNotation-------- Let C(n,r) represent the binomial coefficient of choosing r items out of n.Let BitSet(n) = { i | 2^i is used in the binary...
View ArticleTLE on oddbin
May I ask why is my solution getting TLE? I generated a few random test cases and my solution seems to run within 2 * time use by setter's solution. Below is my solution. http://pastebin.com/ECdkfk9r
View Article