[CF1311A] Add Odd or Subtract Even
Solution
a<b, delta=odd, ans=1
a<b, delta=even, ans=2
a=b ans=0
a>b, delta=odd, ans=2
a>b, delta=even, ans=1
#include <bits/stdc++.h>
using namespace std;
signed main() {
int t,a,b;
ios::sync_with_stdio(false);
cin>>t;
while(t--) {
cin>>a>>b;
if(a<b) {
if((b-a)%2) cout<<1<<endl;
else cout<<2<<endl;
}
else if(a==b) cout<<0<<endl;
else {
if((b-a)%2) cout<<2<<endl;
else cout<<1<<endl;
}
}
}
[CF1311A] Add Odd or Subtract Even的更多相关文章
- Codeforce 1311A Add Odd or Subtract Even
Add Odd or Subtract Even time limit per test2 seconds memory limit per test256 megabytes inputstanda ...
- Codeforces Round #624 (Div. 3) A. Add Odd or Subtract Even(水题)
You are given two positive integers aa and bb . In one move, you can change aa in the following way: ...
- deep_learning_Function_tf.add()、tf.subtract()、tf.multiply()、tf.div()
tf.add().tf.subtract().tf.multiply().tf.div()函数介绍和示例 1. tf.add() 释义:加法操作 示例: x = tf.constant(2, dtyp ...
- Codeforces补题2020.2.28(Round624 Div 3)
A.Add Odd or Subtract Even 签到题~ #include<bits/stdc++.h> using namespace std; int T; int a,b; i ...
- Codeforces Round #624 (Div. 3)(题解)
A. Add Odd or Subtract Even 思路: 相同直接为0,如果两数相差为偶数就为2,奇数就为1 #include<iostream> #include<algor ...
- HDU 4919 Exclusive or 数学
题意: 定义 \[f(n)=\sum\limits_{i=1}^{n-1}(i\oplus (n-i))\] 求\(f(n),n \leq 10^{500}\) 分析: 这个数列对应OEIS的A006 ...
- 缓冲区溢出利用——捕获eip的傻瓜式指南
[译文] 摘要:为一个简单的有漏洞程序写一个简单的缓冲区溢出EXP,聚焦于遇到的问题和关键性的教训,提供详细而彻底的描述 内容表:1. I pity the fool, who can't smash ...
- [开源].NET数据库访问框架Chloe.ORM
扯淡 13年毕业之际,进入第一家公司实习,接触了 EntityFramework,当时就觉得这东西太牛了,访问数据库都可以做得这么轻松.优雅!毕竟那时还年轻,没见过世面.工作之前为了拿个实习机会混个工 ...
- Beginning Scala study note(4) Functional Programming in Scala
1. Functional programming treats computation as the evaluation of mathematical and avoids state and ...
随机推荐
- sql server如何判断数据库是否存在
如何判断数据库是否存在 执行下列的SQL,获得一张表,根据表的行数来判断. select * from master..sysdatabases where name=N'所查询的数据库名 ...
- thinkphp3关闭Runtime中的日志方法
将LOG_LEVEL允许记录的日志级别设置为空,则不会记录日志
- https搭建(自签名证书)
博客搬家: https搭建(自签名证书) 上一篇博客探究了https(ssl)的原理,为了贯彻理论落实于实践的宗旨,本文将记录我搭建https的实操流程,使用Apache2+ubuntu+openss ...
- Python 语言规范(Google)
Python语言规范 Lint tip 对你的代码运行pylint 定义: pylint是一个在Python源代码中查找bug的工具. 对于C和C++这样的不那么动态的(译者注: 原文是less dy ...
- PC微信逆向--实现消息防撤回
自从聊天软件消息撤回功能问世后,对于撤回的消息,我们对它一直有种强烈的好奇感."Ta刚撤回了什么?是骂我的话?还是说喜欢我?还是把发给其他人的消息误发给了我?好气呀,都看不到了...&quo ...
- 题解【CF1303D Fill The Bag】
\[ \texttt{Preface} \] 不开 long long 见祖宗. \[ \texttt{Description} \] 你有一个 \(n\) 码的袋子,你还有 \(m\) 个盒子,第 ...
- Linux命令行与Shell脚本编程大全
快来参加<Linux命令行与Shell脚本编程大全>学习吧,提升技能,展示自我. 点击链接即可进入学习:https://s.imooc.com/WTmCO6H 课程亮点适合零基础读者,从零 ...
- Golang-执行go get私有库提示”410 Gone“ 解决办法
之前没有使用过私有库,今天正好碰到,把解决方法整理一下 错误记录 如果你在用go get 私有库碰到如下类似错误: 解决方法 $ export GO111MODULE=on $ export GOPR ...
- pytorch-- Attention Mechanism
1. paper: Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translat ...
- Mysql 字符问题
先看一下mysql支持的字符范围 *数值类型:1.整形: 类型 大小 范围 ...