Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- unsigned long a[100][100];
- int main() {
- unsigned long n,m,i,j,s[100][100];
- cout<<"n=";cin>>n;
- cout<<"m=";cin>>m;
- for (i=1;i<=n;i++)
- for (j=1;j<=m;j++)
- cin>>a[i][j];
- //constr s
- for (i=1;i<=n;i++)
- for (j=1;j<=m;j++)
- s[i][j] = a[i][j] + s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
- for (i=1;i<=n;i++) {
- for (j=1;j<=m;j++)
- cout<<s[i][j]<<' ';
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement