#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N = 1000000 + 10;
int change_counter[N];
int main()
{
string str;
int n, i, j;
int t = 1;
#ifndef ONLINE_JUDGE
freopen("d:\\OJ\\uva_in.txt", "r", stdin);
#endif
while (cin >> str) {
fill(change_counter, change_counter + N, 0);
for (int k = 1; k < str.length(); k++) {
if (str[k] != str[k - 1])
change_counter[k]++;
}
for (int k = 1; k < N; k++) {
change_counter[k] += change_counter[k - 1];
}
cout << "Case " << t++ << ":" << endl;
cin >> n;
while (n--) {
cin >> i >> j;
if (change_counter[i] == change_counter[j])
cout << "Yes" << endl;
else
cout << "No" << endl;
}
}
return 0;
}
UVa10324 - Zeros and Ones
最新推荐文章于 2021-03-18 11:09:24 发布