int main(int argc, char *argv[]) { int n; scanf("%d", &n); printf("%s\n", last_digit(n)); return 0; }
int main() { int t; int a, b; scanf("%d", &t); while (t--){ scanf("%d %d", &a, &b); if (b == 0 || a == 1) printf("1\n"); else if (a == 0) printf("0\n"); else printf("%d\n", last_digit(a, b)); } return 0; }
bool bignum::isDivisibleBySeven() const { if (decimalCount > 0) return false; bignum temp(getConverted(10).absolute()); if (temp == 7) return true; if (temp < 10) return false; bignum last_digit(temp.getDigit(ONES_PLACE)); bignum rest_of_digits = temp - last_digit; rest_of_digits.rightShift(1); bignum new_test(rest_of_digits - (last_digit * 2)); return new_test.isDivisibleBySeven(); }