A

0~9需要多少笔画,自取7和1,判奇偶

 #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define it register int
#define lowbit(x) (x)&(-x)
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
const int maxn=1e5+;
int n,m;
int t;
int main(){
scanf("%d",&t);
while(t--){
scanf("%d",&n);
if(n&){
n-=;
printf("");
int ci=n/;
for(it i=;i<ci;i++){
printf("");
}
printf("\n");
}
else{
int ci=n/;
for(it i=;i<ci;i++){
printf("");
}
printf("\n");
}
}
return ;
}

B

被hack了,早上仔细一想,发现判m==0的时候少考虑了几个条件,直接a[i]==m就过了,所以就必被hack了

 #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define it register int
#define lowbit(x) (x)&(-x)
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
const int maxn=1e5+;
int n,m;
int t,a[maxn];
char s[maxn];
int main(){
scanf("%d",&t);
while(t--){
scanf("%d%d",&n,&m);
scanf("%s",s);
int l=strlen(s);
a[]=;
int ji=;
for(it i=;i<l;i++){
if(s[i]==''){
a[i+]=a[i]+;
}
else{
a[i+]=a[i]-;
}
if(a[i+]&){
ji++;
}
}
if(a[l]< && m>){
int sum=;
for(it i=;i<=l;i++){
if((m-a[i])%a[l]== && m<=a[i]){
sum++;
}
}
printf("%d\n",sum);
}
else if(a[l]> && m<){
int sum=;
for(it i=;i<=l;i++){
if((m-a[i])%a[l]== && m>=a[i]){
sum++;
}
}
printf("%d\n",sum);
}
else if(a[l]==){
int sum=;
for(it i=;i<=l;i++){
if(a[i]==m){
sum++;
}
}
if(!sum){
printf("%d\n",sum);
}
else{
printf("-1\n");
}
}
else if(m==){
int sum=;
for(it i=;i<=l;i++){
if(a[i]== || (a[l]< && <a[i] || a[l]> && >a[i])&& a[i]%a[l]==){
sum++;
}
}
printf("%d\n",sum);
} else{
int sum=;
for(it i=;i<=l;i++){
if((m-a[i])%a[l]== && m> &&m>=a[i]){
sum++;
}
if((m-a[i])%a[l]== && m< &&m<=a[i]){
sum++;
}
}
printf("%d\n",sum);
}
}
return ;
}

昨天比的时候B题感觉不太好,但过了就没细想,果然出现问题了

C

就是找字母位置,是否比他大,或者有无

 #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define it register int
#define lowbit(x) (x)&(-x)
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
const int maxn=1e5+;
int n,m;
int t;
char s[maxn],ss[maxn];
int a[][maxn];
int main(){
scanf("%d",&t);
while(t--){
scanf("%s",s);scanf("%s",ss);
int l=strlen(s),l1=strlen(ss);
for(it i=;i<;i++){
a[i][]=;
}
for(it i=;i<l;i++){
int c=s[i]-'a';
a[c][++a[c][]]=i;
}
int pos=-,f=,bu=;
for(it i=;i<l1;i++){
int c=ss[i]-'a';
if(a[c][]==){f=;break;}
int pps=upper_bound(a[c]+,a[c]++a[c][],pos)-a[c];//cout<<pps<<endl;
if(a[c][pps]>pos && a[c][]>=pps){
pos=a[c][pps];
}
else{
bu++;pos=a[c][];
}
//cout<<a[c][pps]<<" "<<pos<<endl;
}
if(f){
printf("%d\n",bu);
}
else{
printf("-1\n");
}
}
return ;
}

D

忘记要容斥,最后发现答案输出有负数存在,所以待补

https://www.cnblogs.com/luoyugongxi/p/12243962.html

upd:没想倒是原题……这次没想到被hack完还能上几分,这B题真搞。

有空,有能力补EF

https://codeforces.com/contest/1295

