zad13
gorazd
c_cpp
6 months ago
776 B
2
Indexable
2kolok_SP
#include <iostream> #include <cctype> #include <cstring> #include <iomanip> using namespace std; int main() { int x; cin >> x; int m,n; cin >> m >> n; int arr[m][n]; for (int i = 0; i < m; i++) { int sum = 0; for (int j = 0; j < n; j++) { cin >> arr[i][j]; sum += arr[i][j]; } if (sum == x) for (int j = 0; j < n; j++) arr[i][j]=0; else if (sum > x) for (int j = 0; j < n; j++) arr[i][j]=1; else for (int j = 0; j < n; j++) arr[i][j]=-1; } for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cout << arr[i][j] << " "; } cout << endl; } }
Editor is loading...
Leave a Comment