fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int n, i, pogl, a;
  5. cin >> n;
  6. i = 2;
  7. pogl = 0;
  8. if(n == 0){
  9. cout << 0;
  10. }
  11. if(n == 1){
  12. cout << 1;
  13. }
  14. if(n > 1){
  15. while(i != n + 1){
  16. a = 4 * (i - 1);
  17. pogl = pogl + a;
  18. i++;
  19. }
  20. cout << pogl + 1;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 4400KB
stdin
2
stdout
5