5 Şubat 2013 Salı

Fourth solution of Project Euler







#include "stdafx.h"
#include <iostream>
using namespace std;                  

void findout() {
int a,b,x,c=1,y,z;
for(a=999;a>=100;a--) {
for(b=999;b>=100;b--) {
x = a*b;
if((x/100000) == (x % 10) && ((x/10000) % 10) == ((x%100) / 10) && ((x/1000) %10) == ((x%1000) / 100) && x>c) {
c=x;
y=a;
z=b;
}
}
if((x/100000) == (x % 10) && ((x/10000) % 10) == ((x%100) / 10) && ((x/1000) %10) == ((x%1000) / 100) && x>c) {
c=x;
y=a;
z=b;
}

}
cout << "Cevap :" << c << "  sayilar :" << y << " ve " << z <<  "   efekanpulatli.blogspot.com" <<   endl;
}

int main()
{
findout();
system("pause");
return 0;
}

Hiç yorum yok:

Yorum Gönder