2017 Multi-University Training Contest 2 hdu 6045
思路:
AC代码:
#include "iostream" #include "string.h" #include "stack" #include "queue" #include "string" #include "vector" #include "set" #include "map" #include "algorithm" #include "stdio.h" #include "math.h" #pragma comment(linker, "/STACK:102400000,102400000") #define ll long long #define endl ("\n") #define bug(x) cout<<x<<" "<<"UUUUU"<<endl; #define mem(a,x) memset(a,x,sizeof(a)) #define mp(x,y) make_pair(x,y) #define pb(x) push_back(x) #define ft (frist) #define sd (second) #define lrt (rt<<1) #define rrt (rt<<1|1) using namespace std; const long long INF = 1e18+1LL; const int inf = 1e9+1e8; const int N=1e5+100; const ll mod=1e9+7; ///1001 int n,x,y; char s1[N],s2[N]; int main(){ //ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); int T; cin>>T; while(T--){ int cnt1=0, cnt2=0; cin>>n>>x>>y; cin>>s1>>s2; for(int i=0; i<n; ++i){ if(s1[i]==s2[i]) cnt1++; } cnt2=n-cnt1; int ma,mi; if(x<=cnt1) ma=x+cnt2; else ma=cnt1+(n-x); if(x>=cnt2) mi=x-cnt2; else mi=0; if(y>=mi && y<=ma) cout<<"Not lying\n"; else cout<<"Lying\n"; } return 0; }