#include <iostream>
#include <vector>
using namespace std;
void solve(){
int m,n;
cin >> m >> n;
vector<vector<int>> a(m,vector<int>(n));
vector<bool> b(m, true);
for(int i = 0; i < m; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
for(int j = 1; j < n; j++)
if(a[i][j] <= a[i][j-1])
b[i] = false;
for(auto i : b) cout << i << " ";
}
signed main(){
solve();
Так как язык не указан, приведу пример на SWI-Prolog.
Код:
#include <iostream>
#include <vector>
using namespace std;
void solve(){
int m,n;
cin >> m >> n;
vector<vector<int>> a(m,vector<int>(n));
vector<bool> b(m, true);
for(int i = 0; i < m; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
for(int i = 0; i < m; i++)
for(int j = 1; j < n; j++)
if(a[i][j] <= a[i][j-1])
b[i] = false;
for(auto i : b) cout << i << " ";
}
signed main(){
solve();
}
Так как язык не указан, приведу пример на SWI-Prolog.
Код:
read_int(Int) :- read(Int), integer(Int).split_int_by_numbers(0, []) :- !.split_int_by_numbers(N, [Number|Ints]) :- Number is mod(N, 10), RestN is div(N, 10), split_int_by_numbers(RestN, Ints).test_to_div(_, []).test_to_div(N, [Number|Ints]) :- mod(N, Number) =:= 0, test_to_div(N, Ints). test(Int) :- split_int_by_numbers(Int, Numbers), test_to_div(Int, Numbers), write(Int), write(" - Yes!"), nl.test(Int) :- write(Int), write(" - No!"), nl.?- read_int(Int), test(Int).