Codeforces 38B - Chess
思路:懂点象棋的规则就可以,看看哪些点可以放马。
代码:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios::sync_with_stdio(false);
cin.tie();
string s,t;
cin>>s>>t;
int x=s[]-'a'+,y=s[]-'';
int a=t[]-'a'+,b=t[]-'';
int cnt=;
for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
if((i!=a||j!=b)&&i!=x&&j!=y&&(i-x)*(i-x)+(j-y)*(j-y)!=&&(i-a)*(i-a)+(j-b)*(j-b)!=)cnt++;
}
}
cout<<cnt<<endl;
return ;
}
Codeforces 38B - Chess的更多相关文章
- codeforces 893A Chess For Three 模拟
893A Chess For Three 思路: 直接模拟即可,第一盘永远是A与B开始 代码: #include <bits/stdc++.h> using namespace std; ...
- codeforces 985A Chess Placing
题意: 移动最少的步数,使得所有的棋子在同一颜色的格子中. 每次一个棋子只能向左或者向右移动一步,不能移到有棋子的格子中. 思路: 枚举全黑和全白的情况. 对于每一个需要移动的棋子,它移动到的位置一定 ...
- codeforces 845A Chess Tourney
参考:https://blog.csdn.net/zhongyuchen/article/details/77478039 #include <iostream> #include < ...
- Codeforces 845A. Chess Tourney 思路:简单逻辑题
题目: 题意:输入一个整数n,接着输入2*n个数字,代表2*n个选手的实力. 实力值大的选手可以赢实力值小的选手,实力值相同则都有可能赢. 叫你把这2*n个选手分成2个有n个选手的队伍. ...
- Codeforces Round #379 (Div. 2) D. Anton and Chess 水题
D. Anton and Chess 题目连接: http://codeforces.com/contest/734/problem/D Description Anton likes to play ...
- dp - Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess
Gerald and Giant Chess Problem's Link: http://codeforces.com/contest/559/problem/C Mean: 一个n*m的网格,让你 ...
- Codeforces Round #379 (Div. 2) D. Anton and Chess 模拟
题目链接: http://codeforces.com/contest/734/problem/D D. Anton and Chess time limit per test4 secondsmem ...
- CodeForces 259A Little Elephant and Chess
Little Elephant and Chess Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d &am ...
- Codeforces 1089E - Easy Chess - [DFS+特判][2018-2019 ICPC, NEERC, Northern Eurasia Finals Problem E]
题目链接:https://codeforces.com/contest/1089/problem/E Elma is learning chess figures. She learned that ...
随机推荐
- 更高效的MergeSort--稍微优化
0. 简介 本文简要介绍一下比传统MergeSort更高效的算法,在原来的算法Merge基础上,少发生一半拷贝.欢迎探讨,感谢阅读. 原文链接如下:http://loverszhaokai.com/p ...
- JSON草稿
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- linux基础命令---umask
umask 指定创建文件时所需要的权限掩码,掩码的执行权限对于文件没有效果.如果模式以数字开头,则解释为八进制数字:否则解释为符号模式掩码,类似于chmod(1)所接受的模式掩码.如果省略模式,则打印 ...
- 检测u盘是否挂载上方法
打开内核log:echo "8" > /proc/sys/kernel/printk 关闭内核log:echo "1" > /proc/sys/ke ...
- web前端----jQuery事件
事件 常用事件 click(function(){...}) hover(function(){...}) blur(function(){...}) focus(function(){...}) c ...
- web前端----css选择器样式
一.css概述 CSS是Cascading Style Sheets的简称,中文称为层叠样式表,对html标签的渲染和布局 CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明. 例如 二.c ...
- (六)最最基本的git操作
1.git init——初始化仓库 初始化成功的标志如下(.git默认为隐藏) 2.git status——查看仓库状态 ps:未跟踪的文件 (untracked files) 不妨在尝试在仓库建立一 ...
- ES6学习--箭头函数
1. 箭头函数基本形式 let func = (num) => num; let func = () => num; let sum = (num1,num2) => num1 + ...
- c++不自动生成相关函数比如赋值、拷贝函数
默认情况下,如果没有明确声明某些函数比如赋值.拷贝函数,c++会自动生成这些函数,通常他们是对成员进行by-value拷贝,有些时候,赋值.拷贝对象并无什么意义或者不合理,比如对于socket或者th ...
- 20145204《网络对抗》逆向及bof基础实践
20145204<网络对抗>逆向及bof基础实践 实践目的说明 实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函数会简单回显任何 ...