Codeforces Round #555 (Div. 3) AB
A: http://codeforces.com/contest/1157/problem/A
题意:每次加到10的整数倍之后,去掉后面的0,问最多有多少种可能。
1 #include <iostream> 2 #include <algorithm> 3 #include <vector> 4 #include <string> 5 #include <set> 6 7 using namespace std; 8 9 int main() 10 { 11 ios::sync_with_stdio(false); 12 cin.tie(0); 13 cout.tie(0); 14 15 int n; 16 set<int> si; 17 while(cin>>n){ 18 si.clear(); 19 si.insert(si.end(),n); 20 while(n!=1){ 21 n++; 22 while(n%10==0){ 23 n/=10; 24 } 25 si.insert(si.end(),n); 26 } 27 n=2; 28 si.insert(si.end(),n); 29 while(n!=1){ 30 n++; 31 while(n%10==0){ 32 n/=10; 33 } 34 si.insert(si.end(),n); 35 } 36 cout<<si.size()<<endl; 37 } 38 return 0; 39 }
View Code
B: http://codeforces.com/contest/1157/problem/B
题意:有一个很长的字符串,和1-9之间数字的映射关系。问修改其中一段得到的最大的串是什么。(可以进行0次或1次修改)
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <set>using namespace std;int main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int n;string s1;int mapp[9];while(cin>>n){cin>>s1;string s3(s1);for(int i=0;i<9;i++){cin>>mapp[i];}for(int j=0;j<s1.size();j++){string s2(s1);for(int i=j;i<s1.size();i++){char t=mapp[s1[i]-'1']+'0';if(t>=s1[i]){s2[i]=mapp[s1[i]-'1']+'0';}else{break;}}if(s2>s3) s3=s2;}cout<<s3<<endl;}return 0; }
View Code
转载于:https://www.cnblogs.com/TWS-YIFEI/p/10778200.html
Codeforces Round #555 (Div. 3) AB相关推荐
- Codeforces Round #131 (Div. 2)------AB
非常郁闷,一大早起来看结果,本来以为这次rating应该能升到1600以上的,可惜结果很惨,B题由于一个小失误,导致被别人hack成功了.由于家庭原因,老妈不准熬夜做,做了39min把AB两道简单题做 ...
- Codeforces Round # 555 (Div. 3) C2. Increasing subsequence (complicated version) (贪心)
题目链接:http://codeforces.com/contest/1157/problem/C2 当左右两边数字相同时,需要判断一下取哪边能得到更长的递增序列 #include <iostr ...
- Codeforces Round #555 (Div. 3) c2 d e f
c2:Increasing Subsequence (hard version) 那边小取那边,然后相等比较后面的长度 #include<bits/stdc++.h> using name ...
- Codeforces Round #510 (Div. 2) AB By cellur925
第一次CF祭== 由于太菜了只做了前两题== 因为在第一题上耗费时间太多了,我还是太菜了==. A. Benches time limit per test 1 second memory limit ...
- Codeforces Round #555 (Div. 3), problem: (C2) Increasing Subsequence (hard version)【贪心+撞到南墙也不回头】
题目链接 题目大意 复杂版大意是我们可以从左右两端每次拿走一个数,一直拿,不过要满足一个条件,每次拿的数要保证严格递增(即从小到大然后不会有相同的情况) 复杂版的话是会有相同的数字出现 在题解中正式说 ...
- Codeforces Round #699 (Div. 2) F - AB Tree(贪心、树上DP)超级清晰,良心题解,看不懂来打我 ~
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Codeforces Round #699 (Div. 2) F - AB Tree Problem ...
- Codeforces Round #739 (Div. 3) ABCDEF1F2 解题思路
Codeforces Round #739 (Div. 3) 可能是一开始大佬都写F1去了,我在D写完后发现F过的人数比E多了好多(个位数与十位数),以为F1比较简单,就直接开F1了,但自己分类讨论老 ...
- Codeforces Round #701 (Div. 2) A ~ F ,6题全,超高质量良心题解【每日亿题】2021/2/13
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A - Add and Divide B - Replace and Keep Sorted C ...
- Codeforces Round #698 (Div. 2)(A ~ F)6题全,超高质量题解)【每日亿题】2021/2/4
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 [每日亿题]Codeforces Round #698 (Div. 2)(A ~ F)6题全,超 ...
最新文章
- Silverlight实用窍门系列:40.Silverlight中捕捉视频,截图保存到本地
- jmeter的基本功能使用详解
- 操作系统(十二)线程的实现方式、多线程模型
- HIN2Vec:异质信息网络中的表示学习 | PaperDaily #18
- springboot工程中各个层次的作用+springboot连接数据库的工具汇总+Mybatis的开发方式/语法
- [vue] 你有使用过babel-polyfill模块吗?主要是用来做什么的?
- JS 同步本地时间和服务器时间
- Photoshop/PS中如何写维吾尔语等语言 乱码
- 全国计算机考试一级在线模拟,全国计算机等级考试一级模拟试题和答案
- 一个月通过软考中级软件设计师
- cuda 各个版本下载
- python字典函数values(),keys(),items()的用法与区别
- 方差缩减——分层抽样
- java整数相乘得负数_关于java:将2(小)个数字相乘得到负数的解决方案,而不是溢出…为什么?...
- PCB:Beyond Part Models: Person Retrieval with Refined Part Pooling(论文阅读笔记)
- 程序员github头像_给新程序员的5个GitHub技巧
- android 根据图片路径获取图片缩略图
- C语言计算5+55+555+5555+55555
- cad详图怎么画_施工图大样图都是怎么学的怎么画的cad 室内设计
- ISCC web题复现