Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define rep(i,j,n) for(int (i) = int (j); i < int (n); ++i)
- const int N = 380;
- int t[N][N],a[N][N];
- int n, m, k;
- void input(){
- ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
- cin >> n >> m >> k;
- rep(i,0,n) rep(j,0,m) cin >> t[i][j];
- }
- void pra(){
- rep(i,0,n){
- rep(j,0,n){
- cout << a[i][j];
- } cout << endl;
- } cout << endl;
- }
- void solve(){
- rep(i,0,n){
- rep(j,0,m){
- if(j == 0) a[i][j] = t[i][j];
- else a[i][j] = t[i][j] + a[i][j-1];
- }
- }
- rep(i,0,n) rep(j,0,m) a[i][j] += (i > 0) ? a[i-1][j] : 0;
- pra();
- }
- int main() {
- input();
- solve();
- // your code goes here
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement