题目链接:codeforces.com/problemset/problem/1136/B

题目分析

首先,读完题目,看了是个B题,嗯嗯......

果断找规律,然后交了一波,居然过了!!!

代码区

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include <vector>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int Max = 5e2 + 10;
const int mod = 1e9 + 7; int main()
{
int n, k;
while (scanf("%d%d", &n, &k) != EOF)
{
int a = min(abs(k - 1), abs(n - k));
printf("%d\n", 3 * n + a);
}
return 0;
}

CF 1136B Nastya Is Playing Computer Games的更多相关文章

  1. Codeforces Round #546 (Div. 2) B. Nastya Is Playing Computer Games

    链接:https://codeforces.com/contest/1136/problem/B 题意: 有n个井盖,每个井盖上有一个小石头. 给出n和k,k表示刚开始在第k个井盖上方. 有三种操作, ...

  2. 论文笔记之:Playing for Data: Ground Truth from Computer Games

    Playing for Data: Ground Truth from Computer Games ECCV 2016 Project Page:http://download.visinf.tu- ...

  3. (转) Playing FPS games with deep reinforcement learning

    Playing FPS games with deep reinforcement learning 博文转自:https://blog.acolyer.org/2016/11/23/playing- ...

  4. [SOJ] 1282. Computer games (KMP)

    坑爹题 1282. Computer Game Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Brian is an ...

  5. 【CF】556D A Lot of Games

    构建trie树,可以得到4类结点:必胜点,必负点,完全主宰点(可胜可负),完全无法主宰点(无法控制最终胜负).递归到叶子结点,即为必胜点,回溯分情况讨论.注意叶子结点使用属性n来控制,n表示当前结点的 ...

  6. Playing FPS Games with Deep Reinforcement Learning

    论文不同点: (1)用两套网络分别实现移动和射击. (2)使用LSTM来处理不完全信息. 疑问: (1)为什么对于射击使用RNN,对导航却没有使用RNN.一般来说,当我们看见视野里面有敌人的时候,我们 ...

  7. CF 1136C Nastya Is Transposing Matrices

    题目链接:http://codeforces.com/problemset/problem/1136/C 题目分析 看了题目之后,第一想法:任意位置都可以倒置,要是枚举,铁定的超时.所以需要探索规律. ...

  8. Solution -「CF 555E」Case of Computer Network

    \(\mathcal{Description}\)   Link.   给定 \(n\) 个点 \(m\) 条边的无向图,判断是否有给每条边定向的方案,使得 \(q\) 组有序点对 \((s,t)\) ...

  9. CF 1136A 1136B 1136C 1136D 1136E(Round546ABCDE)题解

    题目地址:https://codeforces.com/contest/1136 A: Nastya Is Reading a Book 题解:挨个判断即可,水题. 参考代码: #include< ...

随机推荐

  1. Eclipse中导入两个相同的工程

    问题描述:同时在Eclipse中导入两个相同的工程,会有 Some projects cannot be imported because they already exist in the work ...

  2. 计算几何 点对处理 #345 (Div. 2) C. Watchmen

    题目:给你n(<=2*1e5)个点,求其中有多少个点对之间的连线向量平行坐标轴: #include <iostream> #include <cstdio> #inclu ...

  3. 3.JSP

        JSP(Java Server Pages)页面是指扩展名为.jsp的文件,在一个JSP中可以包含指令标识,HTML代码, JavaScript代码,嵌入的Java代码,注释和JSP动作标识等 ...

  4. js获取iframe里面的dom

    最近在写页面遇到了问题,一个dom好多地方用到,然后我就单独写了个html页面,然后用iframe引入,但是,想获取iframe里面input的value,获取不到input,后面才知道原来js不能直 ...

  5. RedisTemplate集合使用说明-opsForList(二)

    1.leftPush(K key, V value) 在变量左边添加元素值. Java代码   redisTemplate.opsForList().leftPush("list" ...

  6. 12.并发编程--Queue

    并发编程--Queue Queue - 非阻塞队列 - 阻塞队列 Queue是一种特殊的线性表,它只允许在表的前端(front)进行删除操作,而在表的后端(rear)进行插入操作.进行插入操作的端称为 ...

  7. b站编程课程资源汇总

    b站编程课程资源汇总 一.总结 一句话总结: b站的编程资源很多,而且很良心 二.编程课程资源汇总 b站看到的,分享给大家 https://www.bilibili.com/video/av50680 ...

  8. js style.display = "" 和style.display="none" 区别

    style.display = "":是清除display样式,display将使用默认值(块元素会变成block,内联元素会变成inline)style.display=&quo ...

  9. MySQL 数据库 常用函数

    一.数学函数 数学函数主要用于处理数字,包括整型.浮点数等. ABS(x) 返回x的绝对值 SELECT ABS(-1) -- 返回1 CEIL(x),CEILING(x) 返回大于或等于x的最小整数 ...

  10. idea报错及解决

    <b>root project 'test2': Web Facets/Artifacts will not be configured properly</b>Details ...