Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Solution {
- public static void main(String[] args) {
- String pattern = "0123456789ABCDEF";
- String input = "";
- Scanner sc = new Scanner(System.in);
- input = sc.nextLine();
- int lenghtInput = input.length();
- System.out.println(lenghtInput);
- int lenghtPattern = pattern.length();
- int pointer = 0;
- long result = 0;
- for (int i = lenghtInput - 1; i >= 0; i--) {
- for (int j = 0; j < lenghtPattern; j++) {
- if (input.charAt(i) == pattern.charAt(j)) {
- result += (double) j * Math.pow(16, pointer);
- pointer++;
- }
- }
- }
- System.out.println(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement