7 solutions

  • 0
    @ 2022-4-8 22:21:48
    import java.util.Scanner;
    public class Main {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for (int j = 0; j < n; j++) {
    String s = sc.next();
    int sum = 0;
    int[] nums = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
    for (int i = 0; i < nums.length; i++) {
    int a = s.charAt(i) - '0';
    sum += a * nums[i];
    }
    int mod = sum % 11;
    String s1 = "10X98765432";
    if (s.charAt(17) == s1.charAt(mod)) {
    System.out.println("True");
    } else {
    System.out.println("False");
    }
    }
    sc.close();
    }
    }
    

    Information

    ID
    41
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    1423
    Accepted
    191
    Uploaded By