1077A - Frog Jumping - CodeForces Solution


math *800

Please click on ads to support us..

Python Code:

t = int(input())
sum1 = 0
sum2 = 0

for i in range(t):
    a, b, k = map(int, input().split())
    sum1 = int(a * (k // 2))
    sum2 = int(b * (k // 2))
        
    if k % 2 == 1:
        sum1 = sum1 + a
        
    print(sum1 - sum2)
    sum1 = 0
    sum2 = 0


Comments

Submit
0 Comments
More Questions

1182A - Filling Shapes
82A - Double Cola
45A - Codecraft III
1242A - Tile Painting
1663E - Are You Safe
1663D - Is it rated - 3
1311A - Add Odd or Subtract Even
977F - Consecutive Subsequence
939A - Love Triangle
755A - PolandBall and Hypothesis
760B - Frodo and pillows
1006A - Adjacent Replacements
1195C - Basketball Exercise
1206A - Choose Two Numbers
1438B - Valerii Against Everyone
822A - I'm bored with life
9A - Die Roll
1430B - Barrels
279B - Books
1374B - Multiply by 2 divide by 6
1093B - Letters Rearranging
1213C - Book Reading
1468C - Berpizza
1546B - AquaMoon and Stolen String
1353C - Board Moves
902A - Visiting a Friend
299B - Ksusha the Squirrel
1647D - Madoka and the Best School in Russia
1208A - XORinacci
1539B - Love Song