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

    set_switching_activity  -static   0.2   -toggle_rate   20 -period  1000 [all_inputs] 这时,翻转率设置的节点是输入, ...

  2. 微信小程序 (组件的使用)

    创建组件 在根目录创建components目录,然后创建列表组件 组件中内容 <view class="prolist"> //循环prolist列表 <view ...

  3. js加密(四)landChina

    1. url:https://www.landchina.com/default.aspx?tabid=226 2. target: 3. 简单分析 3.1 打开fiddler和chorme无痕浏览器 ...

  4. Java-POJ1000-A+B Problem

  5. 转:为什么说Java中只有值传递

    原文:https://www.cnblogs.com/wchxj/p/8729503.html 错误理解 在开始深入讲解之前,有必要纠正一下大家以前的那些错误看法了.如果你有以下想法,那么你有必要好好 ...

  6. Euler Sums系列(五)

    \[\Large\displaystyle \sum_{n=1}^{\infty} \frac{\widetilde{H_n}}{n^{3}}\] where \(\widetilde{H_n}\) ...

  7. html 中embed标签使用

    代码如下: embed src=url 说明:embed可以用来插入各种多媒体,格式可以是 Midi.Wav.AIFF.AU.MP3.PDF.jpg等等,Netscape及新版的IE 都支持.url为 ...

  8. 关于反射中如何剔除实体类中serialVersionUID字段

    Field[] fields = t.getClass().getDeclaredFields(); //这里为了剔除serialVersionUID Field[] tempArr = new Fi ...

  9. vue 一些学习笔记

    var, let, const 区别 //-----------------var----------------- var a = []; for(var i= 0; i < 10; i++) ...

  10. 连接mongodb服务

    语法:mongo.exe ip地址:端口号/数据库名(默认连接test) mongodb的默认端口号:27017 MongoDB内部结构   MongoDB MySQL 文档(Document) 记录 ...