Results 1 to 5 of 5

Thread: & Java

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Eclipse Plugin Developer aphex's Avatar
    Join Date: Mar:2003
    Location: Karlsruhe
    Posts: 546

    & Java

    ,
    :

    a² + b² = c² .
    a + b + c = 1000.
    abc
    , projecteuler.net .
    , . 31875000

    Code:
    public class Pythagoreantrapet {
      public static void main(String args[]) {
      	double a=1;
      	double b=1;
      	double k;
      	double kk;
      	for(a=1;a<1000;a++){
        		for(b=1;b<1000;b++){
       		    k=((a+b)+Math.pow((double)(a*a+b*b),(double)1/2));
      			kk=1000*(a+b)-a*b;  			
      			if (kk==500000) {  				
      				Out.println(k);
      				Out.println(kk);
      				}  				
      		}
    	} 
        }}

  2. #2
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    , , , :
    Code:
    >>> for a in range(1,1000):
    ...     for b in range(a,1000):
    ...             c = 1000 - (a + b)
    ...             if (a*a + b*b) == c*c:
    ...                     print a, b, c, a*b*c
    ...
    200 375 425 31875000
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  3. #3
    Eclipse Plugin Developer aphex's Avatar
    Join Date: Mar:2003
    Location: Karlsruhe
    Posts: 546
    int, .

    A Pythagorean triplet is a set of three natural numbers, a<b<c, for which,
    a&#178; + b&#178; = c&#178;

    For example, 3&#178; + 4&#178; = 9 + 16 = 25 = 5&#178;.

    There exists exactly one Pythagorean triplet for which a + b + c = 1000.
    Find the product abc.


  4. #4
    MFrost's Avatar
    Join Date: Aug:2005
    Location: /
    Posts: 203
    Quote Originally Posted by aphex View Post

    ...three natural numbers...
    ... Natural , .. ...

  5. #5
    Eclipse Plugin Developer aphex's Avatar
    Join Date: Mar:2003
    Location: Karlsruhe
    Posts: 546
    . !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |