CodeForces 734 B.Anton and Digits(水~)

xiaoxiao2021-02-27  387

Description 有k2个2,k3个3,k5个5,k6个6,要组成若干个32和256,问组成数的和的最大值 Input 四个整数k2,k3,k5,k6(0<=k2,k3,k5,k6<=5e6) Output 输出组成数的和的最大值 Sample Input 5 1 3 4 Sample Output 800 Solution 水题,先构造256,然后再构造32 Code

#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #include<cmath> #include<vector> #include<queue> #include<map> #include<set> #include<ctime> using namespace std; typedef long long ll; #define INF 0x3f3f3f3f #define maxn 1111 int k2,k3,k5,k6; int main() { while(~scanf("%d%d%d%d",&k2,&k3,&k5,&k6)) { ll ans=0; k5=min(k5,k6); if(k2>=k5)ans+=256ll*k5,k2-=k5; else ans+=256ll*k2,k2=0; k2=min(k2,k3); ans+=32ll*k2; printf("%I64d\n",ans); } return 0; }
转载请注明原文地址: https://www.6miu.com/read-5855.html

最新回复(0)