Quantcast
Browsing all 40121 articles
Browse latest View live

How to find ∑1

Given two numbers k and n, we have to find ∑1<=i<=n(k mod i), Constraints n>=1 n < k<=10^9 time limit- 1s obvious approach is r = 0; for i from 1 to n do r += (k mod i); return r But it...

View Article


Why are some questions closed?

I see some questions in the questions list as closed. If I navigate to a closed question, I don’t see a textbox for answering that question. Also what if I want to reopen the question?

View Article


What is wrong with my code for calculating factorials?

Here's the code :#include <stdio.h> int main (void) { int x, y, z; z = 1; scanf ("%i", &x); for (x; x > 0; --x) { scanf ("%i", &y); for (y = 1; y; ++y) { z = z * y; } printf ("%i\n",...

View Article

Tell us something about maths

Hello every programmers , I am starting this discussion because I see some of the programmers are not good in mathematics thinking and their implementation. So please share some important tips for...

View Article

Learning BIT

Pls suggest some good tuts/vids to learn BIT, with easy sample questions to practise

View Article


last digit

how to know the last digit of a 1000 digit long number .. also can we also store such a large number in c++.. if yes, how...

View Article

nzec error in python.

hey! This is the code for the trianglesum problem. I'm getting an nzec error. I though it is due to some extra spaces problem. But even after using split() it doesn't work. I've checked the forum but...

View Article

Brute force solution for DCE05 (Odd) gives WA

#include <stdio.h> #include <math.h> int main (void) { int x, y, z; scanf ("%i", &x); for (x; x > 0; --x) { scanf ("%i", &y); if ( y == 0 ) printf ("1\n"); else if (y == 1)...

View Article


Time limit is exceeded

Hi,I have written the following code in PHP for problem http://www.codechef.com/problems/A4/while(FALSE !== ($t = fgets(STDIN))) { $n = array(); $k = array(); for($i = 0; $i < $t; $i++) { list($n[],...

View Article


Find Median in an Unsorted Array Without Sorting it

Given an unsorted Array A[1,2,3,.....N], Find the Medians in this array without sorting it in an efficient Way?

View Article

ACM ICPC 2013 World Final Live

You can watch ACM ICPC 2013 World Finals live - http://icpc2013.ru/competition/live.xmlIt has both Video and live scores. It has started, so go ahead and cheer for your country! :DA very nice map...

View Article

Factorisation in c++

how to factorise any prime number in c++ ??

View Article

How can I add something to the getting started page?

The Getting Started page should be a page where someone who wants to start programming should be able to find good resources on the web to do so. However, the present page is not adequate. Also it is...

View Article


WA in ALETHIO (june cookoff)

http://www.codechef.com/problems/ALETHIOI have taken of all border cases like: 1. string of all zeroes 2. no starting redundant zeroes in output 3. giving correct ans for all the test cases I could...

View Article

INVITES - Editorial

Problem Link:PracticeContestDifficulty:MediumPre-requisites:Dynamic Programming, TreeProblem:Given N families, each of whom declares exactly one enemy among the remaining families, find how many ways...

View Article


stone game - wrong Answer

Can someone please tell me where i went wrong? It gives the required output as the test case but it gave me a wrong answer when submitted. Here is the link to my code : http://ideone.com/9Slw9d

View Article

Problems from ACM ICPC 2013

I would like to ask you if you will post the problem from ACM ICPC 2013 on codechef? (post = put them on practice session).

View Article


Small improvements for code chef

I was thinking of what improvements can be done to code chef without some big effort like a new feature but just some small tweaking . I came up with the following list : 1. Include global time...

View Article

whats wrong..

to calculate:last digit of a^c (a can be upto 1000 digits and c upto 18 digits) plss.. point out the fallacy in the code....#include<iostream.h> #include<math.h> #include<string.h>...

View Article

Division of problems by difficulty level

When the editorials are published there are 5 kind of divisions for difficulty level : 1. Cakewalk 2. Simple 3. Easy 4. Medium 5. Hard However , when the problems move to practice section the first...

View Article
Browsing all 40121 articles
Browse latest View live


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