TrianglesProblem code: AD2 |
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 |
Comments

Fetching successful submissions

Admins, are you sure that
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
Join us also on facebook
ALGOTHIKA
Please post all your doubts
Please post all your doubts here or mail it to algothika.algochallenge@gmail.com
ALGOTHIKA ORGANIZER
Nirley Gupta
@Nirley Gupta I'm unable to
@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
@Dmytro Dzhulgakov
yes i think u r right
@soc the registrations are
@soc
the registrations are open........
i doubt why r u getting this error...... please check it again.....
@Dmytro Actually this easy
@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
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
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
@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
i'm trying to solve this but ur rumtime error .........
its only in c but not in c++
its only in c but not in c++