acgo题库
  • 首页
  • 题库
  • 学习
  • 天梯
  • 备赛

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 资讯
  • 竞赛
  • 讨论
  • 团队
  • 商城
登录
注册
题目详情提交记录(0)
  • 最长题解

    此题题解 这道题是小学二年级学的二分查找 本题解没有废话真的 这是题解 不怎么长 所以我整个身体痒痒——emmm我把头文件改成了... 现在够长了 点个关注和爱心吧 关注我!!!

    userId_undefined
    段茗煜
    出道萌新时间刺客空间掌握者秩序白银造物者
    168阅读
    3回复
    5点赞
  • (无言)

    #include<bits/stdc++.h> #include<vector> #include<sstream> using namespace std; int main(){ ios_base::sync_with_stdio(false);//万金油 cin.tie(nullptr);//还是万金油 vector<int> n; string li, to; getline(cin, li); stringstream ss(li); while(getline(ss, to, ',')){ n.push_back(stoi(to)); } int t; cin >> t; int l = 0, r = n.size() - 1, ans = -1; while(l <= r){ int mid = l + (r - l) / 2; if(n[mid] == t){ ans = mid; break; }else if(n[mid] < t){ l = mid + 1; }else{ r = mid - 1; } } cout << ans; return 0; }

    userId_undefined
    KARDS幻象--英爷没血了
    贪心·贪心尝试者时间刺客字符串·魔法使ASCII炼金师数组·数组操作员维度操控者
    17阅读
    0回复
    1点赞
暂无数据

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

首页