Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int longestSubsequence(int a[100][100], int n) {
- int i, j, maxCount=0, count=1;
- for(i=0; i<n; i++){
- for(j=0; j<n-1; j++){
- if(a[i][j] < a[i][j+1])
- count++;
- else{
- if(count > maxCount)
- maxCount = count;
- count=1;
- }
- }
- if(count > maxCount)
- maxCount = count;
- count=1;
- }
- return maxCount;
- }
- int main() {
- int i, j, n;
- int a[100][100];
- scanf("%d", &n);
- for(i = 0; i < n; ++i) {
- for(j = 0; j < n; ++j) {
- scanf("%d", &a[i][j]);
- }
- }
- int result = longestSubsequence(a, n);
- printf("%d", result);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement