CF 339A Helpful Maths

题意:

输入数字和符号‘+’,要求排序后从小到大重新输入;

长度是len,除掉符号数,把数字强制转换后存入另外一个数组,输出的时候,

小技巧:先输入一个数字,再输入 加号和数字;

这样可以符合例题的第三个样例;


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.

Input

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.

Output

Print the new sum that Xenia can count.

Examples
Input
3+2+1
Output
1+2+3
Input
1+1+3+1+3
Output
1+1+1+3+3
Input
2
Output
2



AC代码:

#include <bits/stdc++.h>
using namespace std ;
int main()
{
	char a[5000];
	int b[5000];
	cin>>a;
	int len  = strlen(a);
	int sum ;
	sum=0;
	for(int i = 0 ; i < len ; i++)
	{
		if(a[i]=='+')
		{
			sum++;
		}
	}
	int j ;
	j=0;
	for(int i = 0 ; i < len ; i++)
	{
		if(a[i]!='+')
		{
			b[j]=a[i]-'0';
			j++;
		}
	}
	sort(b,b+j);
	printf("%d",b[0]);
	for(int i = 1 ; i < j ;i++)
	{
		printf("+%d",b[i]);
	}
	return 0;
	
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
在TouchDesigner中,你可以使用CHOP(通道操作)节点中的LFO(低频振荡器)和Maths(数学)节点来控制图像。以下是一个简单的例子: 1. 创建一个Movie File In节点,将其命名为“movie_in”。 2. 将Movie File In节点的输出连接到一个常规的TOP(图像处理)节点。 3. 创建一个LFO CHOP节点,并将其命名为“lfo”。 4. 在LFO CHOP节点的参数页面上,设置“Frequency”参数为适当的值,以控制LFO的速度。 5. 创建一个Maths CHOP节点,并将其命名为“maths”。 6. 在Maths CHOP节点的参数页面上,选择“Add”操作,并将其输入连接到“lfo”节点的输出。 7. 在Maths CHOP节点的参数页面上,设置“Value 1”参数为1,以控制LFO的振幅。 8. 创建一个Constant CHOP节点,并将其命名为“constant”。 9. 在Constant CHOP节点的参数页面上,设置“Value”参数为0.5,以控制图像的亮度。 10. 创建一个Maths CHOP节点,并将其命名为“maths2”。 11. 在Maths CHOP节点的参数页面上,选择“Multiply”操作,并将其输入连接到“constant”节点的输出。 12. 将“maths”节点的输出连接到“maths2”节点的第一个输入。 13. 将TOP节点的亮度参数连接到“maths2”节点的输出。 现在,你可以控制图像的亮度,以及LFO的速度和振幅,来创建一个动态的图像效果。你可以通过调整LFO节点和Maths节点的参数来实现不同的效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kelisita

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值