CF1148A.Another One Bites The Dust

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Let's call a string good if and only if it consists of only two types of letters — 'a' and 'b' and every two consecutive letters are distinct. For example "baba" and "aba" are good strings and "abb" is a bad string.

You have aa strings "a", bb strings "b" and cc strings "ab". You want to choose some subset of these strings and concatenate them in any arbitrarily order.

What is the length of the longest good string you can obtain this way?

输入格式

The first line contains three positive integers aa , bb , cc ( 1a,b,c1091 \leq a, b, c \leq 10^9 ) — the number of strings "a", "b" and "ab" respectively.

输出格式

Print a single number — the maximum possible length of the good string you can obtain.

输入输出样例

  • 输入#1

    1 1 1
    

    输出#1

    4
    
  • 输入#2

    2 1 2
    

    输出#2

    7
    
  • 输入#3

    3 5 2
    

    输出#3

    11
    
  • 输入#4

    2 2 1
    

    输出#4

    6
    
  • 输入#5

    1000000000 1000000000 1000000000
    

    输出#5

    4000000000
    

说明/提示

In the first example the optimal string is "baba".

In the second example the optimal string is "abababa".

In the third example the optimal string is "bababababab".

In the fourth example the optimal string is "ababab".

首页