Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
- int main()
- {
- fastread();
- int m,n;
- cin>>m>>n;
- int i=1,sum=0;
- while(i<=n)
- {
- sum+=i;
- n-=i;
- i++;
- i%=(m+1);
- }
- sum=n-sum;
- cout<<n<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement