當前位置:編程學習大全網 - 網站源碼 - 求c語言高手,我想要各種不同的算法源碼,想法,偽代碼都行

求c語言高手,我想要各種不同的算法源碼,想法,偽代碼都行

#include "stdafx.h"

#include <stdio.h>

/*

A B C D E F

0 1 2 3 4 5

1 1 1 0 0 1

*/

int Judge(int Arr[6] )

{

int a = Arr[0] + Arr[1] >= 1 ; // A + B >= 1

int b = Arr[0] + Arr[4] + Arr[5] >= 2 ;

int c = Arr[0] + Arr[3] != 2 ;

int d = Arr[1] + Arr[2] != 1 ;

int e = Arr[2] + Arr[3] == 1 ;

int f = Arr[3] + !Arr[4] >= 1 ; // !d -> !e d V !e

if( a + b + c + d + e + f == 6 )

return 1 ;

else

return 0 ;

}

void assign( int *a , int n )

{

if( n >= 6 )

{

if( Judge( a ) )

{

for( int i = 0 ; i < 6 ; i++ )

printf("%3d",a[i]) ;

printf("\n") ;

}

return ;

}

a[n] = 0 ;

assign( a , n+1 ) ;

a[n] = 1 ;

assign( a, n+1 ) ;

}

int main()

{

int a[6] ;

assign( a , 0 ) ;

return 0 ;

}

  • 上一篇:華為榮耀6dts是什麽意思
  • 下一篇:奪冠SCRM:企業微信話術庫在哪裏?
  • copyright 2024編程學習大全網