Nasıl bir mantık kullanmalıyım?

Kodla Büyü

sweetsw

Site Gezgini
Mesajlar
69
Bu soruyu nasıl bir mantık kullanarak çözebilirim arkadaşlar??
 

Ekli dosyalar

  • Resim1 (2).jpg
    Resim1 (2).jpg
    83.6 KB · Görüntüleme: 1,307
int[] d = new int[9];
for (int h = 0; h < 9; h++)
{
d[h] = 0;
}
for (int i = 1; i < 10; i++)
{
d[0] = i;
for (int j = 1; j < 10; j++)
{
if (d[0] != j) d[1] = j;
for (int k = 1; k < 10; k++)
{
if (!d.Contains(k)) d[2] = k;
for (int l = 1; l < 10; l++)
{
if (!d.Contains(l)) d[3] = l;
for (int m = 1; m < 10; m++)
{
if (!d.Contains(m)) d[4] = m;
for (int n =1; n < 10; n++)
{
if (!d.Contains(n)) d[5] = n;
for (int o =1; o < 10; o++)
{
if (!d.Contains(o)) d[6] = o;
for (int p = 1; p < 10; p++)
{
if (!d.Contains(p)) d[7] = p;
for (int q = 1; q < 10; q++)
{
if (!d.Contains(q)) d[8] = q;
string a = d[0].ToString();
a = a + d[1].ToString();
a = a + d[2].ToString();
a = a + d[3].ToString();
a = a + d[4].ToString();
a = a + d[5].ToString();
a = a + d[6].ToString();
a = a + d[7].ToString();
a = a + d[8].ToString();
if (!a.Contains('0'))
{

int t11=d[0]+d[1]+d[2]+d[3]+d[4];
int t12=d[5]+d[6]+d[7]+d[8];
int t21 = d[2] + d[3] + d[4] + d[5];
int t22 = d[0] + d[1] + d[6] + d[7] + d[8];
int t31 = d[0] + d[1] + d[2] + d[8];
int t32 = d[3] + d[4] + d[5] + d[6] + d[7];

if ((t11==t12)&&(t21==t22)&&(t31==t32))
textBox1.Text += a + "\r\n";
Application.DoEvents();
}

d[8] = 0;

}
d[7] = 0;
}
d[6] = 0;
}
d[5] = 0;
}
d[4] = 0;
}
d[3] = 0;
}
d[2] = 0;
}
d[1] = 0;
}
d[0] = 0;
}


Çözüm bu . ancak sonuç yok.
 
Olmuş mu hocam
 

Ekli dosyalar

  • 2015-11-15 17.47.21.jpg
    2015-11-15 17.47.21.jpg
    121.2 KB · Görüntüleme: 1,228
Teşşekür ederim arkadaşlar..bende yaptım dizi kullanmadan farklı bir mantıkla fakat tüm şartlar sağlandığıda bir sonuç çıkmıyor dedim herhalde ben yanlış buluyorum..Hocam çözmüş ama bilgisayara nasıl aktarmalı bilmiyorum.. ki sorudan anladığım kadarıyla tek bir sonuç yok..
 
sweetsw' Alıntı:
Teşşekür ederim arkadaşlar..bende yaptım dizi kullanmadan farklı bir mantıkla fakat tüm şartlar sağlandığıda bir sonuç çıkmıyor dedim herhalde ben yanlış buluyorum..Hocam çözmüş ama bilgisayara nasıl aktarmalı bilmiyorum.. ki sorudan anladığım kadarıyla tek bir sonuç yok..
hocam merak ettim siz nasıl çözdünüz. çözümünüzü paylaşırsanız sevinirim. mantığımı geliştirmiş olurum.
 
