WA?.蒟蒻自己都想出来题解中给出的式子了
查看原帖
WA?.蒟蒻自己都想出来题解中给出的式子了
908595
WillowCatkin楼主2024/4/19 00:11
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char c[101];
	long long t=0,sum=0,i,cnt=1,s[30];
	scanf("%[^\n]",c);
	strcat(c," ");
	while(strchr(c,' ')!=NULL)
	{
		sscanf(c,"%lld[^ ]",&s[t]);
		t++;
		strcpy(c,strchr(c,' ')+1);
	}
	sort(s,s+t);
	for(i=0;i<t;i++) sum+=s[i];
	for(i=1;i<=t-1;i++) cnt*=2;
	cout<<cnt*sum;
	return 0;
}
2024/4/19 00:11
加载中...