<!--親の顔より見た光景-->

日々の発見を残していきます。

CodeIQ

codeiq.jp

package codeiq;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class CodeIQ3 {
    public static void main( String [] args )
    {
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        int n[] = new int[100];
        int i = 0;
        String str = null;
        try {
            str = br.readLine();
            try {
                while ( str.length() > 0 ) {
                    n[i++] = Integer.parseInt( str );
                    str = br.readLine();
                }
            }
            catch ( NullPointerException e ) {
                System.out.println();
            }
        }
        catch ( IOException e ) {
            System.out.println( e );
        }
        for ( int j = 0; j < i; j++ ) {
            switch ( n[j] % 16 ) {
                case 0 :
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                    System.out.print( n[j] % 16 );
                    break;
                case 10:
                    System.out.print( "a" );
                    break;
                case 11:
                    System.out.print( "b" );
                    break;
                case 12:
                    System.out.print( "c" );
                    break;
                case 13:
                    System.out.print( "d" );
                    break;
                case 14:
                    System.out.print( "e" );
                    break;
                case 15:
                    System.out.print( "f" );
                    break;
                default:
                    break;
            }
        }
        System.out.println();
    }
}