A question regarding Bitmask DP.
Question-->http://community.topcoder.com/stat?c=problem_statement&pm=11788&rd=14726Below is my solution uses bitmask DP logic. However, having spent close to three days, my code is still...
View ArticleNZEC Error in java can some one explain why
import java.util.*;class PairSome { public long tk; public int ck;PairSome(long tk, int ck) { this.ck = ck; this.tk = tk; } }public class ThreeDimMatrix {public static void main(String[] args) {...
View ArticlePDF to text file??
How can I convert a PDF file into a text file without using any library (like GNUpdf etc.) in C?
View ArticleIOPC14A ; small doubt
given a=n! and b as stated in the question http://www.codechef.com/problems/IOPC14A .Isnt it enough to just find (n!/b)%2 and this can be written as (n!)%2 * (b^(2-2))%2 =(n!)%2am i wrong in assuming...
View Articlerun time error java
package javaapplication6;import java.util.Scanner;public class JavaApplication6 {public static void main(String[] args) { int i,j=0,k=0; Scanner s=new Scanner(System.in); int num=s.nextInt();...
View ArticleWhat is wrong with this code for the "Life, the Universe, and Everything"...
Why the codechef showing error.include<stdio.h>int main(void){ int j; int i; for (i = 0; i < 10; i++) { scanf("%d",&j); if (j==42) { break; } printf("%d\n",j); } return 0;}
View ArticleWhat is (a.b)mod c?
What I noticed is that 'long long int' can store only 9 digit numbers in the C/C++ compiler in codechef. So when I want to calculate, say(a.b)mod c and, 'a' and 'b' are quite large (say 10^9+5) and...
View ArticleDBOY - Editorial
PROBLEM LINKSPracticeContestDIFFICULTYSIMPLEPREREQUISITESDynamic ProgrammingPROBLEMThere are N fuel stations numbered 1 through N. The i-th fuel station can fill exactly Ki liters at any time. You have...
View ArticleError in Class
I am getting 6 errors in my code. This is my first code on Operator Overloading in OOPS. I am getting undefined reference Complex :: Complex(double, double). Plz help me in fixing the error. Here is my...
View ArticleSUMTRIAN - implementing memoization
I have spent many hours trying to solve the SUMTRIAN problem (http://www.codechef.com/problems/SUMTRIAN/) I know how my program works, I am implementing recursion, and I am doing my best to implement...
View Articlecutting recipes
test cases are working properly but still wrong answerinclude<iostream>using namespace std; int main() { int n,t,i,j,count=0,min; int a[50]; cin>>t; while(t>0) { cin>>n;...
View ArticleFLAGS - Editorial
PROBLEM LINK:PracticeContestAuthor:Konstantin SokolTester:Tasnim Imran SunnyEditorialist:Praveen DhinwaDIFFICULTY:CAKEWALKPREREQUISITES:simple combinatorics.PROBLEM:Given following 5 patterns of a...
View ArticleJava: distance between two cities using array
Acme Trucking Company has hired you to write software to help dispatch its trucks. One important element of this software is knowing the distance between any two cities that it services. Design and...
View ArticleLearn C++ and STL
I am doing competitive programming in C++ from quite some time now . But I do not use any features and benefits that C++ provides over C . I would like to learn C++ to become a good programmer . I...
View Articlewhy am i getting run time error for enormous input output problem ?
include<stdio.h>main() { int n,k,t; int i,count=0; scanf("%d",&n); scanf("%d",&k); int a[n]; for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n;i++) { if(a[i]%k==0) count++; }...
View ArticleAMXOR - Editorial
Problem Link:PracticeContestDifficulty:MediumPre-requisites:Dynamic ProgrammingProblem:Given a sequence of positive integers a[1], a[2], a[3], ..., a[N], find how many sequences of nonnegative integers...
View ArticleGame Theory Problems
I want to understand how problems on Sprague Grundy Theorem are solved. Can someone please post links to resources (apart from the TopCoder Tutorial) where a simple explanation of the basics is...
View Articleplease help in the lead game problem
I am trying to solve the lead game problem I am getting correct answer for the given input but getting WA on submitting my solutionthis is my solutionThanks.
View Articlecounting set bits in a 32 bit number
int NumberOfSetBits32(int i) { i = (i & 0x55555555) + ((i >> 1) & 0x55555555); i = (i & 0x33333333) + ((i >> 2) & 0x33333333); i = (i & 0x0F0F0F0F) + ((i >> 4)...
View ArticleDARTS - Editorial
PROBLEM LINK:PracticeContestAuthor: Istvan NagyTester:Shiplu HawladerEditorialist:Praveen DhinwaDIFFICULTY:CHALLENGE PREREQUISITES:expectation value, random strategies.PROBLEM:The problem is an...
View Article