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;
}
Maruf
No comments yet. Be the first to comment!