CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • May Cook-Off
    • May Long 2012
    • April Cook-Off
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
    • Event Calendar
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » Amritapuri ICPC Warmup 1 » A Simple Equation

A Simple Equation

Problem code: EQUATION

  • All Submissions

All submissions for this problem are available.

Statement

Given N,A,B,C, find how many solutions exist to the equation : a + b + c ≤ N, such that 0 ≤ a ≤ A, 0 ≤ b ≤ B, 0 ≤ c ≤ C.

Input

The first line contains the number of test cases T (1<= T <= 50). Each test case contains 4 integers, N,A,B,C. 0 ≤ N,A,B,C ≤ 2500

Output

Output T lines, one for each test case.

Sample Input

2
4 3 2 1
1 1 1 1

Sample Output

20
4


Date: 2010-09-10
Time limit: 1

s
Source limit: 50000
Languages: C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp SCALA HASK ERL CAML CLPS PRLG WSPC BF ICK JS


  • Submit

Comments

  • Login or Register to post a comment.

a solution means a,b,c have

bbsgbbsg @ 24 Sep 2010 08:08 PM

a solution means a,b,c have to be integers right??

 

a solution means a,b,c have

bbsgbbsg @ 24 Sep 2010 08:10 PM

a solution means a,b,c have to be integers right??

 

input is given with a space

kothari2015 @ 24 Sep 2010 08:13 PM

input is given with a space between the numbers or as a string?

@Vijay: That is correct.

harsha_adm @ 24 Sep 2010 08:14 PM

@Vijay: That is correct.

@Amit: A space between

harsha_adm @ 24 Sep 2010 08:26 PM

@Amit: A space between numbers

how to submit the code

rakesh_guru @ 24 Sep 2010 08:57 PM

how to submit the code

@Rakesh: Have you browsed

harsha_adm @ 24 Sep 2010 09:02 PM

@Rakesh: Have you browsed through the FAQ ?

i m getting restricted

nntnag17 @ 24 Sep 2010 09:06 PM

i m getting restricted content,why i cant submit

@harsha:no i didnt find any

rakesh_guru @ 24 Sep 2010 09:09 PM

@harsha:no i didnt find any thing in FAQ

@anant: you need to login

admin @ 24 Sep 2010 09:10 PM

@anant: you need to login with team id to submit. You cannot submit with you individual userid.

how to submit???? n how to

bmaddy1 @ 24 Sep 2010 09:15 PM

how to submit???? n how to get the team id???

is it neccessary tht a,b,c

fire_bird @ 24 Sep 2010 09:35 PM

is it neccessary tht a,b,c should be intrger??

@Rakesh @Ankit: Registration

admin @ 24 Sep 2010 09:38 PM

@Rakesh @Ankit: Registration is now over. You needed to regiter for a team before the contest to submit a solution. The rules are mentioned here

@Firebird: yes.

harsha_adm @ 24 Sep 2010 09:38 PM

@Firebird: yes.

hey can any tell me how to

jones1a19 @ 24 Sep 2010 09:59 PM

hey can any tell me how to submit...........?

I am unable to

Parallel_coders @ 24 Sep 2010 10:02 PM

I am unable to submit.restricted content!! plese check..

@nikhil: you need to login

admin @ 24 Sep 2010 10:18 PM

@nikhil: you need to login with your team id that you must have registered for this contest. Let us know if you doing this and still unable to submit.

Hi ! Can anyone explain the

damn @ 24 Sep 2010 11:18 PM

Hi !

Can anyone explain the solutions of the team "star_teamname" ?

How does the formula works ?

even O(n^2) giving tle......

mkagenius @ 25 Sep 2010 02:05 AM

even O(n^2) giving tle......

can any body please explain

mounikasiva @ 25 Sep 2010 11:39 PM

can any body please explain the formulae

/*This will work

prateekchef @ 27 Sep 2010 11:37 PM

/*This will work */

#include<stdio.h>
int main(void)
{
  int n,a,b,c,A,B,C,m,count;
  scanf("%d",&n);
  while(n-- > 0)
  {
    scanf("%d %d %d %d",&m,&A,&B,&C);
    count=0;
    for(a=0;a<=A;a++)
    for(b=0;b<=B;b++)
    for(c=0;c<=C;c++)
    {
      if(a+b+c <= m)
      count++;
    }
    printf("%dn",count);
  }
  return 0;
}

I have the best solution of

prateekchef @ 27 Sep 2010 11:39 PM

I have the best solution of this problem, which is the easiest  solution till available.

this will not work ...Time

mounikasiva @ 4 Nov 2010 08:41 PM

this will not work ...Time limit exceedign will come

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of computer programming. At CodeChef we work hard to revive the geek in you by hosting programming contests on a monthly basis. We also aim to have training sessions and events related to online programming for programmers around the world. Apart from providing a platform for programming competitions, CodeChef also has various tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our judge accepts solutions in over 35+ programming languages. Online programming was never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming competitions that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly programming contests and the shorter format Cook-off programming contests. Put yourself up for recognition and win great prizes. Prizes worth up to Rs.20,000 and $700 are up for grabs every month along with lots more CodeChef goodies.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be part of CodeChefs Forums and interact with all our programmers love helping out other programmers and share their ideas.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. Be a part of the CodeChef community through CodeChef meetups and techtalks. You can also host a programming contest for your institute on CodeChef and be a guest author on our blog.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com