fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9. int n;
  10. cin >> n;
  11. int ans=0;
  12. int k = 0;
  13. for (int i = 0; i <= n; i++) {
  14. ans += k;
  15. k += 2;
  16.  
  17. }
  18. cout << ++ans << endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 4372KB
stdin
Standard input is empty
stdout
1073577991