import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Another { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int counter = 0; String line; while ((line = br.readLine()) != null) { counter++; if (line.equals("")) break; String tr = br.readLine(); int tries = Integer.parseInt(tr); System.out.println("Case "+counter+":"); while (tries-- > 0) { String inp = br.readLine(); String[] arr = inp.split(" "); int i = Integer.parseInt(arr[0]); int j = Integer.parseInt(arr[1]); if (i>j) { int temp = i; i = j; j = temp; } String sub = line.substring(i,j+1); if (sub.contains("0") && sub.contains("1")) { System.out.println("No"); } else { System.out.println("Yes"); } } } } }
সোমবার, ১৯ জুন, ২০১৭
10324 Zeros and Ones
এতে সদস্যতা:
মন্তব্যগুলি পোস্ট করুন (Atom)
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন