SHARE
TWEET

codeforce - chips

jakaria_hossain Apr 3rd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
  4. int main()
  5. {
  6.     fastread();
  7.     int m,n;
  8.     cin>>m>>n;
  9.     int i=1,sum=0;
  10.     while(i<=n)
  11.     {
  12.             sum+=i;
  13.             n-=i;
  14.             i++;
  15.             i%=(m+1);
  16.     }
  17.     sum=n-sum;
  18.     cout<<n<<endl;
  19.     return 0;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top