SGU 275 To xor or not to xor (Gaussian elimination element)

Source: Internet
Author: User

SGU 275 To xor or not to xor (Gaussian elimination element)

Question address: SGU 275

First of all, the greedy idea is that every binary bit should be 1 as much as possible, and whether it can be 1 should be solved by Gaussian elimination element. When this digit has a variable that can be set to 1, it indicates that this digit can be set to 1, and the variable is controlled, and then the bitwise is reduced to a low position.

The Code is as follows:

#include 
 
  #include 
  
   #include 
   
    #include 
    
     #include #include 
     
      #include 
      #include 
       
        #include 
        
         using namespace std;#define LL __int64#define pi acos(-1.0)const int mod=1e9+7;const int INF=1e9;const double eqs=1e-9;int mat[100][110], equ, var, vis[110];LL a[100];LL gauss(){ LL ans=0; int i, j, k, h; memset(vis,0,sizeof(vis)); for(i=equ-1;i>=0;i--){ ans<<=1; for(j=0;j
         
          =0;k--){ if(mat[k][j]){ for(h=0;h<=var;h++){ mat[k][h]^=mat[i][h]; } } } } } return ans;}int main(){ int n, i, k; LL y; scanf("%d",&n); equ=0; var=n; for(i=0;i
          
           >=1; } equ=max(equ,k); } for(i=0;i
           
            

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.