A. Another One Bites The Dust

time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
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 a strings “a”, b strings “b” and c 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?

Input

The first line contains three positive integers a, b, c (1≤a,b,c≤109) — the number of strings “a”, “b” and “ab” respectively.

Output

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

Examples

input
1 1 1
output
4
input
2 1 2
output
7
input
3 5 2
output
11
input
2 2 1
output
6
input
1000000000 1000000000 1000000000
output
4000000000

Note

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”.

Code

/*^....0^ .1 ^1^..     011.^     1.0^ 1  ^    ^0.11 ^        ^..^0.           ^ 0^.0            1 .^.1             ^0 .........001^.1               1. .111100....01^00                 11^        ^1. .1^1.^                              ^0  0^.^                                 ^0..1.1                                   1..^1 .0                                     ^  ^00.                                     ^^0.^^ 0                                     ^^110.^0   0 ^                                     ^^^10.01^^     10  1 1                                      ^^^1110.101     10  1.1                                      ^^^1111110010    01  ^^                                        ^^^1111^1.^           ^^^10  10^ 0^ 1                                            ^^111^^^0.1^       1....^11     0                                               ^^11^^^ 0..  ....1^   ^ ^1.     0^                                               ^11^^^ ^ 1 111^     ^ 0.10   00 11                                               ^^^^^   1 0           1.0^  ^0  ^0                                                ^^^^    0            0.0^  1.0  .^                                               ^^^^    1 1          .0^.^  ^^  0^                             ^1                ^^^^     0.         ^.11 ^      11                             1.                ^^^     ^ ^        ..^^..^      ^1                             ^.^               ^^^       .0       ^.00..^      ^0                              01               ^^^       ..      0..^1 ..        .1                             ^.^              ^^^       1 ^  ^0001^  1.        00                              0.             ^^^        ^.0 ^.1. 0^.        ^.^                             ^.^            ^^^         ..0.01 .^^.         .^                  1001        ^^            ^^^         . 1^. ^ ^.         11                0.    1         ^           ^^          0.0  ^.          0              ^0       1                   ^^^          0.0.^  1.          0^             0       .1                   ^^^          ...1   1.          00            .        .1                  ^^^           ..1      1.         ^.           0         .^                  ^^            ..0.     1.          .^          .         0                                  ..1     1.          01          .        .                                 ^ 0^.^     00          ^0          1.       ^                                 1 1.0      00           .            ^^^^^^                                   ..^      00           01                                                    ..1.       00           10                                                   1 ^^.1       00           ^.                                            ^^^    .1..        00            .1                                        1..01    ..1.1         00           1.                                       ..^      10^ 1^         00           ^.1                                      0 1      1.1           00            00                                       ^  1   ^.           00            ^.^                                        10^  ^^1.1           00             00                                              10^..^           1.             ^.                                               1.0 1            ^.              00                 00                            .^^            ^.              ^ 1                00   ^0000^     ^               011 0             ^.               00.0^              ^00000   1.00.1              11. 1              0               1^^0.01                      ^^^                01.^              ^                1   1^^                                       ^.^1 1                                                                              0...                                                                              1 ^1                                                                               1^ ^                                                                             .01                                                                             ^ 1..                                                          1.1            ^0.0^ 0                                                           1..01^^100000..0^1 1                                                            ^ 1 ^^1111^ ^^0 ^                                                             ^ 1      1000^.1                                                               ^.^     .   00..                                                                1.1    0.   01.                                                                  .    1.   .^1.                                                                 1    1.   ^0^ .                                                                 ^.1 00    01^.0                                                                  001.     .^*/
// 2019_6_1 —— A. Another One Bites The Dust.cpp created by VB_KoKing on 2019-06-01:23.
/* Procedural objectives:Variables required by the program:Procedural thinking:Functions required by the program:Determination algorithm:Determining data structure:*/
/* My dear Max said:
"I like you,
So the first bunch of sunshine I saw in the morning is you,
The first gentle breeze that passed through my ear is you,
The first star I see is also you.
The world I see is all your shadow."FIGHTING FOR OUR FUTURE!!!
*/
#include <cstdio>
#include <iostream>
#include <algorithm>using namespace std;long long a,b,c,maxn;int main(){scanf("%lld %lld %lld",&a,&b,&c);if(a==b) maxn=2*(a+c);else maxn=2*(c+min(a,b))+1;cout<<maxn<<endl;return 0;
}

