牛客练习赛26A平面(数学公式)

题目链接:https://www.nowcoder.com/acm/contest/180/A

分析和思路:

数学题,背公式,n条直线最多把平面分成n*(n+1)/2+1份。

x物体可看成n*2条直线

 1 #include <iostream>
 2 using namespace std;
 3 typedef long long ll;
 4 
 5 int main()
 6 {
 7     ios::sync_with_stdio(false); cin.tie(0);
 8     
 9     ll n;
10     cin>>n;
11     
12     n*=2;
13     ll ans=n*(n+1)/2+1;
14     
15     cout<<ans<<endl;
16 
17     return 0;    
18 } 

完。

原文地址:https://www.cnblogs.com/redblackk/p/9609615.html