fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. void solve() {
  6.  
  7. int n;
  8.  
  9. if(n == 0) {
  10.  
  11. cout << 1;
  12.  
  13. return ;
  14.  
  15. }
  16.  
  17. else if(n == 1) {
  18.  
  19. cout << 2;
  20.  
  21. return ;
  22.  
  23. }
  24.  
  25. else if(n == 2) {
  26.  
  27. cout << 4;
  28.  
  29. return ;
  30.  
  31. }
  32.  
  33.  
  34. while(cin >> n) {
  35.  
  36. cout << 2 * n - 1 + 2 * (2 * (n - 2) + 1) + 1 << endl;
  37.  
  38. }
  39.  
  40. }
  41.  
  42. int main() {
  43.  
  44. ios_base::sync_with_stdio(false);
  45. cin.tie(0);
  46.  
  47. solve();
  48.  
  49. return 0;
  50.  
  51. }
Success #stdin #stdout 0.01s 5284KB
stdin
0
1
2
3
4
stdout
1