博客
关于我
团体程序设计天梯赛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/

    你可能感兴趣的文章
    NSRange 范围
    查看>>
    NSSet集合 无序的 不能重复的
    查看>>
    NSURLSession下载和断点续传
    查看>>
    NSUserdefault读书笔记
    查看>>
    NS图绘制工具推荐
    查看>>
    NT AUTHORITY\NETWORK SERVICE 权限问题
    查看>>
    NT symbols are incorrect, please fix symbols
    查看>>
    ntelliJ IDEA 报错:找不到包或者找不到符号
    查看>>
    NTFS文件权限管理实战
    查看>>
    ntko web firefox跨浏览器插件_深度比较:2019年6个最好的跨浏览器测试工具
    查看>>
    ntko文件存取错误_苹果推送 macOS 10.15.4:iCloud 云盘文件夹共享终于来了
    查看>>
    ntp server 用法小结
    查看>>
    ntpdate 通过外网同步时间
    查看>>
    ntpdate同步配置文件调整详解
    查看>>
    NTPD使用/etc/ntp.conf配置时钟同步详解
    查看>>
    NTP及Chrony时间同步服务设置
    查看>>
    NTP服务器
    查看>>
    NTP配置
    查看>>
    NUC1077 Humble Numbers【数学计算+打表】
    查看>>
    NuGet Gallery 开源项目快速入门指南
    查看>>