acgo题库
  • 首页
  • 题库
  • 学习
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情提交记录(0)
  • 包教包会(有点难),答案:

    userId_undefined

    AWM夜鹰 | 鹰击长空

    103阅读
    3回复
    2点赞
  • 答案

    userId_undefined

    玩MC的aersvfgber

    62阅读
    0回复
    0点赞
  • swing

    #include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string s, ans1 = "", ans2 = ""; cin >> s; if(s[0] == '?') ans1 += 'B', ans2 += 'R'; else ans1 += s[0], ans2 += s[0]; for(int i = 1; i < s.size(); ++i){ if(s[i] != '?') { ans1 += s[i], ans2 += s[i]; continue; } if(ans1.back() == 'B') ans1 += 'R'; else ans1 += 'B'; if(ans2.back() == 'B') ans2 += 'R'; else ans2 += 'B'; } int cnt1 = 0, cnt2 = 0; for(int i = 1; i < s.size(); ++i){ cnt1 += ans1[i] == ans1[i - 1]; cnt2 += ans2[i] == ans2[i - 1]; } cout << (cnt1 < cnt2 ? ans1 : ans2); return 0; }

    userId_undefined

    小吴

    出道萌新贪心·贪心尝试者模拟·模拟练习生倔强青铜
    32阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页