CF339A Helpful Maths

    • 127通过
    • 237提交
  • 题目来源 CodeForces 339A
  • 评测方式 RemoteJudge
  • 标签 字符串 排序 概率论,统计
  • 难度 入门难度
  • 时空限制 2000ms / 256MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 体验新版界面

    最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    Xenia是一个小学三年级的“小小数学家”。她正在学习加法。

    老师写下了多个数字相加的算式,给学生们做。为了让计算容易,这个算式只包含数字1、2和3。但这对Xenia来说仍不够简便。她刚刚开始学数数,所以她只会计算按非递减的顺序排列的数字。例如,她不会算 1+3+2+1,但她会算 1+1+2 或 3+3。

    你从黑板上抄下了这些加法算式。请重排并输出这些加法算式,以便Xenia能够计算它们的和。

    题目描述

    Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.

    The teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To make the calculation easier, the sum only contains numbers 1, 2 and 3. Still, that isn't enough for Xenia. She is only beginning to count, so she can calculate a sum only if the summands follow in non-decreasing order. For example, she can't calculate sum 1+3+2+1 but she can calculate sums 1+1+2 and 3+3.

    You've got the sum that was written on the board. Rearrange the summans and print the sum in such a way that Xenia can calculate the sum.

    输入输出格式

    输入格式:

    The first line contains a non-empty string $ s $ — the sum Xenia needs to count. String $ s $ contains no spaces. It only contains digits and characters "+". Besides, string $ s $ is a correct sum of numbers 1, 2 and 3. String $ s $ is at most 100 characters long.

    输出格式:

    Print the new sum that Xenia can count.

    输入输出样例

    输入样例#1: 复制
    3+2+1
    
    输出样例#1: 复制
    1+2+3
    
    输入样例#2: 复制
    1+1+3+1+3
    
    输出样例#2: 复制
    1+1+1+3+3
    
    输入样例#3: 复制
    2
    
    输出样例#3: 复制
    2
    
    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。