A

/* Huyyt */
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define mkp(a,b) make_pair(a,b)
#define pb push_back
const int dir[][] = {{, }, {, }, {, -}, { -, }, {, }, {, -}, { -, -}, { -, }};
using namespace std;
typedef long long ll;
inline void read(int &v)
{
v = ;
char c = ;
int p = ;
while (c < '' || c > '')
{
if (c == '-')
{
p = -;
}
c = getchar();
}
while (c >= '' && c <= '')
{
v = (v << ) + (v << ) + c - '';
c = getchar();
}
v *= p;
}
const long long mod = 1e9 + ;
const int N = 1e5 + ;
int main()
{
ll a, b, c, k;
cin >> a >> b >> c >> k;
if (k % == )
{
cout << b - a << endl;
}
else
{
cout << a - b << endl;
}
return ;
}

B

只要算出最长 数字连续子序列就可以了

/* Huyyt */
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define mkp(a,b) make_pair(a,b)
#define pb push_back
const int dir[][] = {{, }, {, }, {, -}, { -, }, {, }, {, -}, { -, -}, { -, }};
using namespace std;
typedef long long ll;
inline void read(int &v)
{
v = ;
char c = ;
int p = ;
while (c < '' || c > '')
{
if (c == '-')
{
p = -;
}
c = getchar();
}
while (c >= '' && c <= '')
{
v = (v << ) + (v << ) + c - '';
c = getchar();
}
v *= p;
}
const long long mod = 1e9 + ;
const int N = 2e5 + ;
int n;
int num[N];
int aim[N];
int main()
{
read(n);
int now;
for (int i = ; i <= n; i++)
{
read(now);
num[now] = i;
}
int ans = ;
int ansmaxn = ;
for (int i = ; i <= n; i++)
{
if (num[i] > num[i - ])
{
ans++;
}
else
{
ans = ;
}
ansmaxn = max(ansmaxn, ans);
}
cout << n - ansmaxn << endl;
return ;
}

C

给你两个数组A,B  A全为0  B是给定的N个数

一次操作可以使得Ai(2<=i<=N) 变为 Ai-1+1

解:

首先排除不合法的情况: ①.当A0不为0的时候 ②.当前面的数减后面的数大于1的时候

/* Huyyt */
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define mkp(a,b) make_pair(a,b)
#define pb push_back
const int dir[][] = {{, }, {, }, {, -}, { -, }, {, }, {, -}, { -, -}, { -, }};
using namespace std;
typedef long long ll;
inline void read(int &v)
{
v = ;
char c = ;
int p = ;
while (c < '' || c > '')
{
if (c == '-')
{
p = -;
}
c = getchar();
}
while (c >= '' && c <= '')
{
v = (v << ) + (v << ) + c - '';
c = getchar();
}
v *= p;
}
const long long mod = 1e9 + ;
const int N = 2e5 + ;
int n;
ll num[N];
int main()
{
read(n);
for (int i = ; i <= n; i++)
{
cin >> num[i];
}
if (num[] != )
{
cout << - << endl;
return ;
}
for (int i = ; i <= n; i++)
{
if (num[i] - num[i - ] > )
{
cout << - << endl;
return ;
}
}
ll anser = ;
for (int i = ; i <= n; i++)
{
if (num[i] == num[i - ] + )
{
anser++;
}
else
{
anser += num[i];
}
}
cout << anser << endl;
return ;
}

D

