Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Author: D. Nisritha Reddy
- #include<bits/stdc++.h>
- #define int long long
- #define pb push_back
- #define ndl "\n"
- #define yes cout<<"YES\n"
- #define no cout<<"NO\n"
- #define mod (int)(1e9 + 7)
- #define F first
- #define S second
- #define vi vector<int>
- #define vc vector<char>
- #define vpi vector<pair<int,int>>
- #define pi pair<int,int>
- #define mi map<int, int>
- #define miv map<int,vector<int>>
- using namespace std;
- template<class T>
- void inp(vector<T>&a){ for(auto &x : a)cin>>x; }
- template<class T>
- void print(vector<T>&a){
- for(auto &x: a)cout<<x<<" ";
- cout<<ndl;
- }
- template<class T>
- void print(T x){cout<<x<<" ";}
- template<class T>
- void println(T x){ cout<<x<<"\n";}
- template<class T>
- T maxEle(vector<T>&a){
- T maxi = LLONG_MIN;
- for(auto x : a)
- if(x>maxi)maxi = x;
- return maxi;
- }
- template<class T>
- T minEle(vector<T>&a){
- T mini = LLONG_MAX;
- for(auto x: a)
- if(x<mini) mini = x;
- return mini;
- }
- template<class T>
- void sortAll(vector<T>&a){ sort(a.begin(), a.end());}
- template<class T>
- T sumAll(vector<T>&a){
- T sum = 0;
- for(auto x : a) sum +=x;
- return sum;
- }
- template<class T>
- void revAll(vector<T>&a){reverse(a.begin(),a.end());}
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- void solve(){
- vi a(3); inp(a);
- sortAll(a);
- if(a[0] + a[1] < a[2]){
- a[2] = a[2] - (a[0] + a[1]);
- cout<<(a[0] + a[1]) + a[2]<<"\n";
- }
- else{
- cout<<(a[0] + a[1] + a[2] + 1)/2<<"\n";
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- signed main(){
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- int t = 1; //cin>>t;
- while(t--){
- solve();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment