MahmudulMaruf

Code · Faith · Curiosity

Blog Post

Beecrwod: 1150 - Exceeding Z

cpp �� 2023-08-16 12:35:15

cpp

Problem: 1150 - Exceeding Z

Solution: 

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, sum=0, i, j=0;
    while(1)
    {

        cin>>a;
        loop:
        cin>>b;
        if(a<b)
        {
            for(i=a; i<b/2; i++)
            {
                sum+=i;
                j++;
                if(sum>b)
                    break;
            }
            break;
        }
        else
        {
            goto loop;
        }
    }
    cout<<j<<endl;


    return 0;
}

Post Visited: 425 times

Categories: cpp

0 Comments

    No comments yet. Be the first to comment!

Leave a comment

Captcha