fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n;
  6. while(cin>>n){
  7.  
  8. if(n<=4) cout<<"-1"<<endl;
  9. else if(n%2==0){
  10. for(int i=0;i<n;i++){
  11. for(int j=0;j<n;j++){
  12. if(j==0||j==n-1||i==j&&i<(n/2)||j==n-1-i&&i<(n/2)) cout<<"W ";
  13.  
  14. else cout<<" ";
  15. }
  16. cout<<endl;
  17. }
  18. cout<<endl;
  19. }
  20. else{
  21. for(int i=0;i<n;i++){
  22. for(int j=0;j<n;j++){
  23. if(j==0||j==n-1||i==j&&i<=(n/2)||j==n-1-i&&i<(n/2)) cout<<"W ";
  24. else cout<<" ";
  25. }
  26. cout<<endl;
  27. }
  28. cout<<endl;
  29. }
  30.  
  31. }
  32. return 0;
  33. }
  34.  
  35.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty