A. Reverse a Substring

代码:

#include <bits/stdc++.h>
using namespace std; int N;
string s; int main() {
scanf("%d", &N);
cin >> s; int temp = -;
for(int i = ; s[i]; i ++) {
if(s[i] < s[i - ]) {
temp = i;
break;
}
} if(temp == -) printf("NO\n");
else {
printf("YES\n");
temp += ;
printf("%d %d\n", temp - , temp);
} return ;
}

B. Game with Telephone Numbers

代码:

#include <bits/stdc++.h>
using namespace std; int N;
int eight = ;
string s; int main() {
scanf("%d", &N);
cin >> s;
bool flag = true;
for(int i = ; i <= N - ; i ++) {
if(s[i] == '')
eight ++;
}
if(eight <= ((N - ) / )) flag = false; if(flag) printf("YES\n");
else printf("NO\n"); return ;
}

C. Alarm Clocks Everywhere

代码:

#include <bits/stdc++.h>
using namespace std; const int maxn = 3e5 + ;
int N, M;
long long a[maxn], p[maxn], b[maxn]; long long gcd(long long a, long long b) {
return b == ? a : gcd(b, a % b);
} int main() {
scanf("%d%d", &N, &M);
long long t;
for(int i = ; i <= N; i ++) {
cin >> a[i];
//scanf("%lld", &a[i]);
if(i == ) b[i] = ;
else b[i] = a[i] - a[i - ];
} for(int i = ; i <= N; i ++) {
if(i == ) t = b[i];
else t = gcd(t, b[i]);
} bool flag = false;
int temp;
for(int i = ; i <= M; i ++) {
cin >> p[i];
//scanf("%lld", &p[i]);
if(t % p[i] == ) {
temp = i;
flag = true;
}
} int ansp = temp;
if(!flag) printf("NO\n");
else {
printf("YES\n");
cout << a[] << " " << ansp << endl;
} return ;
}

D. Beautiful Array

代码:(D 神仙 dp 自己写了贪心 但是不对有一些情况不可以 枯了 )

#include <bits/stdc++.h>
using namespace std; const int maxn = 3e5 + ;
long long a[maxn], dp[maxn][];
int N, K; int main() {
memset(dp, -1e18, sizeof(dp));
scanf("%d%d", &N, &K);
long long ans = ;
for(int i = ; i <= N; i ++) {
cin >> a[i];
dp[i][] = max(dp[i - ][], 0LL) + a[i];
dp[i][] = max(max(dp[i - ][], dp[i - ][]), 0LL) + 1LL * K * a[i];
dp[i][] = max(max(max(dp[i - ][], dp[i - ][]), dp[i - ][]), 0LL) + a[i];
ans = max(ans, max(dp[i][], max(dp[i][], dp[i][])));
}
cout << ans << endl;
return ;
}

 

Education CodeForces Round 63 Div.2的更多相关文章

  1. Educational Codeforces Round 63 Div. 2

    A:找到两个相邻字符使后者小于前者即可. #include<bits/stdc++.h> using namespace std; #define ll long long #define ...

  2. Codeforces Beta Round #63 (Div. 2)

    Codeforces Beta Round #63 (Div. 2) http://codeforces.com/contest/69 A #include<bits/stdc++.h> ...

  3. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  4. CF922 CodeForces Round #461(Div.2)

    CF922 CodeForces Round #461(Div.2) 这场比赛很晚呀 果断滚去睡了 现在来做一下 A CF922 A 翻译: 一开始有一个初始版本的玩具 每次有两种操作: 放一个初始版 ...

  5. Codeforces Round #545 (Div. 1) 简要题解

    这里没有翻译 Codeforces Round #545 (Div. 1) T1 对于每行每列分别离散化,求出大于这个位置的数字的个数即可. # include <bits/stdc++.h&g ...

  6. Codeforces Round #455 (Div. 2)

    Codeforces Round #455 (Div. 2) A. Generate Login 题目描述:给出两个字符串,分别取字符串的某个前缀,使得两个前缀连起来的字符串的字典序在所有方案中最小, ...

  7. Codeforces Round #556 (Div. 1)

    Codeforces Round #556 (Div. 1) A. Prefix Sum Primes 给你一堆1,2,你可以任意排序,要求你输出的数列的前缀和中质数个数最大. 发现只有\(2\)是偶 ...

  8. [Educational Codeforces Round 63 ] D. Beautiful Array (思维+DP)

    Educational Codeforces Round 63 (Rated for Div. 2) D. Beautiful Array time limit per test 2 seconds ...

  9. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

随机推荐

  1. 用ASP.NET Core 2.1 建立规范的 REST API -- 保护API和其它

    本文介绍如何保护API,无需看前边文章也能明白吧. 预备知识: http://www.cnblogs.com/cgzl/p/9010978.html http://www.cnblogs.com/cg ...

  2. “挑三拣四”地学一学Java I/O

    古人云:“读书破万卷,下笔如有神”.也就是说,只有大量的阅读,写作的时候才能风生水起——写作意味着输出(我的知识传播给他人),而读书意味着输入(从他人的知识中汲取营养). 对于Java I/O来说,I ...

  3. 如何在ASP.NET Core程序启动时运行异步任务(3)

    原文:Running async tasks on app startup in ASP.NET Core (Part 3) 作者:Andrew Lock 译者:Lamond Lu 之前我写了两篇有关 ...

  4. 学习笔记01(mybatis逆向工程)

    今天来看看一个常用的小功能,就是mybatis的逆向工程.(数据库是mysql) 什么是逆向工程呢?看名字就知道反方向的一个什么工程! 其实啊,如果是平常我们自己学习实践一些小项目的时候,应该是先瞎写 ...

  5. Springboot 系列(五)Spring Boot web 开发之静态资源和模版引擎

    前言 Spring Boot 天生的适合 web 应用开发,它可以快速的嵌入 Tomcat, Jetty 或 Netty 用于包含一个 HTTP 服务器.且开发十分简单,只需要引入 web 开发所需的 ...

  6. Django-restframework 源码之认证组件源码分析

    Django-restframework 源码之认证组件源码分析 一 前言 之前在 Django-restframework 的流程分析博客中,把最重要的关于认证.权限和频率的方法找到了.该方法是 A ...

  7. C# 插入文本框到PPT幻灯片

    概述 在文本框中我们可以实现的操作有很多,如插入文字.图片.设置字体大小.颜色.文本框背景填充.边框设置等.下面的示例中,将介绍通过C# 在PPT幻灯片中插入幻灯片的方法. 示例中包含了以下要点: 插 ...

  8. Java中nextLine()与其他next(),nextInt(),nextFloat()的区别

    最近学习Java过程中遇到一个小问题,就是用nextInt()来接收输入内容时,按完回车之后会产生后面的内容无法输入的结果,因此来做个小记录.有不足的地方还请大家指出. 区别一  读取返回结果 nex ...

  9. Yii2设计模式——Yii2中用到哪些设计模式?

    "Yii2设计模式"包含了两个方面的内容:1.设计模式,2.Yii2框架. <设计模式>一书虽然以JAVA语言来表达设计模式的思想,但是设计模式远不限制于某一种特定的语 ...

  10. 微信小程序 canvas 文字自动换行

    Page({ drawCanvas: function(ctx) {// 地址 ctx.setFontSize() ctx.setFillStyle('#9E7240') ctx.textAlign= ...