poj 2636 Electrical Outlets

#include <iostream>
using namespace std;

int PowerStrip[15];

int main()
{
    int tc, k, i, sum, ans;
    cin >> tc;
    while (tc--){
          cin >> k;
          sum = 0;
          for (i = 0; i < k; i++){
              cin >> PowerStrip[i];
              sum += PowerStrip[i];
          }
          ans = sum - k + 1;
          cout << ans << endl;
    }
    system("pause");
}

你可能感兴趣的:(poj 2636 Electrical Outlets)