E.cpp 631 B

123456789101112131415161718192021222324252627
  1. #include<iostream>
  2. using namespace std;
  3. int main(int argc, char const *argv[]) {
  4. for (int n; cin >> n;) {
  5. if (n == 1)
  6. cout << "O" << endl;
  7. else {
  8. for (int i = 0; i < n; i++)
  9. cout << "O";
  10. cout << endl;
  11. for (int i = 0; i < n - 2; i++) {
  12. cout << "O";
  13. for (int j = 0; j < n - 2; j++)
  14. cout << " ";
  15. cout << "O" << endl;
  16. }
  17. for (int i = 0; i < n; i++)
  18. cout << "O";
  19. cout << endl;
  20. }
  21. cout << endl;
  22. }
  23. return 0;
  24. }