16 Şubat 2013 Cumartesi
Codeforces - Beatiful Year
Click and See Problem
#include "stdafx.h"
#include <iostream>
using namespace std;
void findout () {
int a,b=0,digon,digtw,digth,digfo;
bool c=false;
do {
cout << "Please Enter Bigger than 1000 and Smaller than 9000" << endl;
cin >> a;
}while(a<1000 || a > 9000);
do {
a++;
digon = a/1000;
digtw = (a - (digon* 1000)) / 100;
digth = (a % 100) / 10;
digfo = a %10;
if(digon == digtw || digon == digth || digon ==digfo || digtw == digth ||digtw == digfo || digth == digfo ) {
c = false;
}else {
c=true;
}
}while(c==false);
cout <<a << " efekanpulatli.blogspot.com" << endl;
}
int main() {
findout();
system("pause");
return 0;
}
9 Şubat 2013 Cumartesi
Third solution of Project Euler
#include "stdafx.h"
#include <iostream>
using namespace std;
int asalmi(unsigned long long x) {
unsigned long long x2=2,x3=0;
for(;x2<x;x2++) {
if(x % x2 == 0) {
x3++;
break;
};
}
if(x3 == 0) {
x3=1;
return x3;
} else {
x3=0;
return x3;
}
}
void findout() {
unsigned long long i=9851475143; // think why I shortened i ?
for(;i>0;i--) {
if(600851475143% i == 0 && asalmi(i) == 1) {
break;
}
}
cout << "Result :" << i << " efekanpulatli.blogspot.com" << endl;
}
int main()
{
findout();
system("pause");
return 0;
}
Twenty-first solution of Project Euler
#include "stdafx.h"
#include <iostream>
using namespace std;
void findout () {
int a,b,c,dizi[2][10001];
unsigned long long result=0;
for(a=1;a<10000;a++) {
dizi[0][a]=0;
for(b=1;b<a;b++) {
if(a%b==0) {
dizi[0][a]+=b;
dizi[1][a] =a;
}
}
}
for(a=1;a<10000;a++) {
for(b=1;b<10000;b++) {
if(a == dizi[0][b] && b == dizi[0][a] && a!=b) {
int d = dizi[1][a] + dizi[1][b];
result+=d;
cout << a << " toplamlari" << dizi[0][a]<< " "<< b << " toplamlari " << dizi[0][b] << endl;
}
}
}
cout << result/2 << " efekanpulatli.blogspot.com " << endl;
}
int main() {
findout();
system("pause");
return 0;
}
8 Şubat 2013 Cuma
Twelfth solution of Project Euler
#include "stdafx.h"
#include <iostream>
using namespace std;
void findout () {
int a,b,c,dizi[20000],d;
for(a=1;a<20000;a++) { //sayilari diziye atıyoruz
dizi[a] = (a * (a+1)) / 2;
}
for(b=9999;b<15000;b++) {
d=0;
for(c=1;c<=dizi[b];c++) {
if(dizi[b] %c == 0) {
d++;
}
}
if(d>500) {
cout << dizi[b] << " efekanpulatli.blogspot.com" << endl;
break;
}
}
}
int main() {
findout();
system("pause");
return 0;
}
7 Şubat 2013 Perşembe
Sixteenth solution of Project Euler
#include "stdafx.h"
#include <iostream>
using namespace std;
void findout() {
int dizi[1001] = {1},a,elde=0;
for(int i=1;i<1001;i++) {
for(a=0;a<1001;a++) {
if((dizi[a] * 2) < 10) { // elde gelmiyorsa
dizi[a] = ((dizi[a] * 2 ) + elde) % 10;
elde=0;
}else {
if(dizi[a+1] ==0) {
dizi [a] = ((dizi[a] * 2) + elde)%10;
dizi[a+1] = 1;
a++;
elde = 0;
}else {
dizi[a] = ((dizi[a] * 2) +elde) % 10;
elde = 1;
}
}
}
}
int tot=0;
for(int i=0;i<400;i++) {
tot+=dizi[i] ;
}
cout << tot << " efekanpulatli.blogspot.com" << endl;
}
int main()
{
findout();
system("pause");
return 0;
}
6 Şubat 2013 Çarşamba
Fourteenth solution of Project Euler
#include "stdafx.h"
#include <iostream>
using namespace std;
void findout() {
unsigned long long c=1,c2=0,a,b,result;
for(a=1;a<1000000;a++) {
b=a;
c=1;
do {
if(b % 2 == 1) { // if b is odd (eger b tekse)
b=((b*3) + 1);
c++;
}else { // if not (degilse)
b/=2;
c++;
}
}while(b!=1);
if(c>c2) {
c2=c;
result = a;
}
}
cout << "Sonuc :" << result << " efekanpulatli.blogspot.com" << endl;
}
int main()
{
findout();
system("pause");
return 0;
}
Tenth solution of Project Euler
#include "stdafx.h"
#include <iostream>
using namespace std;
void findout() {
int a,b,c;
unsigned long long tot=0;
for(a=2;a<2000000;a++) {
c=0;
for(b=2;b<a;b++) {
if(a%b == 0) {
c++;
break;}
}
if(c==0) {
tot+=a;
}
}
cout << tot<< " efekanpulatli.blogspot.com " << endl;
}
int main()
{
findout();
system("pause");
return 0;
}
Kaydol:
Kayıtlar (Atom)






