1 solutions

  • 0
    @ 2025-11-5 19:37:29

    C++ :

    #include <stdio.h>
    #include <string.h>
    #include <iostream>
    #include <string>
    #include <algorithm>
    using namespace std;
    
    int a[1005];
    
    int main() {
      //freopen("Dongqi.in", "r", stdin);
    	//freopen("Dongqi.out", "w", stdout);
      int n;
      a[1] = 4;
      for (int i = 2; i <= 1000; i++) {
        a[i] = a[i - 1] + 8;
      }
      while (scanf("%d", &n) != EOF) {
        if (n == 0)
          break;
        else
          printf("%d\n", a[n]);
      }
      return 0;
    }
    
    • 1

    Information

    ID
    19468
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By