import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String a = in.next(); String b = in.next(); String a1 = a.substring(a.indexOf("x")+1); String b1 =b.substring(1); System.out.print(Integer.parseInt(a1,16)+Integer.parseInt(b1,8)); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String input = in.nextLine(); String[] arrs = input.split(" "); int a = Integer.parseInt(arrs[0].substring(2), 16); int b = Integer.parseInt(arrs[1].substring(1), 8); System.out.println(a + b); } }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); String a=sc.next(),b=sc.next(); int c=Integer.parseInt(a.substring(2),16); int d=Integer.parseInt(b.substring(1),8); System.out.println(c+d); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while(scanner.hasNext()){ String[] strs = scanner.nextLine().split(" "); int hexNumtoChangeDec = Integer.parseInt(strs[0].substring(2),16); int octNumtoChangeDec = Integer.parseInt(strs[1].substring(1),8); int addTwoDiffNum = hexNumtoChangeDec + octNumtoChangeDec; System.out.println(addTwoDiffNum); } } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner input=new Scanner(System.in); String output=input.nextLine(); String [] result=output.split(" "); int sum=Integer.parseInt(result[0].substring(2),16)+Integer.parseInt(result[1].substring(1),8); System.out.print(sum); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); String e = in.next(); String num1 =s.substring(2,s.length()); String num2 =e.substring(1,e.length()); int a = Integer.parseInt(num1, 16); int b = Integer.parseInt(num2, 8); System.out.println(a+b); } }
//字符串相关方法为关键 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String[] strs = scan.nextLine().split(" "); int a = Integer.parseInt(strs[0].substring(2), 16); int b = Integer.parseInt(strs[1].substring(1), 8); System.out.println(a + b); } }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String str1 = sc.next(); String str2 = sc.next(); int num1 = str1.substring(2,str1.length()); int num2 = str2.substring(1,str2.length()); int a = Integer.valueOf(num1,16); int b = Integer.valueOf(num2.8); System.out.println(a+b); } }
import java.util.*; public class Main { public static void main(String args[]) { Scanner input=new Scanner(System.in); String s[]=input.nextLine().split(" "); int a=Integer.parseInt(s[0].substring(2),16); int b=Integer.parseInt(s[1].substring(1),8); System.out.println(a+b); } }
import java.util.Scanner; /** * 计算进制之间的加法 */ public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String str1=sc.next(); String str2=sc.next(); String num1=str1.substring(2,str1.length()); String num2=str2.substring(1,str2.length()); int a=Integer.valueOf(num1,16); int b=Integer.valueOf(num2,8); System.out.println(a+b); } }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner input = new Scanner(System.in); String n = input.next(); String a = n.substring(2); String b = input.next(); int x = Integer.parseInt(a,16); int y = Integer.parseInt(b,8); System.out.print(x+y); } }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String i = sc.next(); String m = sc.next(); i = i.substring(2,i.length()); m = m.substring(1,m.length()); int x = Integer.valueOf(i, 16); int y = Integer.valueOf(m, 8); System.out.println(y+x); } } }java似乎只能这么麻烦了...
利用Integer.valueOf()方法可以把其他进制转成10进制
import java.util.*; public class Main { public static void main(String [] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()) { String str1=sc.next(); String str2=sc.next(); String num1=str1.substring(2,str1.length()); String num2=str2.substring(1,str2.length()); int a=Integer.valueOf(num1,16); int b=Integer.valueOf(num2,8); System.out.println(a+b); } } }