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.
- All Contests
- ProjectEuler+
- Project Euler #173: Using up to one million tiles how many different "hollow" square laminae can be formed?
- Discussions
Project Euler #173: Using up to one million tiles how many different "hollow" square laminae can be formed?
Project Euler #173: Using up to one million tiles how many different "hollow" square laminae can be formed?
Contest ends in
+ 0 comments simple c++ solution::
#include<bits/stdc++.h> using namespace std; int main() { long n; cin>>n; long long tiles=n/4; long long k=int(sqrt(tiles)); long long sum=0; for(int i=1;i<=k;i++) { sum=sum+(tiles/i-i); } cout<<sum; return 0; }
+ 0 comments I was able to make it working using the below algorithm. private static long findNums(long totalTiles){ int maxLvel = (int)Math.sqrt(totalTiles-1)/2; long count = 0; for(int i = 1;i<=maxLvel;i++){ //Finds number of laminates of the same level. For a a given hole size h and a level l (2*(l+h/2))^2 <= tiles + h^2 count += (long) ((totalTiles/(4*i))-i); } return count; }
+ 0 comments Is there no way to find out the input of each test case?
+ 0 comments This is my program. But it faces a time-out since the range extends to 10^12. My program's complexity is O(n^2). Any tips?
int main() {
long int k,n,i,f,count=0,temp; int max; scanf("%ld",&i); k=1; f=(4*k)+4; for(n=0;n<=i;n++) { if(n==0) f=f+(8*n); else f=f+8; temp=temp+f; if(temp<=i) max=n; else break; } for(k=1;k<i;k++) { f=(4*k)+4; temp=0; for(n=0;n<=max;n++) { if(n==0) f=f+(8*n); else f=f+8; temp=temp+f; if(temp<=i) { count++; } } } printf("%ld",count);
}
+ 0 comments PLEASE IF SOMEONE COULD HELP ME WITH THE BELOW CODE::: double d=Math.sqrt((double)n); int y=(int)d; for(int g=(int)d;g>=3;g--) { int p=g*g; if(g%2==0) { int v=2; int fl=v*v; while(fl
Load more conversations
Sort 16 Discussions, By:
Please Login in order to post a comment