Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class asfd {
- public static void main(String[] args) {
- Scanner scan=new Scanner(System.in);
- int t=scan.nextInt();
- for(int tt=0;tt<t;tt++) {
- long a=scan.nextInt(), b=scan.nextInt(), k=scan.nextInt();
- long res=(a-b)*(k/2);
- // System.out.println(res);
- if(k%2==1) res+=a;
- System.out.println(res);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement