Please suggest me an efficient algorithm and easy to understand for this problem
http://www.codechef.com/problems/H1All submissions for this problem are available.Johnny has some difficulty memorizing the small prime numbers. So, his computer science teacher has asked him to play...
View ArticleGift Rift Problem
Hi all !! This is my code for the question gift rift http://www.codechef.com/problems/SAD# ... but everytime when i tried to run it gives me WRONG ANSWER error ... the solution is working fine on my...
View ArticleIntroduction to Graphs: Definitions, Traversal, Depth-First Search
Hello @all,As I have mentioned on several posts here on forums, I am only now starting to learn graphs in a more educated, methodical and serious way, so, after I have studied DFS for few days and due...
View Articlewhat is best deterministic primality checking algorithm??
i hv tried checking primality of a number bt testing till sqrt of number bt its too time consuming for big numbers.. Fermats test involves expotential terms and is tedious to implement for a large...
View ArticleTASTYD - Editorial
Author: Roman Rubanenko Tester: Vamsi Kavala Editorialist: Bruno OliveiraPROBLEM LINKSPracticeContestDIFFICULTYMediumPRE-REQUISITESDivide-and-conquerProblem:Chef is at a restaurant serving dishes....
View ArticleHOLES problem
here is my code for the holes problem..its showing WA..dont know why..import java.util.Scanner; import java.io.*; class HOLES { static InputStreamReader isr=new InputStreamReader(System.in); static...
View ArticleLEEXAMS - Editorial
Problem Link:PracticeContestDifficulty:EasyPre-requisites:High School MathsProblem:Given n tickets, ith ticket can be labelled * Ai with probability Pi percent. * Bi with probability 100-Pi percent....
View ArticleNth SHORTEST SUPER SEQUENCE
PLEASE SOMEONE HELP ME INORDER TO SOLVE THISNth Shortest Super SequenceTime out : 4 SecMemory Limit : 64MBA shortest common supersequence of two strings is defined as the shortest possible string...
View ArticleCOOLGUYS - Editorial
Problem Link:PracticeContestDifficulty:EasyPre-requisites:Number theoryProblem:Given an integer N. Two integers A and B are chosen randomly from [1..N]. Find the probability that gcd(A, B) = B as a...
View ArticleNeed help implementing graphs!
I came up with the following code. Here, I assume that I already know the number of vertices on the graph and proceed accordingly with the standard Adjacency list representation. However, some...
View ArticleIs this approach correct for solving problem ENCODE04?
Problem link : ENCODE04If the string has odd length, output NO, else if number of testers (T) in the first half of the string == the number of developers (D) in the second half and T > 0, output YES.
View ArticleTMP01 - Editorial
Problem Link:PracticeContestDifficulty:HardPre-requisites:Suffix-treesProblem:Start with an empty string, and do the following operations: * Append a character to the end of string. * Remove the first...
View ArticleNumber of components in graph
i have been trying to solve this problem lately.. http://www.spoj.com/problems/HERDING/ i am trying to find out the total no. of connected components for the given grid..but i am getting wrong answer...
View ArticleHow to find out for which question you've been upvoted or received a badge?
Whenever I login the codechef account I receive info regarding some badges.But more important is for which question you received the batch.This feature should be implemented if its not there
View ArticleAlgorithm: Given an array, find all the pairs of elements whose sum is k.
algorithm for:-----Given an array, find all the pairs of elements whose sum is k.
View ArticleMost efficient way to I/O in Java and C
Basically I am combining two questions into one. Both the languages have multiple ways to take input from users and print output to standard console. I have always used C, now starting Java(tired of...
View ArticleNth largest/smallest value
Hello guys,Is there any efficient algorithm to find the nth largest (or) smallest value from a given array without having to sort the array..??Possibly in a single iteration .. or using some DS with...
View ArticleATM: showing wrong answer
#include<stdio.h> int main() { int x;float y; scanf("%d %f",&x,&y); if(x%5==0 && x>0 && x<=2000 && y>0 && y<=2000) printf("%f",y-x-0.50); else...
View ArticleInsomnia 2013:Please help me to get the another algorithm for the same problem ?
problem: finding length of longest palindrome in a binary formatted number n (32 bit) . Time limit:0.3sechttp://www.codechef.com/INSM2013/problems/INS02my solution:char str[32];int p;void bin(unsigned...
View Article