A
link
判断。
点击查看代码
#include<bits/stdc++.h>
using namespace std;
signed main(){
int l,r;
cin >> l >> r;
if(l == 1&&r == 0) cout << "Yes";
else if(l == 0&&r == 1) cout << "No";
else cout << "Invalid";
return 0;
}
B
link
模拟即可。
点击查看代码
#include<bits/stdc++.h>
using namespace std;
int n;
int a[105][105];
signed main(){
cin >> n;
for(int i = 1;i <= n;++ i){
for(int j = 1;j <= i;++ j){
cin >> a[i][j];
}
}
int w = 1;
for(int i = 1;i <= n;++ i){
if(w >= i) w = a[w][i];
else w = a[i][w];
}
cout << w;
return 0;
}