Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int32_t main() {
- int n;
- cin >> n;
- int X[n][n];
- for(int i = 0; i < n; ++i) {
- for(int j = 0; j < n; ++j) {
- cin >> X[i][j];
- }
- }
- int Y[n], Z[n];
- fill(Y, Y + n, 0);
- fill(Z, Z + n, 0);
- for(int i = 0; i < n; ++i) {
- for(int j = 0; j < i + 1; ++j) {
- if(X[i][j] > 0) {
- Y[i] += X[i][j];
- Z[i]++;
- }
- }
- }
- for(int i = 0; i < n; ++i) {
- for(int j = 0; j < n; ++j) {
- cout << X[i][j] << " ";
- }
- cout <<" Y = " <<Y[i] << " Z = " << Z[i] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement