Educational Codeforces Round 70 (Rated for Div. 2)
这次真的好难......
我这个绿名蒟蒻真的要崩溃了555...
我第二题就不会写......
暴力搜索MLE得飞起。
好像用到最短路?然而我并没有学过,看来这个知识点又要学。
后面的题目赛中都没看,今天早上看了一下D发现还是能写的。
A.You Are Given Two Binary Strings...
简单来说,对f(y)乘以2的k次,实际上就是把这个串左移k位。要使反转的串的字典序最小,就要让f(y)最后的1与f(x)的最后的1的位置对齐。
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
while(n--) {
string a,b;
cin>>a>>b;
reverse(a.begin(),a.end());
reverse(b.begin(),b.end());
int a1;
int b1=b.find('');
for(int i=b1;i<a.length();i++)
{
if(a[i]=='')
{
a1=i;
break;
}
}
if(a1<=b1)cout<<<<'\n';
else
cout<<a1-b1<<'\n'; }
return ;
}
D.Print a 1337-string...
构造问题,一步一步考虑:
先假设答案为“133X333333......7"(X是什么后面解释)
1.先考虑 '3',假设有n个‘3’,那么就会有Cn2 种情况(暂时不会latex...),当n为2,3,4...时,就会有1,3,6...种情况。
2.当输入的数ni不包括在Cn2 种(比如4,5)时,只需要计算出ni 与距离最近的Cn2 差值m,在答案中的X位置插入m个7即可。
举个例子:13
循环可知有4个3(n为4时有10种情况):“133X337" 。
差值为3所以往X的位置插入3个7,答案即为:”133777337“。
代码如下:
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+; int main()
{
int n;
cin>>n;
while(n--)
{
int a;
cin>>a;
int i;
for(i=;(i*(i-))/<=a;i++);
int n=i-;
int m=a-((n-)*n)/;
cout<<"";
for(int i=;i<m;i++)cout<<'';
for(int j=;j<n-;j++)cout<<'';
cout<<"7\n";
}
return ;
}
之后学了最短路把b题补了
Educational Codeforces Round 70 (Rated for Div. 2)的更多相关文章
- n=C(2,n)+k(构造)( Print a 1337-string)Educational Codeforces Round 70 (Rated for Div. 2)
题目链接:https://codeforc.es/contest/1202/problem/D 题意: 给你一个数 n ( <=1e9 ),让你构造137713713.....(只含有1,3,7 ...
- (模拟)关于进制的瞎搞---You Are Given a Decimal String...(Educational Codeforces Round 70 (Rated for Div. 2))
题目链接:https://codeforc.es/contest/1202/problem/B 题意: 给你一串数,问你插入最少多少数可以使x-y型机器(每次+x或+y的机器,机器每次只取最低位--% ...
- Educational Codeforces Round 70 (Rated for Div. 2) 题解
比赛链接:https://codeforc.es/contest/1202 A. You Are Given Two Binary Strings... 题意:给出两个二进制数\(f(x)\)和\(f ...
- Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...
随机推荐
- sql-实现select取行号、分组后在分组内排序、每个分组中的前n条数据
表结构设计: 实现select取行号 sql局部变量的2种方式 set @name='cm3333f'; select @id:=1; 区别:set 可以用=号赋值,而select 不行,必须使用:= ...
- 浅说——数位DP
老子听懂了!!!!! 好感动!!! 不说多了:Keywords: 数位DP,二进制,异或. “在信息学竞赛中,有一类与数位有关的区间统计问题.这类问题往往具有比较浓厚的数学味道,无法暴力求解,需要在数 ...
- iOS13中presentViewController的问题
iOS13中presentViewController的问题 更新了Xcode11.0 beta之后,在iOS13中运行代码发现presentViewController和之前弹出的样式不一样. 会出 ...
- POJ 3686:The Windy's(最小费用最大流)***
http://poj.org/problem?id=3686 题意:给出n个玩具和m个工厂,每个工厂加工每个玩具有一个时间,问要加工完这n个玩具最少需要等待的平均时间.例如加工1号玩具时间为t1,加工 ...
- 【JavaScript】深入理解call,以及与apply、bind的区别
一.call call有两个妙用 1.继承(我前面的文章有提到用call实现call继承,有兴趣可以看下.https://www.cnblogs.com/pengshengguang/p/105476 ...
- 2019-2020年值得关注的9个AR发展趋势
作者Andrew Makarov,由计算机视觉life编辑:乔媛媛编译 更好的阅读体验请看首发原文链接 2019-2020年值得关注的9个AR发展趋势 增强现实技术在2019年实现了创纪录的发展.微软 ...
- Go语言解密上篇中用java aes实现的加密
上一篇java aes文件加解密中加密的梅须逊雪三分白,雪却输梅一段香.使用go语言解密. 解密代码如下: AESUtil.go package util import ( "crypto/ ...
- baserecyclerviewadapterhelper -- setOnItemChildClickListener出现的问题
出现问题 使用baserecyclerviewadapterhelper 的时候使用 adapter.setOnItemChildClickListener()方法,点击没有反应. adapter.s ...
- TensorFlow笔记-文件读取
小数量数据读取 这些只用于可以完全加载到内存中的小型数据集: 1,储存在常数中 2,储存在变量中,初始化后,永远不改变它的值 使用常量 training_data = ... training_lab ...
- ping(网络诊断工具)
ping(网络诊断工具) Ping是Windows下的一个命令,在Unix和Linux下也有这个命令.ping也属于一个通信协议,是TCP/IP协议的一部分.利用"ping"命令可 ...