Scanner scanner=new Scanner(System.in);
int a1 = scanner.nextInt();
int a2 = scanner.nextInt();
int a3 = scanner.nextInt();
int a4 = scanner.nextInt();
int a5 = scanner.nextInt();
int a6 = scanner.nextInt();
int a7 = scanner.nextInt();
int a8 = scanner.nextInt();
int []a={a1,a2,a3,a4,a5,a6,a7,a8};
for(int i=0;i<a.length/2;i++){
a[i]=a[i]^a[a.length-i-1];// 0 5 1 4 2 3
a[a.length-i-1]=a[i]^a[a.length-i-1];
a[i]=a[i]^a[a.length-i-1];
}
int num=0;
for(int i=0;i<a.length;i++){
num=a[i]+5;
a[i]=num;
}
for(int i=a.length-1;i>0;i--){
if(a[i]>=10){
a[i]=a[i]%10;
a[i-1]=a[i-1]+1;
}
}
int n=0;
n=a[0]*10000000+a[1]*1000000+a[2]*100000+a[3]*10000+a[4]*1000+a[5]*100+a[6]*10+a[7];
n=n/10;
n=n-n/10000000*10000000+n%10*10000000-n%10+n/10000000;
System.out.println(n); |
|