Posted by : Ezzeldin Adel Sunday, June 26, 2016

Codeforces 478C | Table Decorations



Question:
http://codeforces.com/problemset/problem/478/c


Solution:
#include 
#include 
#include 

using namespace std; 

int main(){

    vector<long long> array(3);
   scanf("%lld %lld %lld\n", &array[0], &array[1], &array[2]); // grab nput
    sort(array.begin(), array.end());//sort ascending (ex 1 2 30)

    long long result = (array[0] + array[1] + array[2]) / 3; // uniform sol 
    
    if(array[0] + array[1] < result){result = array[0] + array[1];} // if one number 
is bigger than the sum of others then obviously we can only hv the sum of others diff 
decorations ( for example r = 100 g = 3 b =2 .. 
uniform sol = 35 but we can only hv 5 diff sols wich are rrg rrg rrg rrb rrb ) 
    cout << result; // print 

    return 0;
}
// ez@macacm.org -- 01:03AM 23-06-2016
// Ezzeldin Adel Tahoun || McMaster University


Video Explanation: 





If you want us to solve any certain question please leave it down in the comments or send it to us on facebook

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Discover

Top 5 Posts

- Copyright © McMaster ACM Chapter | Protected by CloudFlare