Bulunan çözümler
abdcefghk
156483279
156483729
156843279
156843729
157293468
157293648
157923468
157923648
158267349
158267439
158463297
158463927
158627349
158627439
158643297
158643927
159273486
159273846
159347268
159347628
159437268
159437628
159723486
159723846
165492378
165492738
165942378
165942738
167358249
167358429
167538249
167538429
168372495
168372945
168732495
168732945
169248357
169248537
169428357
169428537
183576249
183576429
183592467
183592647
183756249
183756429
183952467
183952647
185294376
185294736
185924376
185924736
186374295
186374925
186734295
186734925
187462593
187462953
187642593
187642953
189246573
189246753
189426573
189426753
192675348
192675438
192683457
192683547
192765348
192765438
192863457
192863547
193485267
193485627
193567248
193567428
193657248
193657428
193845267
193845627
194385276
194385726
194835276
194835726
196275384
196275834
196725384
196725834
197265483
197265843
197453682
197453862
197543682
197543862
197625483
197625843
198247563
198247653
198345672
198345762
198427563
198427653
198435672
198435762
245681379
245681739
245861379
245861739
246573189
246573819
246753189
246753819
247563198
247563918
247653198
247653918
248193567
248193657
248357169
248357619
248537169
248537619
248913567
248913657
249167358
249167538
249183576
249183756
249371685
249371865
249617358
249617538
249731685
249731865
249813576
249813756
264591387
264591837
264951387
264951837
265483197
265483917
265843197
265843917
267193485
267193845
267349158
267349518
267381594
267381954
267439158
267439518
267831594
267831954
267913485
267913845
268159347
268159437
268519347
268519437
273486159
273486519
273846159
273846519
275384196
275384916
275834196
275834916
276194385
276194835
276914385
276914835
279156483
279156843
279516483
279516843
291684357
291684537
291864357
291864537
293468157
293468517
293648157
293648517
294376185
294376815
294736185
294736815
295186374
295186734
295816374
295816734
297158463
297158643
297354681
297354861
297518463
297518643
297534681
297534861
345672198
345672918
345762198
345762918
347268159
347268519
347628159
347628519
348192675
348192765
348912675
348912765
349158267
349158627
349518267
349518627
354681297
354681927
354861297
354861927
357169248
357169428
357291684
357291864
357619248
357619428
357921684
357921864
358249167
358249617
358429167
358429617
371685249
371685429
371865249
371865429
372495168
372495618
372945168
372945618
374295186
374295816
374925186
374925816
376185294
376185924
376815294
376815924
378165492
378165942
378615492
378615942
379245681
379245861
379425681
379425861
381594267
381594627
381954267
381954627
384196275
384196725
384916275
384916725
385276194
385276914
385726194
385726914
387264591
387264951
387624591
387624951
425681379
425681739
425861379
425861739
426573189
426573819
426753189
426753819
427563198
427563918
427653198
427653918
428193567
428193657
428357169
428357619
428537169
428537619
428913567
428913657
429167358
429167538
429183576
429183756
429371685
429371865
429617358
429617538
429731685
429731865
429813576
429813756
435672198
435672918
435762198
435762918
437268159
437268519
437628159
437628519
438192675
438192765
438912675
438912765
439158267
439158627
439518267
439518627
453682197
453682917
453862197
453862917
457192683
457192863
457912683
457912863
462593187
462593817
462953187
462953817
463297158
463297518
463927158
463927518
467183592
467183952
467813592
467813952
468157293
468157923
468517293
468517923
482591673
482591763
482951673
482951763
483197265
483197625
483279156
483279516
483671592
483671952
483729156
483729516
483761592
483761952
483917265
483917625
485267193
485267913
485627193
485627913
486159273
486159723
486519273
486519723
491682573
491682753
491862573
491862753
492378165
492378615
492738165
492738615
493572681
493572861
493752681
493752861
495168372
495168732
495618372
495618732
516483279
516483729
516843279
516843729
517293468
517293648
517923468
517923648
518267349
518267439
518463297
518463927
518627349
518627439
518643297
518643927
519273486
519273846
519347268
519347628
519437268
519437628
519723486
519723846
534681297
534681927
534861297
534861927
537169248
537169428
537291684
537291864
537619248
537619428
537921684
537921864
538249167
538249617
538429167
538429617
543682197
543682917
543862197
543862917
547192683
547192863
547912683
547912863
563198247
563198427
563918247
563918427
567248193
567248913
567428193
567428913
572681493
572681943
572861493
572861943
573189246
573189426
573491682
573491862
573819246
573819426
573941682
573941862
576249183
576249813
576429183
576429813
591387264
591387624
591673482
591673842
591763482
591763842
591837264
591837624
592467183
592467813
592483671
592483761
592647183
592647813
592843671
592843761
593187462
593187642
593817462
593817642
594267381
594267831
594627381
594627831
615492378
615492738
615942378
615942738
617358249
617358429
617538249
617538429
618372495
618372945
618732495
618732945
619248357
619248537
619428357
619428537
624591387
624591837
624951387
624951837
625483197
625483917
625843197
625843917
627193485
627193845
627349158
627349518
627381594
627381954
627439158
627439518
627831594
627831954
627913485
627913845
628159347
628159437
628519347
628519437
642593187
642593817
642953187
642953817
643297158
643297518
643927158
643927518
647183592
647183952
647813592
647813952
648157293
648157923
648517293
648517923
653198247
653198427
653918247
653918427
657248193
657248913
657428193
657428913
671592483
671592843
671952483
671952843
672198345
672198435
672918345
672918435
673482591
673482951
673842591
673842951
675348192
675348912
675438192
675438912
681297354
681297534
681379245
681379425
681493572
681493752
681739245
681739425
681927354
681927534
681943572
681943752
682197453
682197543
682573491
682573941
682753491
682753941
682917453
682917543
683457192
683457912
683547192
683547912
684357291
684357921
684537291
684537921
685249371
685249731
685429371
685429731
723486159
723486519
723846159
723846519
725384196
725384916
725834196
725834916
726194385
726194835
726914385
726914835
729156483
729156843
729516483
729516843
731685249
731685429
731865249
731865429
732495168
732495618
732945168
732945618
734295186
734295816
734925186
734925816
736185294
736185924
736815294
736815924
738165492
738165942
738615492
738615942
739245681
739245861
739425681
739425861
752681493
752681943
752861493
752861943
753189246
753189426
753491682
753491862
753819246
753819426
753941682
753941862
756249183
756249813
756429183
756429813
761592483
761592843
761952483
761952843
762198345
762198435
762918345
762918435
763482591
763482951
763842591
763842951
765348192
765348912
765438192
765438912
813576249
813576429
813592467
813592647
813756249
813756429
813952467
813952647
815294376
815294736
815924376
815924736
816374295
816374925
816734295
816734925
817462593
817462953
817642593
817642953
819246573
819246753
819426573
819426753
831594267
831594627
831954267
831954627
834196275
834196725
834916275
834916725
835276194
835276914
835726194
835726914
837264591
837264951
837624591
837624951
842591673
842591763
842951673
842951763
843197265
843197625
843279156
843279516
843671592
843671952
843729156
843729516
843761592
843761952
843917265
843917625
845267193
845267913
845627193
845627913
846159273
846159723
846519273
846519723
861297354
861297534
861379245
861379425
861493572
861493752
861739245
861739425
861927354
861927534
861943572
861943752
862197453
862197543
862573491
862573941
862753491
862753941
862917453
862917543
863457192
863457912
863547192
863547912
864357291
864357921
864537291
864537921
865249371
865249731
865429371
865429731
912675348
912675438
912683457
912683547
912765348
912765438
912863457
912863547
913485267
913485627
913567248
913567428
913657248
913657428
913845267
913845627
914385276
914385726
914835276
914835726
916275384
916275834
916725384
916725834
917265483
917265843
917453682
917453862
917543682
917543862
917625483
917625843
918247563
918247653
918345672
918345762
918427563
918427653
918435672
918435762
921684357
921684537
921864357
921864537
923468157
923468517
923648157
923648517
924376185
924376815
924736185
924736815
925186374
925186734
925816374
925816734
927158463
927158643
927354681
927354861
927518463
927518643
927534681
927534861
941682573
941682753
941862573
941862753
942378165
942378615
942738165
942738615
943572681
943572861
943752681
943752861
945168372
945168732
945618372
945618732
951387264
951387624
951673482
951673842
951763482
951763842
951837264
951837624
952467183
952467813
952483671
952483761
952647183
952647813
952843671
952843761
953187462
953187642
953817462
953817642
954267381
954267831
954627381
954627831
 
