Codeforces Round #555 (Div. 3) AB
A: http://codeforces.com/contest/1157/problem/A
题意:每次加到10的整数倍之后,去掉后面的0,问最多有多少种可能。
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set> using namespace std; int main()
{
ios::sync_with_stdio(false);
cin.tie();
cout.tie(); int n;
set<int> si;
while(cin>>n){
si.clear();
si.insert(si.end(),n);
while(n!=){
n++;
while(n%==){
n/=;
}
si.insert(si.end(),n);
}
n=;
si.insert(si.end(),n);
while(n!=){
n++;
while(n%==){
n/=;
}
si.insert(si.end(),n);
}
cout<<si.size()<<endl;
}
return ;
}
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();
cout.tie(); int n;
string s1;
int mapp[];
while(cin>>n){
cin>>s1; string s3(s1);
for(int i=;i<;i++){
cin>>mapp[i];
}
for(int j=;j<s1.size();j++){
string s2(s1);
for(int i=j;i<s1.size();i++){
char t=mapp[s1[i]-'']+'';
if(t>=s1[i]){
s2[i]=mapp[s1[i]-'']+'';
}else{
break;
}
}
if(s2>s3) s3=s2;
}
cout<<s3<<endl;
}
return ;
}
Codeforces Round #555 (Div. 3) AB的更多相关文章
- Codeforces Round #713 (Div. 3)AB题
Codeforces Round #713 (Div. 3) Editorial 记录一下自己写的前二题本人比较菜 A. Spy Detected! You are given an array a ...
- Codeforces Round #260 (Div. 2)AB
http://codeforces.com/contest/456/problem/A A. Laptops time limit per test 1 second memory limit per ...
- Codeforces Round #259 (Div. 2)AB
链接:http://codeforces.com/contest/454/problem/A A. Little Pony and Crystal Mine time limit per test 1 ...
- 老年OIer的Python实践记—— Codeforces Round #555 (Div. 3) solution
对没错下面的代码全部是python 3(除了E的那个multiset) 题目链接:https://codeforces.com/contest/1157 A. Reachable Numbers 按位 ...
- CodeForces Round #555 Div.3
A. Reachable Numbers 代码: #include <bits/stdc++.h> using namespace std; ; int N; set<int> ...
- Codeforces Round #555 (Div. 3) E. Minimum Array
题意:b数组可以自由排序,c[i]=(a[i]+b[i])%n. 题目中要求c数组的字典序是最小的.那么我们需要尽量满足前面的c[i],才能使字典序最小. 我们知道a[i]和b[i]都是[0,n-1] ...
- Codeforces Round #555 (Div. 3)[1157]题解
不得不说这场div3是真的出的好,算得上是从我开始打开始最有趣的一场div3.因为自己的号全都蓝了,然后就把不经常打比赛的dreagonm的号借来打这场,然后...比赛结束rank11(帮dreago ...
- Codeforces Round #555 (Div. 3) c2 d e f
c2:Increasing Subsequence (hard version) 那边小取那边,然后相等比较后面的长度 #include<bits/stdc++.h> using name ...
- Codeforces Round #555 (Div. 3) D. N Problems During K Days 【数学思维】
一 题面 D. N Problems During K Days 二 分析 对于这题,刚开始我就是陷入了对公式的执着,企图用公式直接确定第一个数,然后试着去找序列.经过思考和手动模拟后发现是很难保证正 ...
随机推荐
- 也写dateUtil.js
yl.dateUtil = { /** * y 年 * M 月 * d 日 * H 时 h 时(am/pm) * m 分 * s 秒 * S 毫秒 * a 上午/下午(am/pm) * setInte ...
- springboot+mysql+mybatis+Mybatis-Generator+druid 项目demo
1.使用idea新建项目 2.使用Mybatis-Generator自动生成Dao.Model.Mapping相关文件 3.配置application.yml文件 server: port: 8080 ...
- CentOS7.6搭建redis4.0.1 cluster集群
1. 操作系统信息: $ uname -a Linux iZbp11d57wmumnwuihb2czZ -.el7.x86_64 # SMP Fri Feb :: UTC x86_64 x86_64 ...
- nb-iot简介【转】
转自:http://www.elecfans.com/tags/nb-iot/ 标签 > nb-iot nb-iot 关注 118人关注 提供NB-IoT技术特点,NB-IoT模块/芯片,NB- ...
- mysql-数据(记录)相关操作(增删改查)及权限管理
一.介绍 在MySQL管理软件中,可以通过SQL语句中的DML语言来实现数据的操作,包括 使用INSERT实现数据的插入 UPDATE实现数据的更新 使用DELETE实现数据的删除 使用SELECT查 ...
- 20175226 2018-2019-2 《Java程序设计》第五周学习总结
20175226 2018-2019-2 <Java程序设计>第五周学习总结 教材学习内容总结 接口 包含接口声明和接口体 接口声明interface 接口的名字 接口体中包含常量的声明( ...
- 基于tkinter的GUI编程
tkinter:tkinter是绑定了Python的TKGUI工具集,就是Python包装的Tcl代码,通过内嵌在Python解释器内部的Tcl解释器实现的,它是Python标准库的一部分,所以使用它 ...
- 01-Linux操作系统+指令
一.Linux操作系统 操作系统定义:操作系统直接运行在计算机上的系统软件, 它是与硬件打交道和控制软件运行的计算机程序. 虚拟机:就是模拟一个真实的计算机,好比一个虚拟的电 ...
- 卢卡斯定理——应用hdu4349
#include<bits/stdc++.h> using namespace std; int n; int main(){ while(cin>>n){ ; while(n ...
- OpenCV-Python-边缘检测
Canny边缘检测方法被誉为边缘检测的最优方法. import cv2 import numpy as np img = cv2.imread('handwriting.jpg', 0) edges ...