小工具知识网

当前位置: 首页 > 行业知识 > 2024牛客寒假算法基础集训营4(视频讲解题目)

行业知识

2024牛客寒假算法基础集训营4(视频讲解题目)

2026-10-30 20:00:57 来源:互联网转载

2024牛客寒假算法基础集训营4(视频讲解题目)

  • 视频链接
  • A
  • B
  • C
  • D
  • E
  • F
  • G、H(下面是hard版本的代码两个都可以过)

    视频链接

    2024牛客寒假算法基础集训营4(视频讲解题目)

    A

    #include#define endl '\n'#define deb(x) cout int a, b ,k;cin  a  b >> k;if(a >= k * b){cout cout ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t;t = 1;//cin  t;while(t--)solve();}int n; cin  n;vectorcin  a[i];x += (a[i] - 1);}if(x % 2){cout cout ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t;t = 1;// cin  t;while(t--)solve();}int n, m, x, y;cin  n  m  x  y;x -- ,y --;vector g(n + 10);for(int i = 0; i > g[i];}int p, q; cin >> p >> q;vectorops(q);for(int i = 0; i > ops[i].first >> ops[i].second;}while(p--){for(int j = 0; j = 1; i --){g[z][i] = g[z][i - 1];}g[z][0] = s;}else{char s = g[n - 1][z];for(int i = n - 1; i >= 1; i --){g[i][z] = g[i - 1][z];}g[0][z] = s;}}}cout ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t;t = 1;// cin  t;while(t--)solve();}

    D

    #include#define endl '\n'#define deb(x) cout int n; cin  n;vectorcin  a[i];}if(n == 1){cout s += a[i];}int ans = 0;    for(int i = 1; i if(s % i){continue;}        int a = i, b = s / i;        if(s / a = n){            ans ++;        }        if(a != b and s / b = n){            ans ++;        }}cout ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t;t = 1;//cin  t;while(t--)solve();}int n, k; cin  n  k;vectorcin  a[i];s[i] = s[i - 1] + a[i];}int ans = 0;mapst;st[0] = 1;for(int i = 1; i int p = s[i] % k;if(st[p]){ans += st[p];st.clear();}st[p] ++;}cout ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t;t = 1;//cin  t;while(t--)solve();}if(y - x + 1 

上一篇:【Flutter】webview

下一篇:球根海棠花后修剪秘籍揭秘,塑造迷人花型的终极指南!