Advertisement
arfin97

Weird Unsigned substraction

Jun 26th, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define d(x)                cout << #x << " = " << (x) << endl;
  4.  
  5. int main(void) {
  6.     #ifndef ONLINE_JUDGE
  7.         clock_t tStart = clock();
  8.         freopen("in.txt", "r", stdin);
  9.         freopen("out.txt", "w", stdout);
  10.     #endif
  11.  
  12.     int n = 1000000000;
  13.     unsigned long long int nsum = (n*(n+1))/2;
  14.     cout << nsum << endl;
  15.  
  16.     unsigned long long int p = 1000000000;
  17.     unsigned long long int psum = (p*(p+1))/2;
  18.     cout << psum << endl;
  19.    
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement