daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Sep 21st, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package s.Exam7and8July2018;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6.  
  7. public class CodeName {
  8.     public static void main(String[] args) throws IOException {
  9.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  10.         char symbol = reader.readLine().charAt(0);
  11.  
  12.         int sum = 0;
  13.         char a = 0;
  14.         char b = 0;
  15.         char c = 0;
  16.         int d = 0;
  17.         int max = 0;
  18.  
  19.         for (char j = 100; j <= 111; j++) {
  20.             for (char k = 109; k <= 112; k++) {
  21.                 for (char l = 74; l <= 79; l++) {
  22.                     for (int m = 10; m <= 50; m++) {
  23.                         if (m % 2 == 0) {
  24.                             d = m;
  25.                         }
  26.                         sum = symbol + j + k + l + d;
  27.  
  28.                         if (sum > max && sum % 10 == 8) {
  29.                             max = sum;
  30.                             if (max % 2 == 0) {
  31.                                 a = j;
  32.                                 b = k;
  33.                                 c = l;
  34.                             }
  35.                         }
  36.                     }
  37.                 }
  38.             }
  39.         }
  40.  
  41.         System.out.println(max);
  42.         System.out.printf("%s%s%s%s%d", symbol, a, b, c, d);
  43.     }
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top