2022/03/22 CPE_02
題目:
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
for (int i = 1; i <= t; i++) {
long long int x0, y0, x1, y1, s0, s1;
cin >> x0 >> y0 >> x1 >> y1;
cout << "Case " << i << ": ";
//The dot before (x0,y0) , include the line of (x0,y0)
//梯形公式計算(x0,y0)前的座標,x0+1計算 (x0,y0)這斜線前的點,含(x0,y0)
s0 = (1 + (x0 + y0)) * (x0 + y0) * 1 / 2 + (x0 + 1);
//The dot before (x1,y1) , include the line of (x1,y1)
s1 = (1 + (x1 + y1)) * (x1 + y1) * 1 / 2 + (x1 + 1);
cout << s1 - s0 << endl;
}
return 0;
}