//Kod
int[] d = new int[9];
for (int h = 0; h < 9; h++)
{
d[h] = 0;
}
for (int i = 1; i < 10; i++)
{
d[0] = i;
for (int j = 1; j < 10; j++)
{
if (d[0] != j) d[1] = j;
for (int k = 1; k < 10; k++)
{
if (!d.Contains(k)) d[2] = k;
for (int l = 1; l < 10; l++)
{
if (!d.Contains(l)) d[3] = l;
for (int m = 1; m < 10; m++)
{
if (!d.Contains(m)) d[4] = m;
for (int n = 1; n < 10; n++)
{
if (!d.Contains(n)) d[5] = n;
for (int o = 1; o < 10; o++)
{
if (!d.Contains(o)) d[6] = o;
for (int p = 1; p < 10; p++)
{
if (!d.Contains(p)) d[7] = p;
for (int q = 1; q < 10; q++)
{
if (!d.Contains(q)) d[8] = q;
string a = d[0].ToString();
a = a + d[1].ToString();
a = a + d[2].ToString();
a = a + d[3].ToString();
a = a + d[4].ToString();
a = a + d[5].ToString();
a = a + d[6].ToString();
a = a + d[7].ToString();
a = a + d[8].ToString();
if (!a.Contains('0'))
{

int t11 = d[0] + d[1] + d[2] + d[3] + d[4];
//int t12 = d[5] + d[6] + d[7] + d[8];
//int t21 = d[2] + d[3] + d[4] + d[5];
int t22 = d[0] + d[1] + d[6] + d[7] + d[8];
//int t31 = d[0] + d[1] + d[2] + d[8];
int t32 = d[3] + d[4] + d[5] + d[6] + d[7];

if ((t11 == t22) && (t22 == t32))
textBox1.Text += a + "\r\n";
Application.DoEvents();
}

d[8] = 0;

}
d[7] = 0;
}
d[6] = 0;
}
d[5] = 0;
}
d[4] = 0;
}
d[3] = 0;
}
d[2] = 0;
}
d[1] = 0;
}
d[0] = 0;
}
 
hocam benim programda bazı sayıları birbiriyle eşit veriyor o kısmı halledemedim bir türlü sizin programı inceleyince benim mantıktan bir sonuç elde edilmiyor gibi..
 
Geri
Üst