At grand 024的更多相关文章

  1. Atcoder Grand Contest 024 E - Sequence Growing Hard(dp+思维)

    题目传送门 典型的 Atcoder 风格的计数 dp. 题目可以转化为每次在序列中插入一个 \([1,k]\) 的数,共操作 \(n\) 次,满足后一个序列的字典序严格大于前一个序列,问有多少种操作序 ...

  2. Atcoder Grand Contest 024

    A 略 B 略 C 略 D(构造分形) 题意: 给出一个由n个点的组成的树,你可以加一些点形成一个更大的树.对于新树中的两个点i和j,如果以i为根的树与以j为根的树是同构的那么i和j颜色可以相同.问最 ...

  3. [AtCoder Grand Contest 024 Problem E]Sequence Growing Hard

    题目大意:考虑 N +1 个数组 {A0,A1,…,AN}.其中 Ai 的长度是 i,Ai 内的所有数字都在 1 到 K 之间. Ai−1 是 Ai 的子序列,即 Ai 删一个数字可以得到 Ai−1. ...

  4. NSThread 子线程 Cocoa NSOperation GCD(Grand Central Dispatch) 多线程

    单词:thread 英 θred:n 线.思路.vt 穿过.vi 穿透过 一.    进程.线程 进程:正在进行中的程序被称为进程,负责程序运行的内存分配,每一个进程都有自己独立的虚拟内存空间 线程: ...

  5. Reading With Purpose: A grand experiment

    Reading With Purpose: A grand experiment This is the preface to a set of notes I'm writing for a sem ...

  6. 在Swift中应用Grand Central Dispatch(上)转载自的goldenfiredo001的博客

    尽管Grand Central Dispatch(GCD)已经存在一段时间了,但并非每个人都知道怎么使用它.这是情有可原的,因为并发很棘手,而且GCD本身基于C的API在 Swift世界中很刺眼. 在 ...

  7. Grand Central Dispatch (GCD)

    Grand Central Dispatch (GCD) Reference Grand Central Dispatch (GCD) comprises language features, run ...

  8. iOS 中NSOperationQueue,Grand Central Dispatch , Thread的上下关系和区别

    In OS X v10.6 and later, operation queues use the libdispatch library (also known as Grand Central D ...

  9. php大力力 [024节]PHP中的字符串连接操作(2015-08-27)

    2015-08-27 php大力力024.PHP中的字符串连接操作 PHP中的字符串连接操作  阅读:次   时间:2012-03-25 PHP字符串的连接的简单实例 时间:2013-12-30 很多 ...

随机推荐

  1. FragmentFactory

    import android.support.v4.app.Fragment; import java.util.HashMap; public class FragmentFactory { pri ...

  2. 阶段3 2.Spring_03.Spring的 IOC 和 DI_10 构造函数注入

    在AccountServiceImpl内定义三个属性 这里关注点是这几种类型.基本类型的包装类Integer 还有String类型,也包含了其他bean类型.Date 定义构造函数并赋值 重点关注在数 ...

  3. 深入理解Istio核心组件之Pilot

    Istio作为当前服务网格(Service Mesh)领域的事实标准,流量治理(Traffic Management)是其最为基础也最为重要的功能.本文将结合源码对Istio流量治理的实现主体——组件 ...

  4. this引用逸出

    1.定义 public class UnsafeClass { public UnsafeClass(Button button) { button.addActionListener(new Act ...

  5. 【深度聚类】Superpixel Sampling Networks

    Superpixel Sampling Networks 原始文档:https://www.yuque.com/lart/papers/ssn 本文的思想很简单,传统的超像素算法是一种有效的低/中级的 ...

  6. CentOS7之root密码破解

    1.重新启动Linux系统,在出现引导界面时上下移动光标选择第一引导项,按下键盘的“e”键进入内核编辑界面,如图所示: 2.找到linux16参数这一行,按住“Ctrl+e”组合键跳转到行尾,添加rd ...

  7. [BJWC2008] Gate Of Babylon

    题目链接 容斥+隔板法+Lucas定理 #include <bits/stdc++.h> using namespace std; const int N=1e5+10; int n,m, ...

  8. 直线的Bresenham算法

    在实验课上用自己的算法画直线被diss效率低 花了半天时间看了下Bresenham算法真

  9. thread 多线程2

    ###24.04_多线程(多线程程序实现的方式1)(掌握) * 1.继承Thread * 定义类继承Thread * 重写run方法 * 把新线程要做的事写在run方法中 * 创建线程对象 * 开启新 ...

  10. js 获取ip和城市

    <script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>