当前位置: 首页 > news >正文

怎样留别人电话在广告上/seo外链查询工具

怎样留别人电话在广告上,seo外链查询工具,中国最好的网站建设,深圳公司网站制作企业写在前面 实现思路 整型数组存储字符出现次数字符数组预定义排序 题目简单&#xff0c;15分钟a题 测试用例 input: redlesPayBestPATTopTeePHPereatitAPPT output: PATestPATestPTetPTePePeeac代码 算法笔记&#xff08;参考&#xff09; #include <iostream> #incl…

写在前面

  • 实现思路
    • 整型数组存储字符出现次数
    • 字符数组预定义排序
  • 题目简单,15分钟a题

测试用例

input:
redlesPayBestPATTopTeePHPereatitAPPT
output:
PATestPATestPTetPTePePee

ac代码

  • 算法笔记(参考)
#include <iostream>
#include <cstring>
using namespace std;
const int maxn = 10010;
char str[maxn], dict[6] = {'P','A','T','e','s','t'};
int hashTable[6] = {0};int main()
{scanf("%s", str);int len = strlen(str), sum=0;for(int i=0; i< len; i++){for(int j=0; j<6; j++){if(str[i] == dict[j]){hashTable[j]++;sum++;}}}while(sum > 0){for(int i=0; i<6; i++){if(hashTable[i]>0){printf("%c", dict[i]);hashTable[i]--;sum--;}}}return 0;
}
  • 个人改造版
    • 数组存储字符出现次数,下标为字符ascii码
    • 目标字符(6个)hash表初始化为1(hashTable方便全部初始化为0)
    • 打印输出个数大于1,消除初始化的次数1。灵活思考点
#include <iostream>
#include <cstring>
using namespace std;const int maxn = 10010;
char str[maxn], dict[6] = {'P','A','T','e','s','t'};
int hashTable[256] = {0};
int main()
{hashTable['P'] = hashTable['A'] = hashTable['T'] = 1;hashTable['e'] = hashTable['s'] = hashTable['t'] = 1;scanf("%s", str);int len = strlen(str), sum=0;for(int i=0; i< len; i++)if(hashTable[str[i]]>0){hashTable[str[i]]++;sum++;}while(sum > 0){for(int i=0; i<6; i++)if(hashTable[dict[i]]>1){printf("%c", dict[i]);hashTable[dict[i]]--;sum--;}}return 0;
}

学习代码

  • 1043. 输出PATest(20).cpp···推荐···
    • 整型数组记录字符出现次数,下标为字符对应ascii值
    • 逐个读入字符,结束符ch!=EOF
    • 循环打印次数不为0字符并动态更新剩余打印次数
#include <iostream>
using namespace std;
int main() {int map[128] = {0}, c;while ((c = cin.get()) != EOF) map[c]++;while (map['P'] > 0 || map['A'] > 0 || map['T'] > 0 || map['e'] > 0 || map['s'] > 0 || map['t'] > 0) {if (map['P']-- > 0) cout << 'P';if (map['A']-- > 0) cout << 'A';if (map['T']-- > 0) cout << 'T';if (map['e']-- > 0) cout << 'e';if (map['s']-- > 0) cout << 's';if (map['t']-- > 0) cout << 't';}return 0;
}
http://www.jmfq.cn/news/5020885.html

相关文章:

  • 公司网站建设费用包括哪些/搜索引擎关键词怎么优化
  • 郑州市政府网站的建设与发展/网站推广的方式
  • 建设银行商城网站/电商代运营一般收多少服务费
  • 沈阳企业自助建站/百度大数据搜索引擎
  • 30秒网站/市场调研报告
  • 做爰全过程免费的视频99网站/seo整合营销
  • 深圳网站设计哪好/太原seo
  • 自己做的小网站分享/网站宣传推广策划
  • 做网站推广见客户的话术/seo推广是做什么的
  • 郑州网站设计网站/营销策略的概念
  • 自己做苹果下载的网站/网络营销岗位描述的内容
  • 欧亚专线快递查询/如何优化网站推广
  • 平面设计培训素材/优化方案怎么写
  • 怎么免费建自己的网站/搜索引擎推广培训
  • 智慧团建学生登录入口官网/广州seo技术优化网站seo
  • 南通市港闸区城乡建设局网站/互联网营销成功案例
  • 中铁建设集团公司门户/seo查询系统源码
  • 辽宁省城乡住房和建设厅网站/免费做网站怎么做网站链接
  • 婚庆网站建设/成都网站关键词推广
  • wordpress企业模板破解/网站优化公司推荐
  • 武汉网站建设的有哪些公司/google安卓手机下载
  • 国内阿里网站建设/最新营销模式有哪些
  • 太原网站建设优化/今日舆情热点
  • 网站没备案会怎么样/沈阳seo排名优化推广
  • 企业官网建站系统/国内最好的搜索引擎
  • 动态网站开发工程师 asp/网上推广怎么收费
  • 网站单页推广/新媒体营销成功案例
  • 没网站做推广/什么平台可以打广告做宣传
  • 个人工作室经营范围/福建seo优化
  • 武汉建立网站营销设计/中央下令全国各地核酸检测