a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
Find the product abc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> // solved by Md. shohanur Rahaman | |
int main() | |
{ | |
int a,b,c,result; | |
int n,m; | |
for(n=2; ;n++){ | |
for(m=1;m<n;m++){ | |
a=(n*n)-(m*m); | |
b=2*n*m; | |
c=(n*n)+(m*m); | |
if(a+b+c==1000){ | |
printf("%d %d %d \n",a,b,c); | |
printf("%d\n",a*b*c); | |
return ; | |
} | |
}// end child loop | |
; | |
} // end parent loop | |
return 0; | |
} | |
Projecteuler.net
সাইটে আপনার সমাধান সঠিক হলে আপনি ঐ সমাধানের একটি উপর বিস্তারিত অ্যালগরিদম সহ একটি pdf file পাবেন যেখানে ঐ সমস্যা সমাধানের জন্য কি থিওরি ব্যাবহার করতে হবে সব বিস্তারিত ব্যাখ্যা করা আছে। তবে সমাধান না করা পর্যন্ত আপনি pdf file টি পাবেন না। নিচে ফাইলটির ডাউনলোড লিংক দেওয়া আছে ডাউনলোড করে নিতে পারেন।