Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,pret=0,dim;
- cin>>n;
- cout<<(n+1)/2<<'\n';
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=n;j++)
- {
- dim=1001;
- if(i-1<dim) dim=i-1;
- if(n-i<dim) dim=n-i;
- if(j-1<dim) dim=j-1;
- if(n-j<dim) dim=n-j;
- cout<<dim+1;
- }
- cout<<'\n';
- }
- for(int i=0;i<(n+1)/2;i++)
- pret+=(i+1)*(n-2*i)*(n-2*i);
- cout<<pret;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement