安全问答

安全问答是一个知识全球问答,包含丰富的问答知识

首页 常规 游戏 娱乐 科技 程序员

代码越界n小于等于100#includebitsstdc++husing namespace std;int na110;string name110 s110;int main cin n; for int i = 1; i = n; i++ cin namei si; int ans = 0; forint i = 1;i = n;i++

  • 日期: 2025-03-20
  • 标签: 科技

代码已经越界,需要修改的地方如下:

  1. 数组a的大小应该是110,而不是100。

  2. 在输入时,字符串的下标应该从0开始,而不是1。

修改后的代码如下:

代码越界n小于等于100#includebitsstdc++husing namespace std;int na110;string name110 s110;int main cin n; for int i = 1; i = n; i++ cin namei si; int ans = 0; forint i = 1;i = n;i++

原文地址: https://www.cveoy.top/t/topic/bMA7 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录

  • 上一篇: !DOCTYPE htmlhtmlhead titleMy Websitetitle style body font-family Arial sans-serif; margin 0; padding 0; nav background-color #333; color #fff; display flex; justify-content s
  • 下一篇: 计算机网络的七层基本概念与基本原理

© 2019 • 2025 - 安全问答 站长邮箱:wxgpt@qq.com    ICP备案/许可证号:鲁ICP备2026057792号