博客
关于我
团体程序设计天梯赛L1-027 出租 (20分)(附分析)
阅读量:89 次
发布时间:2019-02-26

本文共 1648 字,大约阅读时间需要 5 分钟。

???????????????????????????????????

  • ???????????????????11???????????

  • ??????????????????????

  • ??????????????????????????????arr???

  • ????????????????????????arr??????????index????

  • ???????arr?index????????????

  • ??????C++?????

    #include 
    #include
    #include
    using namespace std;int main() { string tel; cin >> tel; // ??????????? vector
    uniqueDigits; for (char c : tel) { int digit = c - '0'; if (find(uniqueDigits.begin(), uniqueDigits.end(), digit) == uniqueDigits.end()) { uniqueDigits.push_back(digit); } } sort(uniqueDigits.rbegin(), uniqueDigits.rend()); // ?????? vector
    index(11); for (int i = 0; i < 11; ++i) { int digit = tel[i] - '0'; for (int j = 0; j < uniqueDigits.size(); ++j) { if (digit == uniqueDigits[j]) { index[i] = j; break; } } } // ???? cout << "int[] arr = new int[]{""; for (int digit : uniqueDigits) { cout << digit; if (!uniqueDigits.empty() && uniqueDigits != prev) { cout << ","; } } cout << "};" << endl; cout << "int[] index = new int[]{""; for (int i : index) { cout << i; if (!index.empty() && index != prev) { cout << ","; } } cout << "};" << endl;}

    ?????

    • ???????cin >> tel?????????????
    • ????????????????????????????????uniqueDigits???????
    • ???????sort???uniqueDigits???????
    • ??????????????????arr?????????index????
    • ?????????????arr?index?????????????????????????????

    ?????????????11?????????????????????

    转载地址:http://kwkk.baihongyu.com/

    你可能感兴趣的文章
    python nltk nltk_data 离线安装,chatterbot
    查看>>
    Redis 限流的 3 种方式,还有谁不会?
    查看>>
    Python这么慢,为啥大公司还在用?
    查看>>
    python note 06 编码方式
    查看>>
    python numba 转灰度图_使用NumPy、Numba的简单使用(二)
    查看>>
    Python Numpy 关于 linspace()函数 使用详解(全)
    查看>>
    Python numpy插入、读取至postgreSQL数据库中bytea类型字段
    查看>>
    Python numpy数据的保存和读取
    查看>>
    python numpy矩阵索引_python – 在2D numpy ndarray或numpy矩阵中获取前N个值的索引
    查看>>
    Python OCR库:自动化测试验证码识别神器!
    查看>>
    python opencv - 斑点检测或圆形检测
    查看>>
    Python还可以做情感分析你不看看吗?
    查看>>
    Python OpenCV HoughLinesP 无法检测线
    查看>>
    Python OpenCV-使用透明度覆盖图像
    查看>>
    python Opencv图像基础操作
    查看>>
    Python OpenCV将图像转换为字节字符串?
    查看>>
    python OpenCV视频的读取及保存
    查看>>
    python open和file的区别
    查看>>
    python open读取文件并对换行进行处理
    查看>>
    python os, os.path和sys模块
    查看>>