提交时间:2023-08-09 15:24:29

运行 ID: 81558

#include<bits/stdc++.h> using namespace std; int t, n; int main() { cin >> t >> n; if (t == 1)//弦的数量 { int a[100010]; a[1] = 0; a[2] = 1; a[3] = 3; for (int i = 4; i <= 100010; i++) { a[i] = a[i - 1] + i - 1; } cout << a[n]; return 0; } if (t == 2)//交点的数量 { int a[100010]; a[1] = 0; a[2] = 0; a[3] = 0; a[4] = 1; a[5] = 5; a[6] = 15;//+10 a[7] = 35;//+20 a[8] = 70;//+35 a[9] = 122;//+52 a[10] = 210;//+78 a[11] = 316;//+106 a[12] = 455;//+139 a[13] = 735;//+280 cout << a[n]; return 0; } if (t == 3)//区域的数量 { int a[100010]; a[1] = 1; a[2] = 2; a[3] = 4; for (int i = 4; i <= 10010; i++) { a[i] = a[i - 1] * 2; } cout << a[n]; return 0; } return 0; }