【数学规律】A、 Frog Jumping

import java.math.BigInteger;
import java.util.Scanner;
import java.util.*;
import java.lang.*;
public class Main {

public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
int n=cin.nextInt();
while(n--!=0)
{
int a=cin.nextInt(),b=cin.nextInt(),dis=a-b;
BigInteger c=cin.nextBigInteger();
if((c.mod(BigInteger.valueOf(2))).equals(BigInteger.ZERO))
{
c=c.divide(BigInteger.valueOf(2));
System.out.println(c.multiply(BigInteger.valueOf(dis)));
}

else {
c=c.subtract(BigInteger.ONE);
c=c.divide(BigInteger.valueOf(2));
c=c.multiply(BigInteger.valueOf(dis));
}

}

}
}

Codeforces：Oh Those Palindromes

A non-empty string is called palindrome, if it reads the same from the left to the right and from the right to the left. For example, “abcba“, “a“, and “abba” are palindromes, while “abab” and “xy” are not.

A string is called a substring of another string, if it can be obtained from that string by dropping some (possibly zero) number of characters from the beginning and from the end of it. For example, “abc“, “ab“, and “c” are substrings of the string “abc“, while “ac” and “d” are not. 继续阅读Codeforces：Oh Those Palindromes