package x;
import java.util.Scanner;
public class test2 {
public static void main(String[] args) {
long num1, num2;
int a1, a2;
Scanner s = new Scanner(System.in);
num1 = s.nextLong();
a1 = s.nextInt();
num2 = s.nextLong();
a2 = s.nextInt();
int temp3 = sum(num1,a1)+sum(num2,a2);
System.out.println(temp3);
}
public static int sum(long num, int a) {
int su = 0;
int temp = 0;
boolean c= true;
while(c) {
if(num!=0) {
temp = (int)(num%10);
if(temp == a) {
su = su*10+temp;
}
}
else{
c = false;
}
num=num/10;
}
return su;
}
}
PAT乙级(Basic Level)真题之部分A+B
最新推荐文章于 2022-12-06 08:00:00 发布