前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >洛谷P4413 [COCI2006-2007#2] R2(可持久化平衡树维护NTT)

洛谷P4413 [COCI2006-2007#2] R2(可持久化平衡树维护NTT)

作者头像
attack
发布2018-04-19 18:20:57
4690
发布2018-04-19 18:20:57
举报
文章被收录于专栏:数据结构与算法

题意翻译

设S=(R1+R2)/2,给定R1与S (-1000<=R1,S<=1000)(−1000<=R1,S<=1000) ,求R2。

感谢@Xeonacid 提供的翻译

题目描述

The number S is called the mean of two numbers R1 and R2 if S is equal to (R1+R2)/2. Mirko's birthday present for Slavko was two integers R1 and R2. Slavko promptly calculated their mean which also happened to be an integer but then lost R2! Help Slavko restore R2.

输入输出格式

输入格式:

The first and only line of input contains two integers R1 and S, both between -1000 and 1000.

输出格式:

Output R2 on a single line.

输入输出样例

输入样例#1: 复制

代码语言:javascript
复制
11 15

输出样例#1: 复制

代码语言:javascript
复制
19

输入样例#2: 复制

代码语言:javascript
复制
4 3

输出样例#2: 复制

代码语言:javascript
复制
2


按照fhq大神的话来说
这题还用做?
代码语言:javascript
复制
#include<cstdio>
using namespace std;
const int MAXN = 10005;
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') { if(c == '-')f = -1; c = getchar(); }
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int main() {
    #ifdef WIN32
    freopen("a.in", "r", stdin);
    #endif
    int R1 = read(), S = read();
    printf("%d",2 * S - R1);
    return 0;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-04-17 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 题意翻译
  • 题目描述
  • 输入输出格式
  • 输入输出样例
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档