From 118a9e171c3cb96d3cd0fbc13ec8d57da5cdae6e Mon Sep 17 00:00:00 2001 From: xingyou wu <3050128610@qq.com> Date: Mon, 7 Apr 2025 15:13:43 +0800 Subject: [PATCH] =?UTF-8?q?lanqiao=201457=20=E6=9D=A8=E8=BE=89=E4=B8=89?= =?UTF-8?q?=E8=A7=92=E5=BD=A2(=E4=BC=98=E5=8C=96=E8=A7=A3=E6=B3=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 12lanqiao/test8-2.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 12lanqiao/test8-2.cpp diff --git a/12lanqiao/test8-2.cpp b/12lanqiao/test8-2.cpp new file mode 100644 index 0000000..f27fcd4 --- /dev/null +++ b/12lanqiao/test8-2.cpp @@ -0,0 +1,21 @@ +// lanqiao 1457 杨辉三角形(优化解法) +#include +using namespace std; +const int N = 1e5 + 10; +int a[N], b[N]; +int main(){ + int n; cin >>n; + if(n == 1){ + cout << 1 << endl; + return 0; + } + /* + 如果某一行第二个数是n,那么第三个数一定是n(n-1)/2,算到44723行 + 44723*44723>10亿,所以算到前44723行即可 + */ + + return 0; +} +/* test samples -> 13 +6 +*/ \ No newline at end of file