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. 【自然语言处理】--视觉问答(Visual Question Answering,VQA)从初始到应用

    一.前述 视觉问答(Visual Question Answering,VQA),是一种涉及计算机视觉和自然语言处理的学习任务.这一任务的定义如下: A VQA system takes as inp ...

  2. Mybatis之旅第四篇-输入输出映射

    一.引言 在日常开发用到mybatis时,因为实际的开发业务场景很复杂,不论是输入的查询条件,还是返回的结果,经常是需要根据业务来定制,这个时候我们就需要自己来定义一些输入和输出映射 二.parame ...

  3. Swagger如何访问Ocelot中带权限验证的API

    先亮源代码:https://github.com/axzxs2001/Asp.NetCoreExperiment/tree/master/Asp.NetCoreExperiment/SwaggerDe ...

  4. Virtual Box虚拟机Ubuntu系统安装及基本配置

    Linux简介 什么是 Linux? Linux:世界上不仅只有一个 Windows 操作系统,还有 Linux.mac.Unix 等操作系统.桌面操作系统下 Windows 是霸主,而 Linux ...

  5. DSAPI 简单WebAPI实现

    使用DSAPI实现一个简单的WebAPI功能,以便各客户端访问.支持身份验证,支持基础防护. 新建项目(以下演示控制台示例),引用DSAPI.dll. 复制粘贴以下代码: Module Module1 ...

  6. 使用wepy开发微信小程序01——常用的组件

    1.axio.js 'use strict' import axios from 'axios' import wepyAxiosAdapter from 'wepy-plugin-axios/dis ...

  7. 系统设计Design For Failure思想

    系统设计Design For Failure思想 Complex systems fail in spectacular ways. Failure isn't a question of if, b ...

  8. WIN10安装不上IIS,使用IISExpress作为发布服务

    [背景] 本人开发Win程序,需要调用网站资源作为Win程序的辅助功能,为此需要本地开发环境支持IIS.最近重装系统,VS安装完后,接着再安装IIS,可以在添加删除程序中反复尝试,均告安装失败提示.最 ...

  9. 如何在Eclipse中彻底修改一个项目名称

    在实际工作中,有时候为了赶时间,往往通过复制项目得到一个成型的框架.那么怎么才可以彻底修改项目名称呢? 1.web.xml 2.工作空间中找到当前项目下.project文件 3.工作空间中找到当前项目 ...

  10. axios+Vue上传文件显示进度

    一,前言 最近在用Vue,然后上传文件时需要显示进度,于是网上搜了一下,经过自己实测终于也弄明白了 二,效果 三,代码 HTML代码 <div id="app"> &l ...