Educational Codeforces Round 81 (Rated for Div. 2)的更多相关文章

  1. [Educational Codeforces Round 81 (Rated for Div. 2)]E. Permutation Separation(线段树,思维,前缀和)

    [Educational Codeforces Round 81 (Rated for Div. 2)]E. Permutation Separation(线段树,思维,前缀和) E. Permuta ...

  2. Educational Codeforces Round 81 (Rated for Div. 2) B. Infinite Prefixes

    题目链接:http://codeforces.com/contest/1295/problem/B 题目:给定由0,1组成的字符串s,长度为n,定义t = sssssss.....一个无限长的字符串. ...

  3. Educational Codeforces Round 81 (Rated for Div. 2) C. Obtain The String

    题目链接:http://codeforces.com/contest/1295/problem/C 题目:给定字符串s,t.  给定一个空串z,需要按照规则把z构造成 string z == stri ...

  4. Educational Codeforces Round 81 (Rated for Div. 2) A-E简要题解

    链接:https://codeforces.com/contest/1295 A. Display The Number 贪心思路,尽可能放置更多位,如果n为奇数,消耗3去放置一个7,剩下的放1 AC ...

  5. Educational Codeforces Round 81 (Rated for Div. 2) 题解

    过了n天补的题解:D AB就不用说了 C. Obtain The String 思路挺简单的,就是贪心,但是直接贪心的复杂度是O(|s|*|t|),会超时,所以需要用到序列自动机 虽然名字很高端但是就 ...

  6. Educational Codeforces Round 81 (Rated for Div. 2)E(线段树)

    预处理把左集划分为大小为1~i-1时,把全部元素都移动到右集的代价,记作sum[i]. 然后枚举终态时左集的大小,更新把元素i 留在/移动到 左集的代价. 树状数组/线段树处理区间修改/区间查询 #d ...

  7. Educational Codeforces Round 81 (Rated for Div. 2) - D. Same GCDs(数学)

    题目链接:Same GCDs 题意:给你两个数$a$,$m(1 \leq a < m \leq 10^{10})$,求有多少个$x$满足:$0 \leq x < m$且$gcd(a,m)= ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 使用vs进行Nuget打包时的LicenseExpression填写示例参考

    新版的nuget包 PackageLicense 这样写 最近编译类库项目的时候发现总是有个 licenseUrl 的警告,警告信息如下: warning NU5125: The 'licenseUr ...

  2. c++ google glog模块安装和基本使用(ubuntu)环境

    1,如何安装 1 Git clone https://github.com/google/glog.git 2 cd glog 3 ./autogen.sh 4 ./configure --prefi ...

  3. python开发基础03-列表、元组、字典、集合操作方法汇总

    列表 创建列表: li = [1, 12, 9, "age", ["石振文", ["19", 10], "庞麦郎"], ...

  4. AcWing 240. 食物链

    #include <iostream> using namespace std; ; int n, m; int p[N], d[N]; //p是baba,d是距离 int find(in ...

  5. idea中的springboot+gradle项目报错springboot configuration annotation processor not found in classpath

    idea中的springboot项目,打开某个类run.halo.app.config.properties.HaloProperties.java,报错(使用gradle编译): springboo ...

  6. go基础_接口断言

    // interface package main import ( "fmt" ) //定义一个接口,接口名字Inter,接口的方法集有2个方法 type Inter inter ...

  7. 【使用python urllib时出现[SSL: CERTIFICATE_VERIFY_FAILED]报错的解决方案】

    "首先,这个报错是告诉你,你的证书有问题. 其次,出现这个问题的原因,在于Python本身. 问题原因 Python升级到2.7.9以后,引入了一个新特性. 当使用urllib打开https ...

  8. Sublime Text3搭建完美开发环境(Python+PHP+Javascript+nodejs+C++)

    一.Sublime配置(如已安装Package Control可跳过) sublime下载地址:http://www.sublimetext.com/3 安装Package Control插件: 直接 ...

  9. 结构体数组排序:1004 成绩排名 【pta】

    结构体模板 struct STU { string name; //用string可以代替char string num; int s; }; sort是用快速排序实现的,属于不稳定排序,stable ...

  10. 修改环境变量后,导致一些常用命令失效,如ll,ls,vi不能用

    因为一不小心将linux的环境变量修改错误,导致ll之类的常用命令都不能用,很是苦恼,通过百度查询,原来在敲命令时,敲完整的命令路径,还是可以的: 原文地址:http://www.cnblogs.co ...