Sort by

recency

|

785 Discussions

|

  • + 0 comments

    //java15

    import java.io.*;

    class Result { public static long flippingBits(long n) { return n ^ 0xFFFFFFFFL; // Flip 32 bits } }

    public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out));

        int q = Integer.parseInt(bufferedReader.readLine().trim());
    
        for (int i = 0; i < q; i++) {
            long n = Long.parseLong(bufferedReader.readLine().trim());
            long result = Result.flippingBits(n);
            bufferedWriter.write(String.valueOf(result));
            bufferedWriter.newLine();
        }
    
        bufferedReader.close();
        bufferedWriter.close();
    }
    

    }

  • + 0 comments

    //java15 import java.io.*;

    class Result { public static long flippingBits(long n) { return n ^ 0xFFFFFFFFL; // Flip 32 bits } }

    public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out));

        int q = Integer.parseInt(bufferedReader.readLine().trim());
    
        for (int i = 0; i < q; i++) {
            long n = Long.parseLong(bufferedReader.readLine().trim());
            long result = Result.flippingBits(n);
            bufferedWriter.write(String.valueOf(result));
            bufferedWriter.newLine();
        }
    
        bufferedReader.close();
        bufferedWriter.close();
    }
    

    }

  • + 0 comments
     long c=n;
    for(long i =0; i<32; i++ )
        c^=1<<i;
    if (c&(1<<1))
        c|=1<<1;
    else
        c&=~(1<<1);
    

    return c+4294967296;

  • + 0 comments

    Flipping bits is a core concept in computing, where binary values (0s and 1s) are reversed. This process is used in encryption, data compression, and error correction. For developers or businesses dealing with such low-level operations, having a powerful server environment is essential. If you're targeting the Asian region, especially for performance-intensive tasks, vps hosting in thailand by Navicosoft offers reliable, secure, and high-speed VPS solutions that can fully support such technical needs.

  • + 0 comments
    int("".join(["1" if i == "0" else "0" for i in bin(n)[2:].rjust(32, "0")]), 2)