Created
April 17, 2019 10:53
-
-
Save sapphi-red/6bf83b9465c98be0716cf6c4a8f56d9c to your computer and use it in GitHub Desktop.
StudentNumber CPCTF2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Solve { | |
public static void main(String[] args){ | |
Scanner sc = new Scanner(System.in); | |
int n = sc.nextInt(); | |
for(int i = 0; i < n; i++){ | |
char[] y = sc.next().toCharArray(); | |
char[] x = sc.next().toCharArray(); | |
int sum = 0; | |
sum += Character.getNumericValue(y[0]) * 2; | |
sum += Character.getNumericValue(y[1]) * 3; | |
sum += Character.getNumericValue(x[0]) * 4; | |
sum += Character.getNumericValue(x[1]) * 5; | |
sum += Character.getNumericValue(x[2]) * 6; | |
sum += Character.getNumericValue(x[3]) * 7; | |
if (sum % 11 == Character.getNumericValue(x[4])) { | |
System.out.println("YES"); | |
} else { | |
System.out.println("NO"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment