A.Coder(384A - Coder)

  1. 384A - Coder

  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. int main(){
  5. int a,n ;
  6. cin>>n;
  7. string s;
  8. int r1,r2;
  9. if(n%2==0)
  10. {cout<<n*n/2<<endl;
  11. for(int i=0;i<n/2;i++)
  12. {for(int i=0;i<n/2;i++)
  13. cout<<"C.";
  14. cout<<endl;;
  15. for(int i=0;i<n/2;i++)
  16. cout<<".C";
  17. cout<<endl;
  18. }
  19.  
  20.  
  21. }
  22. else {
  23. cout<< pow((n/2+1),2)+pow((n/2),2)<<endl ;
  24. for(int i=0;i<n/2;i++)
  25. {for(int i=0;i<n/2 ;i++)
  26. cout<<"C.";
  27. cout<<"C"<<endl;;
  28. for(int i=0;i<n/2;i++)
  29. cout<<".C";
  30. cout<<"."<<endl;
  31.  
  32.  
  33. }}if(n%2==1)for(int i=0;i<n/2 ;i++)
  34. cout<<"C.";
  35. if(n%2==1) cout<<"C"<<endl;;
  36. return 0;
  37. }

Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

Aptitude test assistant programmer 2018

1041A. Heist solution