You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; public class Solution {
public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scan= new Scanner(System.in); int a= scan.nextInt(); long []ar= new long[a]; for(int i=0;i<a;i++) { ar[i]= scan.nextInt(); } long count=0; long count1=0; for(long x=1;x<ar[0];x++) { for(int y=1;y<ar[0];y++) { if(((ar[0]==((x*x)+(y*y)))) &&((ar[0]==((x*x)+(2*y*y)))) && ((ar[0]==((x*x)+(3*y*y)))) &&((ar[0]==((x*x)+(7*y*y))))) { ++count; } } } for(long x=1;x<ar[1];x++) { for(int y=1;y<ar[1];y++) { if(((ar[1]==((x*x)+(y*y)))) &&((ar[1]==((x*x)+(2*y*y)))) && ((ar[1]==((x*x)+(3*y*y)))) &&((ar[1]==((x*x)+(7*y*y))))) { ++count1; } } } System.out.println(count); System.out.println(count1); }
}
NOTE:- Guys m' not able to find the mistake please refer this code and ping me.
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #229: Four Representations using Squares
You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; public class Solution {
}
NOTE:- Guys m' not able to find the mistake please refer this code and ping me.