Posted by : Ezzeldin Adel Monday, June 27, 2016

Codeforces 686A| Free Ice Cream



Question:
http://codeforces.com/problemset/problem/686/A


Solution: #include

#include
using
namespace std; int main() { long long x, n ; cin >> n >> x; int dis =0 ; for ( int i = 0 ; i< n ; i++) // handle n operations { char c; int xx; cin >> c >> xx; if ( c == '+') x+=xx; // add more ice cream to ours YAY else { // - give icecream :( if ( xx<=x) x-=xx; // if we have enough to give em lets just do it else // turn em down dis++; } } cout << x << " " << dis; return 0; } // ez@macacm.org -- 12:05PM 27-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

{ 1 comments... read them below or add one }

  1. I blog quite often and I really thank you for your content. Your article has truly peaked my interest. I will bookmark your website and keep checking for new information about once per week. I subscribed to your RSS feed too. netflix login member

    ReplyDelete

Discover

Top 5 Posts

- Copyright © McMaster ACM Chapter | Protected by CloudFlare