#include<bits/stdc++.h> using namespace std; int main() { int n,m,k; cin >> n >> m >> k; int a[n][m]; for(int i = 0;i < n;++i) for(int j = 0;j < m; ++j) { cin >> a[i][j]; } int x ; int col = m - 1; int row = 0; while(row < n && col > -1) { if(k == a[row][col]) { cout << "Yes"<< endl; return 0; } else if(k > a[row][col]) row++; else col--; } cout << "No" << endl; }
原文地址:https://www.cnblogs.com/Jawen/p/11669874.html
时间: 2024-10-31 07:08:00