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