Codeforces Global Round 3 A. Another One Bites The Dust相关推荐

  1. Codeforces Global Round 3

    Codeforces Global Round 3 A. Another One Bites The Dust 有若干个a,有若干个b,有若干个ab.你现在要把这些串拼成一个串,使得任意两个相邻的位置 ...

  2. Codeforces Global Round 1 晕阙记

    Codeforces Global Round 1 晕阙记 我做这场比赛的时候晕得要死.做这三道题做太久了,rating涨不起来啊! A 如果愿意的话你可以看做是膜2意义下的运算,写快速幂等各种膜运算 ...

  3. Codeforces Global Round 14 F. Phoenix and Earthquake 思维 + 并查集

    传送门 文章目录 题意: 思路: 题意: 给你nnn个点,mmm条边,限制xxx,每个点都有沥青aia_iai​,定义合并两个点即两点之间有边且au+av≥xa_u+a_v\ge xau​+av​≥x ...

  4. Codeforces Global Round 1

    Codeforces Global Round 1 题解:The Editorial of the First Codeforces Global Round A:其实mod 2计算一下就行了 B:删 ...

  5. 【Codeforces Global Round 23】B. Rebellion

    Codeforces Global Round 23中B. Rebellion Codeforces比赛记录 文章目录 题目链接: 一.B. Rebellion 题目意思: 上思路: 总结 B. Re ...

  6. Codeforces Global Round 4-D. Prime Graph(伯特兰-切比雪夫定理)

    题目:Codeforces Global Round 4-D. Prime Graph 题意:给出n(顶点的个数),要求所得图满足: 1.无平行边和自环 2.边的总数是个质数 3.每个点的度(也就是点 ...

  7. codeforces global round 23

    constest :codeforces global round 23 contest time:2022.10.16 contest grade: 2800 contest rating chan ...

  8. 贪心 ---- Codeforces Global Round 8,B. Codeforces Subsequences[贪心,贪的乘法原理]

    题目链接 给出字符串,统计子串(子串字母可以跳跃)是codeforces的数量. 本题要求,给出子串最少数量k,构造字符串s,要求字符串s包含的字母数量最少,输出这个最少的字符串s. 题目要求是至少有 ...

  9. Codeforces Global Round 21 E. Placing Jinas

    Problem - E - Codeforces (Unofficial mirror by Menci) E. Placing Jinas 题目大意:每个点相当于(0,0)到每个点(只能向下和向右走 ...

最新文章

  1. 安卓高手之路之java层Binder
  2. Linux Security Module逆向分析实战
  3. VTK:网格之TableBasedClipDataSetWithPolyData2
  4. 测试点分析:1048 数字加密 (20分)_16行代码AC
  5. Spring Boot log4j多环境日志级别的控制
  6. BZOJ2038 小Z的袜子 (莫队算法)
  7. phpstorm设置xdebug调试
  8. 【2016-2017 ACM-ICPC, Egyptian Collegiate Programming Contest (ECPC 16) A】The game of Osho【SG函数+找规律】
  9. html如何将文字生成图片,文字转图片工具,文字图片生成器,把几句话做陈图片
  10. BootStrap 点击展示气泡框
  11. 湖南省大学生程序设计竞赛系统设计
  12. Samba服务器的配置和使用
  13. 我的2013,它不平淡
  14. 计算机网络智能化在铁路通信的发展,关于接入网技术在铁路通信中的应用
  15. 有关一个公用的BPL的问题
  16. 图像识别与检测技术的创新
  17. docker网络模式与none模式配置网络
  18. 破解PPT密码的方法
  19. 5G专网(private 5G network)解析、应用场景、案例介绍
  20. Oracle---PLSQL案例

热门文章

  1. PAT 1038. 统计同成绩学生
  2. 3 - SQL Server 2008 之 使用SQL语句删除约束条件
  3. Daily Report 2012.11.9 刘宇翔
  4. building commercial website using Microsoft tech stack
  5. HDOJ HDU 1709 The Balance ACM 1709 IN HDU
  6. J2EE团队与DotNet团队如何合作开发一个系统?
  7. linux文件的打包与下载总结,linux下文件的打包和压缩
  8. JS数组去重方法记录
  9. cbc cryptojs 前后端_前端CryptoJS AES/DES加解密与后端PHP AES/DES加解密
  10. Halcon - 测量 - 轮廓到线的距离