Advertisement
fuadnafiz98

problem solution

Jan 25th, 2021
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.   unsigned long long int n, total, ans;
  7.   cin >> n;
  8.   if(n == 0) cout << 1 << "\n";
  9.   else {
  10.     total = ( n * ( n + 1 ) ) / 2;
  11.     ans = (( 6 * total ) + 1 );
  12.     cout << ans << "\n";
  13.   }
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement