We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #229: Four Representations using Squares
Project Euler #229: Four Representations using Squares
Sort by
recency
|
6 Discussions
|
Please Login in order to post a comment
static LinkedHashMap counts = new
LinkedHashMap();
def count(y): flag1 , flag2,flag3,flag4,count=0,0,0,0,0 for n in range(y): i = 1 while i * i <= n : j = i while(j * j <= n) : if (i * i + j * j == n) : flag1=1 if (i*i+2*j*j == n): flag2=1 if (i*i+3*j*j == n): flag3=1 if (i*i+7*j*j == n): flag4=1 j+=1 if flag1 is 1 and flag2 is 1 and flag3 is 1 and flag4 is 1: count+=1 break i+=1 flag1,flag2,flag3,flag4=0,0,0,0 n+=1; return count
if name=='main': n=int(input().strip()) for i in range(n): x=int(input().strip()) r=count(x) print(r)
I WAS DOING THE PROBLEM ON FOUR REPRESENTAION USING SQUARES.
WELL THIS IS MY CODE AND I AM GETTING RUNTIME ERROR.PLEASE HELP ME RESOLVE THIS.
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.
tell if it is wrong
Question is complex can't able to understand