Quantcast
Channel: CodeChef Discuss - latest questions
Browsing all 39796 articles
Browse latest View live
↧

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 Article


Range 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 Article


MAXCOUNT- 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 Article

Three 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 Article

Please 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 Article


Set 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 Article

how 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 Article

SIGSEGV 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 Article


Knapsack 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 Article


Determinant 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 Article

ONP 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 Article

PRIME1: 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 Article

How 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 Article


How 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 Article

wrong 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 Article


Error 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 Article

ATM 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 Article


Sigma 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 Article

brute 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 Article

PRETNUM - 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
Browsing all 39796 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>