Codeforces 734 B. Anton and Digits Solution
Solve in C++:
#include<bits/stdc++.h>
using namespace std;
main()
{
long long int k2,k3,k5,k6,i,n,m1,m2,m3,d,r1,r2;
while(cin>>k2>>k3>>k5>>k6)
{
m1=min(k2,k5);
m2=min(m1,k6);
r1=m2*256;
d=k2-m2;
if(d>0)
{
m3=min(d,k3);
r2=m3*32;
cout<<r1+r2<<endl;
}
else
{
cout<<r1<<endl;
}
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
main()
{
long long int k2,k3,k5,k6,i,n,m1,m2,m3,d,r1,r2;
while(cin>>k2>>k3>>k5>>k6)
{
m1=min(k2,k5);
m2=min(m1,k6);
r1=m2*256;
d=k2-m2;
if(d>0)
{
m3=min(d,k3);
r2=m3*32;
cout<<r1+r2<<endl;
}
else
{
cout<<r1<<endl;
}
}
return 0;
}
No comments