시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 534 286 254 56.696%

문제

카를 프리드리히 가우스는 독일의 수학자이다.

가우스가 초등학교에 다닐 때, 선생님 J.G. Büttner는 1부터 100까지 수의 합을 계산하게 시켰다. 가우스는 몇 초만에 정확한 답 5050을 계산했다.

n과 m 이 주어졌을 때, n보다 크거나 같고, m보다 작거나 같은 모든 정수의 합을 구하는 프로그램을 작성하시오. 즉, 다음을 계산하라.

\[\sum_{i=n}^{m} {i} = n+(n+1)+(n+2)+ \dots + (m-1) + m\]

입력

첫째 줄에 테스트 케이스의 개수가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, n과 m이 주어진다. (-109 ≤ n ≤ m ≤ 109)

출력

각 테스트 케이스마다 "Scenario #i:"를 출력한 다음, n부터 m까지 모든 정수의 합을 출력한다. 각 테스트 케이스 사이에는 빈 줄을 하나 출력한다.

예제 입력 1

3
1 100
-11 10
-89173 938749341

예제 출력 1

Scenario #1:
5050

Scenario #2:
-11

Scenario #3:
440625159107385260
W3sicHJvYmxlbV9pZCI6Ijc1MjMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJHYXVcdTAwZGYiLCJkZXNjcmlwdGlvbiI6IjxwPlx1Y2U3NFx1Yjk3YyBcdWQ1MDRcdWI5YWNcdWI0ZGNcdWI5YWNcdWQ3ODggXHVhYzAwXHVjNmIwXHVjMmE0XHViMjk0IFx1YjNjNVx1Yzc3Y1x1Yzc1OCBcdWMyMThcdWQ1NTlcdWM3OTBcdWM3NzRcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1YWMwMFx1YzZiMFx1YzJhNFx1YWMwMCBcdWNkMDhcdWI0ZjFcdWQ1NTlcdWFkNTBcdWM1ZDAgXHViMmU0XHViMmQwIFx1YjU0YywgXHVjMTIwXHVjMGRkXHViMmQ4IEouRy4gQiZ1dW1sO3R0bmVyXHViMjk0IDFcdWJkODBcdWQxMzAgMTAwXHVhZTRjXHVjOWM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