Ycatf @ 2022-11-15 22:24:03
import java.util.*;
public class Main {
public static void main(String[] arg) {
Scanner sc = new Scanner(System.in);
String a = sc.next();
String b = a.substring(0,1)+a.substring(2, 5)+a.substring(6, 11);
String c = a.substring(12, 13);
//int n = Integer.parseInt(c);
int[] arr = new int[9];
int x = 0;
for(int i=0;i<b.length();i++) {
String d = b.substring(x, i+1);
x++;
arr[i] = Integer.parseInt(d);
}
int[] arr1 = new int[9];
int sum = 0;
for(int j = 0; j<arr1.length;j++) {
arr1[j] = arr[j]*(j+1);
sum+=arr1[j];
}
String e = ""+sum%11;
if(sum%11==10) {
e = "X";
}
if(c==e) {
System.out.println("Right");
}
else {
System.out.println(a.substring(0, 12)+e);
}
}
}
by Ycatf @ 2022-11-15 22:24:58
WA #1 #4 #7