CF 1136B Nastya Is Playing Computer Games
题目链接: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的更多相关文章
- Codeforces Round #546 (Div. 2) B. Nastya Is Playing Computer Games
链接:https://codeforces.com/contest/1136/problem/B 题意: 有n个井盖,每个井盖上有一个小石头. 给出n和k,k表示刚开始在第k个井盖上方. 有三种操作, ...
- 论文笔记之:Playing for Data: Ground Truth from Computer Games
Playing for Data: Ground Truth from Computer Games ECCV 2016 Project Page:http://download.visinf.tu- ...
- (转) Playing FPS games with deep reinforcement learning
Playing FPS games with deep reinforcement learning 博文转自:https://blog.acolyer.org/2016/11/23/playing- ...
- [SOJ] 1282. Computer games (KMP)
坑爹题 1282. Computer Game Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Brian is an ...
- 【CF】556D A Lot of Games
构建trie树,可以得到4类结点:必胜点,必负点,完全主宰点(可胜可负),完全无法主宰点(无法控制最终胜负).递归到叶子结点,即为必胜点,回溯分情况讨论.注意叶子结点使用属性n来控制,n表示当前结点的 ...
- Playing FPS Games with Deep Reinforcement Learning
论文不同点: (1)用两套网络分别实现移动和射击. (2)使用LSTM来处理不完全信息. 疑问: (1)为什么对于射击使用RNN,对导航却没有使用RNN.一般来说,当我们看见视野里面有敌人的时候,我们 ...
- CF 1136C Nastya Is Transposing Matrices
题目链接:http://codeforces.com/problemset/problem/1136/C 题目分析 看了题目之后,第一想法:任意位置都可以倒置,要是枚举,铁定的超时.所以需要探索规律. ...
- Solution -「CF 555E」Case of Computer Network
\(\mathcal{Description}\) Link. 给定 \(n\) 个点 \(m\) 条边的无向图,判断是否有给每条边定向的方案,使得 \(q\) 组有序点对 \((s,t)\) ...
- CF 1136A 1136B 1136C 1136D 1136E(Round546ABCDE)题解
题目地址:https://codeforces.com/contest/1136 A: Nastya Is Reading a Book 题解:挨个判断即可,水题. 参考代码: #include< ...
随机推荐
- 悲观锁,乐观锁以及MVCC
在上文中,我们探讨了MySQL不同存储引擎中的各类锁,在这篇文章中我们将要讨论的是MySQL是如何实现并发控制的.并发问题有三种,分别为: 读-读,不存在任何问题 读-写,有隔离性问题,可能遇到脏读( ...
- cp:复制文件和目录
cp 命令,主要用来复制文件和目录,同时借助某些选项,还可以实现复制整个目录,以及比对两文件的新旧而予以升级等功能. cp 命令的基本格式如下:cp [选项] 源文件 目标目录/文件 选项: -a:相 ...
- python动态的添加方法
1.动态的创建实例方法 1 class Person(object): 2 def __init__(self,name,age): 3 self.name = name 4 self.age =ag ...
- ovs-vsctl patch 连接两个网桥
1.命令如下: ovs-vsctl add-port bridge-name port-name ovs-vsctl set interface port-name type=patch ovs-vs ...
- BOM—Browser Object Model and DOM—Document Object Model
浏览器对象模型的内涵是每个页面都是一个window对象,而dom是document为基准的模型,而document与wimdow.document指向相同,所以可以这么理解,bom模型的定义是包括do ...
- C++入门经典-例3.5-判断某一年是否是闰年之嵌套判断
1:代码如下: // 3.5.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream> using ...
- ftp反向代理配置
说明:源ftp在内网,访问在另一个内网,要求用户对真实ftp地址透明,且免密访问. 1.将ftp配置为被动模式,指定被动访问端口映射出来. // vsftp配置被动模式,列出主要配置 connect_ ...
- PADS常用画板过程
转载:PADS LAYOUT的一般流程 http://www.doc88.com/p-9129306856292.html https://wenku.baidu.com/view/cc4e0b338 ...
- [Python]操作shell脚本报错Permission denied
问题: In []: os.system('./test_shell_no_para.sh') : ./test_shell_no_para.sh: Permission denied Out[]: ...
- 基于对象的orm跨表查询再练习
model.py from django.db import models # Create your models here. class Book(models.Model): nid = mod ...