Results 1 to 4 of 4

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Jul:2014
    Location: Dobrich
    Posts: 10

    864 : 101, 010 101. - . . -. 8 , 1 ( ). , .

    Code:
    package august26;
    
    import java.util.Scanner;
    
    public class XBits {
    	public static void main(String[] args) {
    		Scanner input = new Scanner(System.in);
    		long n1 = input.nextInt();
    		long n2 = input.nextInt();
    		long n3 = input.nextInt();
    		long n4 = input.nextInt();
    		long n5 = input.nextInt();
    		long n6 = input.nextInt();
    		long n7 = input.nextInt();
    		long n8 = input.nextInt();
    		
    		String s1 = String.format("%64s", Long.toBinaryString(n1)).replace(' ', '0');
    		String s2 = String.format("%64s", Long.toBinaryString(n2)).replace(' ', '0');
    		String s3 = String.format("%64s", Long.toBinaryString(n3)).replace(' ', '0');
    		String s4 = String.format("%64s", Long.toBinaryString(n4)).replace(' ', '0');
    		String s5 = String.format("%64s", Long.toBinaryString(n5)).replace(' ', '0');
    		String s6 = String.format("%64s", Long.toBinaryString(n6)).replace(' ', '0');
    		String s7 = String.format("%64s", Long.toBinaryString(n7)).replace(' ', '0');
    		String s8 = String.format("%64s", Long.toBinaryString(n8)).replace(' ', '0');
    		
    		
    		
    		char[][] matrix = new char[8][];
    		matrix[0] = s1.toCharArray();
    		matrix[1] = s2.toCharArray();
    		matrix[2] = s3.toCharArray();
    		matrix[3] = s4.toCharArray();
    		matrix[4] = s5.toCharArray();
    		matrix[5] = s6.toCharArray();
    		matrix[6] = s7.toCharArray();
    		matrix[7] = s8.toCharArray();
    		
    		int xbits = 0;
    		
    		for(int i = 0; i < 8; i++){
    			for(int j = 0; j < 64; j++){
    				System.out.print(matrix[i][j]);
    			}
    			System.out.println();
    		}
    		
    		for(int i = 0; i < 6; i++){
    			for(int j = 0; j < 62; j++){
    				if(matrix[i][j] == 1 && matrix[i+1][j] == 0 && matrix[i+2][j] == 1 &&
    				   matrix[i][j+1] == 0 && matrix[i+1][j+1] == 1 && matrix[i+2][j+1] == 1 &&
    				   matrix[i][j+2] == 1 && matrix[i+1][j+2] == 1 && matrix[i+2][j+2] == 1){
    					xbits++;
    				}
    			}
    		}
    		
    		System.out.println(xbits);
    		input.close();
    	}
    }

  2. #2
    System.gc()'s Avatar
    Join Date: Apr:2007
    Location: back in time
    Posts: 1,075
    , " ", ? : )
    UD3R|Q9550+1283|4x2 G.Skill@1066|MX500+1002FAEX+640AAKS+ST31 60|RX580-8GB|1841BLT|SS-760XP|Define7|z24i|Edifier S350DB
    geniusloci: ) ; ) ; ) ? nope|r.i.p.

  3. #3
    Registered User
    Join Date: Jan:2005
    Location: Sofia
    Posts: 157
    71 , ? 91 ?

    : - 6- i, 62- j ()

  4. #4
    Registered User
    Join Date: Jul:2014
    Location: Dobrich
    Posts: 10
    . , char- int-, .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |