Poj Solution 1543

http://poj.org/problem?id=1543

//* @author: 82638882@163.com
import java.util.Scanner;
public class Main
{
 public static void main(String[] args)
  {
   Scanner in=new Scanner(System.in);
   int a=in.nextInt();
   for(int i=6;i<=a;i++)
    {
     for(int j=2;j< a;j++)
    for(int m=j;m< a;m++)
     for(int n=m;n< a;n++)
      {
       if((n*n*n+m*m*m+j*j*j)==i*i*i)
        System.out.println("Cube = "+i+", Triple = ("+j+","+m+","+n+")");
      }
     }
  }
}
											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *