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

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(0)
  • 题解

    userId_undefined

    法兰西玫瑰

    倔强青铜
    88阅读
    0回复
    6点赞
  • 题解

    #include <iostream> #include <cstdio> using namespace std; int main() { int t; scanf("%d", &t); for (int i=1; i<=t; i++) { int n; scanf("%d", &n); int c = n; int *a = new intn+1; Loop: if (c <= 3) goto END; for (int j = 1, cnt = 0; j <= n; j++) { if (a[j] == 0) { cnt ++ ; if (cnt == 2) { cnt = 0; a[j] = 1; c--; } } } if (c<=3) goto END; for (int j = 1, cnt = 0; j <= n; j++) { if (a[j] == 0) { cnt ++ ; if (cnt == 3) { cnt = 0; a[j] = 1; c--; } } } if (c>3) goto Loop; END: bool first = true; for (int j=1; j<=n; j++) { if (!a[j] && first) { printf("%d", j); first = !first; } else if (!a[j]) printf(" %d", j); } putchar('\n'); delete []a; } return 0; }

    userId_undefined

    

    倔强青铜
    37阅读
    1回复
    2点赞
  • 题解AC 我要奖励自己 我要疯狂奖励自己

    userId_undefined

    AX6t5

    倔强青铜
    26阅读
    0回复
    1点赞
  • 题解

    这个题直接模拟即可,考虑到要删除大量东西,于是乎我们用链表(删除插入都是O(1) 的,唯一缺点就是不能快速随机访问)。 吐槽一句:数据太弱,试了顶峰数据不至于跑到10ms吧(是停顿了大概0.5s后出来的,还是单点测试) 代码:

    userId_undefined

    叫我杨同学

    秩序白银
    22阅读
    0回复
    0点赞
  • 题解

    userId_undefined

    嘉陵江的晚风.

    倔强青铜
    8阅读
    1回复
    0点赞
首页