2019年天梯赛-全国总决赛-L1-060 心理阴影面积(5 分)

题目链接:https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858881

题目大意:给一个100*100的正方形,求点 (x,y)和点(0,0)和点(100,100)围成的三角形面积。并且保证点 (x,y)出现在\begin{cases}y=x \cr y=0 \cr x=100 \end{cases}范围内。

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main(){
    int x,y;
    cin >> x >> y;
    int s=5000;
    s-=(100-x)*y;
    s-=(x*y)/2;
    s-=(100-x)*(100-y)/2;
    cout << s;
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_26122455/article/details/88928769