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 » Algothika 2010 » Triangles

Triangles

Problem code: AD2

  • All Submissions

All submissions for this problem are available.

A triangle is one of the basic shapes of geometry and in terms of definition

"it is a polygon with three corners or vertices and three sides or edges which are line segments"

Now, one day cody bought a wire and decided to make triangles with it such that each triangle has all integral sides,with at least one integral angle. Cody as usual want to skip calculations and need your help to make it possible.

Given the value of n(1<=n<=10^8), calculate all the possible triangles with the above condition such that the perimeter does not exceed n.

Input

The first line contains t, the number of test cases (1<=t<=10000). Followed by t lines it contains various values of n.

Output

For every test case, print the number of triangles possible

Example

Input:
3
12
102
256

Output:
4
34
85  

Warning
The time limit is strict......


Date: 2010-02-27
Time limit: 2s
Source limit: 50000
Languages: C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C# 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.

Admins, are you sure that

dzhulgakov @ 4 Mar 2010 07:15 PM

Admins, are you sure that problem is correctly formulated? Sample case seems to be incorrect. There are exactly 34 equilateral triangles for n = 102, but there are some non-equilateral triangles as well. For example, triangle with sides 5, 21 and 19 have an angle of 60 degrees opposite to the side of length 19. So the answer should be at least 35 in this case :)

Join us also on

nirley.gupta @ 4 Mar 2010 08:44 PM

Join us also on facebook

ALGOTHIKA

Please post all your doubts

nirley.gupta @ 4 Mar 2010 08:44 PM

Please post all your doubts here or mail it to algothika.algochallenge@gmail.com

ALGOTHIKA ORGANIZER

Nirley Gupta

@Nirley Gupta I'm unable to

vish @ 4 Mar 2010 10:48 PM

@Nirley Gupta

I'm unable to register on ur site (http://www.maitlive.com/html/events/register.php ) its showing 404 Not Found.

Is registration has been closed.

@Dmytro Dzhulgakov yes i

darkhawk @ 4 Mar 2010 10:48 PM

@Dmytro Dzhulgakov

yes i think u r right

@soc the registrations are

nirley.gupta @ 4 Mar 2010 11:18 PM

@soc

the registrations are open........

i doubt why r u getting this error...... please check it again.....

@Dmytro Actually this easy

nirley.gupta @ 5 Mar 2010 10:37 AM

@Dmytro

Actually this easy problem has just slip from our side and got unnoticed about the test cases.......

The test cases are only for equilateral triangles.................

 

As we have got a lot of submissions over it, so we will not be able to make change... but if u still want to solve it please mail solution to algothika.algochallenge@gmail.com

For example....

n=102 triangles-85

n-256 triangles-273

 

Let there be an easy problem to incorporate all kinds of programmers........


PLEASE MAKE THIS CHANGE IN

nirley.gupta @ 5 Mar 2010 10:39 AM

PLEASE MAKE THIS CHANGE IN THE PROBLEM STATEMENT

 

"calculate all possible equilateral triangles"

 

All of u got a very easy problem...........so enjoy

Anyone still interested in

nirley.gupta @ 5 Mar 2010 10:41 AM

Anyone still interested in mailing the code not considering the equilateral triangles case.......... please mail it to

algothika.algochallenge@gmail.com and we will mail u the result............

@Nirley Can u tell me why am

vish @ 6 Mar 2010 01:08 AM

@Nirley

Can u tell me why am i getting runtime error when is submitted this code.......

#include<stdio.h>
int main(){ }

i'm trying to solve this but

vish @ 6 Mar 2010 01:10 AM

i'm trying to solve this but ur rumtime error .........

its only in c but not in c++

vish @ 6 Mar 2010 01:13 AM

its only in c but not in c++

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