description
stringlengths
35
9.39k
solution
stringlengths
7
465k
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import java.util.*; public class quizLeague { public static void main(String[] args) throws Exception { File file = new File("input.txt"); Scanner sc = new Scanner(file); PrintWriter pw = new PrintWriter(new Fil...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class CF1 { public static void main(String[] args) { S...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws Exception { new B(new Scanner(new File("input.txt"))); } public B(Scanner in) throws Exception { PrintWriter out = new PrintWriter("output.txt"); int N = in.nextInt(); int ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import static java.lang.Math.*; import java.util.*; import java.io.*; public class B { public void solve() throws Exception { int n = nextInt(), k = nextInt()-1; int[] p = nextArr(n); for (int i=k;; i++) { if (i>=n) i=0; if (p[i]==1) halt(i+1); } ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException; import java.io.IOException;import java.io.InputStream;import java.io.PrintStream; import java.io.PrintWriter;import java.security.AccessControlException;import java.util.Arrays; public class _p000120B {static public void main(final...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.IOException; import java.io.*; public class QuizLeague { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader r=new BufferedReader(new FileReader("input.txt")); BufferedWriter wr=new BufferedWriter(new FileWr...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Locale; import java.util.StringTokenizer; public class Main implements Runnable { void solve() throws IOException { int n = nextInt(); int k = nextInt() - 1; boolean[] a = new bool...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; public class Main implements Runnable { StreamTokenizer in; BufferedReader reader; PrintWriter out; StringTokenizer tok; Scanner sc; boolean timus = true;//System.getProperty("ONLINE_JUDGE")!=null; b...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
#include <bits/stdc++.h> using namespace std; const bool online_judge = true; const long long inf = 1LL << 60; long long toInt(string s) { long long res; stringstream ss; ss << s; ss >> res; return res; } string toString(long long n) { stringstream ss; ss << n; return ss.str(); } void run() { long lon...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.Scanner; public class E { public static void main(String[] args) throws IOException { in = new Scanner(new File("input.txt")); PrintWriter out = ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
/* ********QUESTION DESCRIPTION************* * @author (codeKNIGHT) */ import java.util.*; import java.math.*; import java.io.*; public class saratov_b { public static void main(String args[])throws IOException { //Scanner in=new Scanner(System.in); PrintWriter out=new PrintWriter("output...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class B { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new File("input.txt")); PrintWriter pw = new PrintWriter(new File("output.txt")); in...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class test { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); int quest = sc.nextInt(); int start = sc.nextInt()-1; ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new FileReader("input.txt")); BufferedWriter out = new BufferedWriter...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.FileOutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author "Johan Sannemo" */ public class Mai...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.math.BigInteger; import static java.math.BigInteger.*; import java.util.*; public class ForFile { void solve()throws Exception { int n=nextInt(); int at=nextInt()-1; int[]a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); while(a...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; public class CodeForces { public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new File("input.txt")); PrintWriter printWriter = new PrintWriter(new File("output.txt")); ArrayList<Integer> al = new ArrayLis...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args)throws IOException { Scanner in = new Scanner((new FileReader("input.txt"))); FileWriter out = new FileWriter("output.txt"); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class QuizLeague { public static void main(String[] args) throws IOException { BufferedReader ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; public class Main { // File file = new File("input.txt"); // Scanner in = new Scanner(file); // PrintWriter out = new PrintWriter(new FileWriter("output.txt")); public static void main(String[] args) throws Exception { File file = n...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Locale; import java.util.StringTokenizer; public class B { BufferedReader in; StringTokenizer st; PrintWriter ou...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class B_Schools { public static void main(String[] args) throws IOException { FileReader f = new FileReader("input.txt"); FileWriter fr = new FileWriter("outp...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main implements Runnable { private void solve() throws IOException { int n = nextInt(), k = nextInt() - 1; int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } while (a[k] == 0) { k++; k %= n; }...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class CodeForces { private void solve() throws IOException { int n = nextInt(), k = nextInt(); int []map = new int[n]; for(int i = 0; i < n; i++) map[i] = nextInt(); int x = k - 1; while(map[x] == 0) { ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Quiz_League { public static void main(String[] args) throws IOException, NumberFormatException { ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; public class ScOB{ static BufferedReader br; public static void main(String args[])throws Exception{ //br=new BufferedReader(new InputStreamReader(System.in)); File f = new File("input.txt"); FileInputStream fin = new FileInputStream(f); br ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileWriter; import java.io.InputStreamReader; /** * */ /** * @author antonio081014 * */ public class B { /** * @param args */ public static void main(String[] args...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger;...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class B120 { public static void main(String args[]) throws FileNotFoundException{ Scanner input = new Scanner(new File("input.txt")); int a[] = new int[5000]; int n = input.nextInt(); int k = input.nextInt(); for(int i = 0; i < n; i++){ a[i]=input.nextI...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileReader; import java.io.PrintWriter; import java.util.Scanner; /* * A team quiz game called "What? Where? When?" is very popular in Berland. * The game is centered on two teams competing. They are the team of six * Experts versus the team of the Audience. A person from the au...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Codeforces { StringTokenizer tok; BufferedReader in; PrintWriter out; final boolean OJ = System.getProperty("ONLINE_JUDGE") != null; String fil...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; /* * To change this template, choose Tools | T...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.Scanner; public class p120b { public static void main(String[] args) throws FileNotFoundException { PrintWriter out = new PrintWriter("output.txt"); Scanner in = new Scanner(new File("input.txt")); int n = in.nextInt(); int k = in.nextInt(); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Main3 { public static Scanner sc; public static PrintStream fout; public static void run() { int n = sc.nextInt(), k = sc.nextInt(); k--; int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = sc.nextInt(...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class Prob120B { public static void main( String[] Args ) throws IOException { BufferedReader br = new BufferedReader( new Fil...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; public class j { public static void main (String a[])throws IOException { BufferedReader f = new BufferedReader(new FileReader("input.txt")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); int k=0,n=0,t=0,p=0,i=0; String s; s=f.readLine(); Str...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class B_120 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new File("input.txt")); PrintWriter pw = new PrintWriter(new File("output.txt")); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class B { /** * @param args */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub Scanner sc = new Scanner(new File("input.txt")); PrintWriter pw = new...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class MegaSolution { StreamTokenizer in; BufferedReader inb; StringTokenizer ins; PrintWriter out; public static void main(String[] args) throws Exception { new MegaSolution().run(); } public void run() throws Exception { ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class QuizLeague { public static void main( String[] args ) throws Exception { BufferedReader br = new BufferedReader( new InputStreamReader( new FileInputStream( new File("input.txt") ) ) ); String[] parts = br.readLine().split( " " ); int n = ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new FileReader("input.txt")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); int n = sc.nextInt(); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Main { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { Scanner in=new Scanner(new FileReader("input.txt")); PrintWriter out=new PrintWriter(new FileWriter("output.txt")...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Main { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); static FileReader reader; static FileWriter writer; public static void main(String[] args) throws IOException { reader = new FileR...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Main { //BufferedReader in; Scanner in; PrintStream out; public Main() throws FileNotFoundException { out = new PrintStream(new File("output.txt")); //in = new BufferedReader(new FileReader("in.txt")); //in = new Buffe...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Main { private void solve() throws IOException { BufferedReader input = new BufferedReader(new FileReader("input.txt")); PrintWriter output = new PrintWriter(new PrintStream(new FileOutputStream("output.txt"))); StringTokenizer sto = new ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.StringTokenizer; /** * 120B * ΞΈ(n) time * ΞΈ(n) space * * @author artyom */ public class _120B implements Runnable { private BufferedReader in; private StringTokenizer tok; private Object solve() throws IOException { int n = nextInt(), k = nextInt(); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Main { BufferedReader in; StringTokenizer tokenizer; PrintWriter out; public static void main(String[] args) throws IOException { new Main().Solution(); } public void Solution() throws IOException { ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.InputStream; import java.io.OutputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.util.A...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
/** * Created by IntelliJ IDEA. * User: Dzianis_Siarheyeu * Date: 10/18/11 * Time: 11:40 AM * To change this template use File | Settings | File Templates. */ import java.io.*; import java.util.StringTokenizer; public class TaskB { /** * @param args the command line arguments */ public static...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.ArrayList; import java.util.List; import java.util.InputMismatchException; import java.math.BigInteger; import java.util.Iterator; import java.io.*; import java.util.Comparator; import java.util.Arrays; import java.util.Collection; /** * Generated by Contest helper plug-in * Actual solution is at th...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.BufferedWriter; import java.io.PrintWriter; import java.io.FileWriter; import java.io.File; import java.io.IOException; // warm-up public class QuizLeague { static void solve() throws IOException{ Scanner sc = new Scanner(new File("input.txt")); PrintWriter p = new PrintWriter(...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class Solution { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(new FileReader("input.txt")); PrintWriter writer = new ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class B { public static void main(String[] args) throws IOException { Scanner sc=new Scanner(new FileReader("input.txt")); FileWriter fw=new FileWriter("output.txt"); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Template { //static int cnt=0; static Scanner sc=new Scanner(System.in); static ArrayList<Integer> v; static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); public static void main (String[] args) throws java.lang.Exception{ Scann...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; import java.math.*; //created at 7:35 PM 10/20/11 by Abrackadabra public class B { int IOMode = 2; //0 - consoleIO, 1 - <taskName>.in/out, 2 - input.txt/output.txt, 3 - test case generator String taskName = ""; void solve() throws IOException { int n = nextIn...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; public class b { public static void main(String[] args) throws IOException { boolean[] sieve = new boolean[1000001]; Arrays.fill(sieve, true); sieve[0]=sieve[1]=false; for(int i = 2; i<sieve.length; i++) if(sieve[i]) for(long j = (long)i*i; j<sieve.length; j+=i) sie...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class Solution { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File(...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class B { private void work() throws IOException { Scanner sc = new Scanner(new FileReader("input.txt")); PrintWriter pw = new PrintWriter(new FileWriter("output.txt")); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class B120 { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class QuizLeague { public static void main(String[] args) throws FileNotFoundException { Scanner cin = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); int n = cin.nextInt(); int k = cin.nextI...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileInputStream; import java.io.PrintWriter; import java.util.Scanner; public class Main { public static void main(String[] args) { try { new Main().start(); } catch (Exception e) { e.printStackTrace(); } } private void start() throws Exception { Scanner in = new ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; import java.math.*; public class A implements Runnable { public void run() { long startTime = System.nanoTime(); int n = nextInt(); int t = nextInt(); boolean[] b = new boolean[n + 1]; for (int i = 0; i < n; i++) { b[i + 1]...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.PrintStream; import java.util.Scanner; public class B { public static void main(String[] args) { try { //* File in = new File("input.txt"); File out = new File("output.txt"); PrintStream writer = new PrintStream(out); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class CodeForces implements Runnable { void solve() throws IOException { int n = nextInt(); int p = nextInt(); int []a= new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); if(a[p-1]==1) ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; import java.text.*; import java.util.regex.*; /** * Problem-(#) - Main.java * * @author Isuru Madushanka Weerarathna * @team CSECodersV2 * @written 2011/10/22 * @competetion IEEEXtreme 5.0 */ public class Main { public static void main(String[] args) { try { ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Scanner; public class P120B { public static void main(String[] args) throws FileNotFoundException { Scanner inScanner = new Scanner(new File("input.txt")); PrintStream out = new PrintStream...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class solution { void solve() throws IOException { int n = nextInt(), k = nextInt() - 1; int[] z = new int[1010]; for (int i = 0; i < n; ++i) { z[i] = nex...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class A implements Runnable { private void solve() throws IOException { int n = nextInt(); int k = nextInt() - 1; int[] a = new int[n]; ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class Solution { public static void main(String[] args) { try { Scanner scanner = new Scanner(new File("input.txt")); PrintWriter writer = new PrintWriter(new File...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class b120 { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); int q = in.nextInt(...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class kuchBhi{ public static void main(String[] args) throws Throwable{ // BufferedReader br = new BufferedReader(new FileReader("input.txt")); // String in = br.nextLine(); Scanner sc = new Scanner(new File("input.txt")); BufferedWri...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
//package com.company; import java.util.*; import java.io.*; import java.util.Scanner; public class A { public static void main(String[] args) throws Exception{ // write your code here Scanner sc = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.math.BigInteger; import java.util.*; import com.sun.org.apache.bcel.internal.generic.ARRAYLENGTH; public class CodeForces { public void solve() throws IOException { int n=nextInt(); int k=nextInt()-1; int arr[]=new int[n]; for(int i=0;i<n;i++){ arr[i]=nextInt(); } while(...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
//package que_a; import java.io.*; import java.util.*; import java.math.*; public class utkarsh { InputStream is; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); void solve() { int n = ni(), k = ni()-1; int a[] = na(n); while(a[k] == 0) { ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws Exception { Scanner s = new Scanner(new File("input.txt")); PrintWriter pw = new PrintWriter(new File("output.txt")); int n = s.nextInt(), k = s.nextInt() - 1; int[] a = new int[n]; for (int i = 0; i < n; ++...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Arrays; import java.util.Stack; import java.util.Vector; public class Main { private static BufferedReader input; ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; public class cf120b { public static void main(String[] args) throws Exception { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); int n = in.nextInt(); int k = in.nextInt()-1; int[] v = new int[n]; for(int i=0;...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; /** * http://codeforces.ru/contest/120/problem/B * * @author ashuiskov * @date 18.10.2011 ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { // Scanner r = new Scanner(System.in); Scanner r = new Scanner(new File("input.txt")); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class B120 { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new FileReader("input.txt")); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; import static java.lang.Math.*; public class B { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null; BufferedReader in; PrintWriter out; Stri...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class A1008 { public static void main(String [] args) throws Exception { InputStream inputReader = System.in; OutputStream outputReader = System.out; InputReader in = new InputReader(new FileInputStream(new File("input.txt")));//new InputReader(i...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.util.Scanner; public class B { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(new File("input.txt")); BufferedWriter out = new BufferedWriter(new FileWriter("output.txt")...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException{ // FastScanner sc = new FastScanner(); // int yo = sc.nextInt(); // while(yo-->0) { // } FileInputStream in = new FileInputStream("input.txt"); FileOutputStream out = new FileOutputStream("o...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.StringTokenizer; public class Quiz { public static void main(String args[])throws IOException{ BufferedReader in = new BufferedReader(new FileReader("input.txt")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); StringT...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; /** * * @author Moonkin */ public class Main { StreamTokenizer in; PrintWriter out; BufferedReader br; public static void main(String[] args) throws Exception { new Main().run(); } public void run() throws Exception { boolean oj = Syst...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Write...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
//no full solution import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; //codeforce public class codeforceProblemB1 { private static BufferedReader in; pri...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class test { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); // Scanner in = new ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.util.*; import java.io.*; public class Test2 { public void doMain() throws Exception{ Scanner input = new Scanner(new FileReader("input.txt")); PrintWriter pw = new PrintWriter(new FileWriter("output.txt")); int n = input.nextInt(); int k = input.nextInt(); int person[] = new int[n]; for(int ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.PrintWriter; import java.util.Scanner; public class B120 { public static void main(String[] args) throws Exception { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter("output.txt"); int n = in.nextInt(); int k = in.nextInt()-1; int[] ar =...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class Main { private BufferedReader input; private PrintWriter output; private StringTokenizer stoken; String fin = "input"; String fout = "output"; private void solve() { /* String way = nextToken(); int a = nextInt(); String res = "L"; if (w...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileReader; import java.io.PrintWriter; import java.util.Scanner; public class Lift { public static void main(String[] args) throws Exception{ FileReader fr = new FileReader(new File("input.txt")); PrintWriter pw = new PrintWriter(new File("output.txt")); Scanner scan = new S...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; public class B_120_Quiz_League { public static void main(String[] args) throws FileNotFoundException{ Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(n...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.*; import java.util.*; public class TaskB { BufferedReader br; PrintWriter out; StringTokenizer stok; String nextToken() throws IOException { while (stok == null || !stok.hasMoreTokens()) { String s = br.readLine(); if (s == null) { return "-1"; } stok = new StringTokenizer(s); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintWriter; import java.util.Scanner; public class QuizLeague { public static void main(String[] args) throws FileNotFoundException { FileInputStream is = new FileInputStream("input.txt");...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class B { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new FileReader("input.txt")); ...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { private void Problem() throws IOException { int n = nextInt(), k = nextInt(), a[] = new int[n+1]; for (int i = 1; i < n + 1; i...
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileWriter; import java.io.InputStreamReader; public class B { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated met...