27 Mart 2013 Çarşamba

Thirty nineth solution of Project Euler - Integer right triangles








#include "stdafx.h"
#include <iostream>
#include<stdio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include "efe.h"
#include <time.h>
using namespace std;
void make() {
int m=0,counter=0,result=0,res=0;
for(int i=1;i<1001;i++) {
counter=0;
for(int k=i-2;k>=0;k--) {
for(int c=1;c<k;c++) {
m=i-(k+c);
if(m<k+c && m>k-c && k*k==(c*c+m*m)) {
counter++;
}
}


}

if(counter > res) {
res=counter;
result = i;
}
}
cout << "Project Euler - Problem 39(Integer right triangles)\n";
  cout << "Result :" << result << " efekanpulatli.blogspot.com" << endl;

}



int main()
{

clock_t tStart = clock();
make();
printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
system("pause");
return 0;
}


Hiç yorum yok:

Yorum Gönder