#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
int main(){
string ques;
int cs = 1;
while(getline(cin, ques)){
int n, i, j, mn, mx;
cin >> n;
cout << "Case " << cs << ":" << endl;
for(int m = 1; m <= n; m++){
cin >> i >> j;
int l = 0, o = 0;
mn = min(i, j), mx = max(i, j);
for(int k = mn; k <= mx; k++){
if(ques[k] == '0')o++;
else l++;
}
if(o == 0 || l == 0)cout << "Yes" << endl;
else cout << "No" << endl;
}cs++;
getchar();
}
return 0;
}
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
int main(){
string ques;
int cs = 1;
while(getline(cin, ques)){
int n, i, j, mn, mx;
cin >> n;
cout << "Case " << cs << ":" << endl;
for(int m = 1; m <= n; m++){
cin >> i >> j;
int l = 0, o = 0;
mn = min(i, j), mx = max(i, j);
for(int k = mn; k <= mx; k++){
if(ques[k] == '0')o++;
else l++;
}
if(o == 0 || l == 0)cout << "Yes" << endl;
else cout << "No" << endl;
}cs++;
getchar();
}
return 0;
}
No comments:
Post a Comment