#2327611

Solution for ITP1_6_C: Official House by motorman

Source Code Status Test Cases
    Policy: public     Reviewed: 5    
00.00 sec    0 KB    35 lines     718 bytes    2017-05-20 04:02
#include <iostream>

using namespace std;

int main() {
  // dorm[i][x]
  // i: the index of the dormitory building.
  // 0 <= x <= 9: the 10 rooms in the first floor
  // 10 <= x <= 19: the 10 rooms in the second floor
  // 20 <= x <= 29: the 10 rooms in the third floor
  int dorms[4][30] = {0};

  int n;
  cin >> n;
  int b, f, r, v;
  for (int i = 0; i < n; ++i) {
    cin >> b >> f >> r >> v;
    const int x = (f - 1) * 10 + r - 1;
    dorms[b-1][x] += v;
  }

  for (int i = 0; i < 4; ++i) {
    if (i > 0)
      printf("####################\n");
    for (int j = 0; j < 30; ++j) {
      if (j == 10 || j == 20)
        printf("\n");
      printf(" %d", dorms[i][j]);
    }
    printf("\n");
  }

  return 0;
}

Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 0/5 C++ CPU: 00.00 sec Memory: 0 KB Length: 718 B 2017-05-20 04:02 2017-05-20 04:02
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Compile Error - -
Case #2: - - -
Case #3: - - -
Case #4: - - -
Case #5: - - -
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags