Comments on the new program

Source: Internet
Author: User


// Main program
/*
Array: a [1] ~ A [5] indicates the judgment made by the current person of a, B, c, d, e on others,
B [1] ~ B [5] indicates that the current person is able to determine the launch status.
Values [1] ~ Values [5] is the number of white spaces described in a, B, c, d, and e.
1, 0 indicates white, black, that is, a [1] = 1, white, B [1] = 1, white
Judging from A to D, take four rounds. Each time, based on your own description, judge the status of another person a [], then infer the status of the person B [] before it, and modify its status.
*/
# Include <stdio. h>
# Include <papers. h>

Void main (){

Unsigned char j;

For (j = 1; j <= 4; j ++ ){
Judge (j );
}

}

Void judge (unsigned char num ){

Unsigned char I;
White_number = 0;
 
For (I = 1; I <= 4; I ++) {// do not consider e first
If (values [I] = values [num]) & (B [I] = 1) & (values [I]> = 1 )) {a [I] = 1;} // if it matches the current description, it is regarded as "white"
If (values [I] = values [num]) & (B [I] = 0) {B [num] = 0 ;} // same as the description already set as "", it is regarded as "" directly"
Else if (values [I] = 1) & (values [num] = 0) {a [I] = 0; B [num] = 0 ;} // The description of the conflict is regarded as "black"
Else {a [I] = 0 ;}
White_number = white_number + a [I];
}

White_number = white_number-a [num];

If (white_number = values [num]) {} // tentatively set to whitelist
Else if (white_number = 1) & (values [num] = 0) {B [5] = 1 ;}// separate e
Else {B [num] = 0 ;}

Print (num );&

<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.