Advertisement
momo2345

three numbers

Oct 2nd, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. #include <ext/pb_ds/assoc_container.hpp>
  5. using namespace __gnu_pbds;
  6. typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
  7. #define suni ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  8. #define endl "\n"
  9. #define mn int main()
  10. #define frac() cout.unsetf(ios::floatfield);cout.precision(6);cout.setf(ios::fixed,ios::floatfield);
  11.  
  12. mn
  13. {
  14.     suni;
  15.     int n,s,ans=0;
  16.     cin>>n>>s;
  17.     for(int i=0;i<=n;i++){
  18.         for(int j=0;j<=n;j++){
  19.             for(int k=0;k<=n;k++){
  20.                 if((i+j+k)==s) ans++;
  21.             }
  22.         }
  23.     }
  24.     cout<<ans<<endl;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement