Knapsack problem
Hey I just learnt the knapsack algo and tried to solve http://www.codechef.com/problems/PPTEST/ but its showing WA. This is my code#include <iostream> using namespace std;int main() {int t;...
View ArticleRange Update in BIT
Is it possible to update a range in Binary Indexed Tree...?? I want this to solve the http://www.codechef.com/problems/FLIPCOIN problem using Binary Indexed Tree(BIT).
View ArticleMAXCOUNT- Editorial
PROBLEM LINKSPracticeContestDIFFICULTYEASYEXPLANATIONThis was supposed to be a problem that anyone who knows basic programming could solve and I'm glad that it's satisfied our expectations.For the...
View ArticleThree Stack Implemention Using an Array?
Hello everyone, I know how to efficiently use an array to implement two stack, Algorithm works as Put Top1 as -1 it means first stack will grow from Left to write and put Top2 as Max+1 , This(second)...
View ArticlePlease explain me what are binary indexed trees and how do they work.
I am not able to understand how to implement binary indexed trees. I cant understand how they work. If someone could please explain me in detail how to use them along with an example.Thank you.
View ArticleSet and Vecotr-Can anyone tell me which is faster?
When we enter the elements in the set it automatically gets sorted. But in a vector it takes another process to sort.Of course that depends on whether you want to sort it or not.But still i want to...
View Articlehow should i start approaching codechef programming?
i have just started getting involved in codechef.. merely reading the practice questions i am not able to understand the way to approach the programmming. someone please help
View ArticleSIGSEGV error (C++)
Hi, I encountered a SIGSEGV error when I was attempting a problem. Here's the solution that I submitted. Could anyone explain what was wrong in my code?Please help me out. Thanks.
View ArticleKnapsack Problems?
What are your favourite knapsack problems? Please link them in the answer. I just learnt the algo and would like to get proficient in it. Thanks :D
View ArticleDeterminant of a matrix
please can someone tell me how do i write a code for calculating determinant of a matrix in c.That works for all size of matrices eg. 33,44,7*7...and so on....
View ArticleONP i think my logic is correct.... bt not gettng submittd.....need help
include<iostream>using namespace std; void push(char ch); char pop(); int top=-1; char infix[400]; char postfix[400],stack[400]; int p=-1; int priority(char symbol); int main() { int t;...
View ArticlePRIME1: C++ not getting accepted although giving right answers
include <iostream>include <math.h>using namespace std;int main() { int t,i; long m,n,current,rootn,marker,markeris; scanf("%d\n",&t); while(t--) { scanf("%ld %ld",&m,&n);...
View ArticleHow to start programming?
Where should I start to learn programming? Any websites recommended? I heard C++ isn't a bad place to start. Help would be welcome.
View ArticleHow to convert very long numbers (more specifically long double) to integers
HelloI was solving this question where a very large number 16^123 is involved. As I have a habit of 'seeing' everything as programming problems, I realized that if I can just calculate 16^123 which is...
View Articlewrong answer holes in text
#include<iostream> #include<stdio.h> #include<string.h> using namespace std; int main(){ int z[40],r,q,c=0; char p[100]; cin>>q; for( int i=0;i<q;i++){ gets(p); r=strlen(p);...
View ArticleError in Stacks program
I am getting a run-time error in my program. Here is the code:CODEThe program shows unknown values when you select the 3rd option. Please help. Thanks in advance.
View ArticleATM C Runtime Error
#include <stdio.h> #include <stdlib.h> int main() { int WDAMT; float BAL; scanf("%d",&WDAMT); scanf("%f",&BAL); if(WDAMT%5 ==0 && (BAL-WDAMT) >= 0.5){...
View ArticleSigma c-program
let's consider a set that will call sigma which consists of an integer sequence with the following properties a0=1 am=n a0<a1<a2......<am-1<am quelque soit k apartient [1,m] il existe...
View Articlebrute force pattern matching algorithm
in the brute force pattern matching algorithm when all the characters in the pattern are unique then brute force can be implemented in Big-oh(n) complexity where n is the length of the string(...
View ArticlePRETNUM - Editorial
PROBLEM LINK:PracticeContestDIFFICULTY:EASYPREREQUISITES:Prime factorization, SievePROBLEM:Find the number of integers in the given range which have prime number of divisors.QUICK EXPLANATION:Although...
View Article