题解:CF2284A1 15K4JR3B (Easy Version)
mini_steve · · 题解
中文题面:洛谷剪贴板\
题目传送门:洛谷 and codeforces\
提交记录:#398128949 on codeforces
P1:题意
给定
P2:思路
为了让面积最大,显然应该把三个点往互相远离的方向拉开:让
假设
此时底边长为
令
因此最大二倍面积就是
P3:实现
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;cin>>t;
while(t--){
int n;cin>>n;
cout<<(n*n)/4<<"\n";
}
return 0;
}
- 时间复杂度:
O(1) 。 - 空间复杂度:
O(1) 。