Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Gen {
- FastScanner in;
- PrintWriter out;
- Random rnd = new Random();
- void solve() {
- int n = 1 + rnd.nextInt(100);
- int m = 1 + rnd.nextInt(100);
- out.println(n + " " + m);
- char[] check = "0123456789".toCharArray();
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- if(rnd.nextDouble() < 0.01) {
- out.print("#");
- } else
- out.print(check[rnd.nextInt(check.length)]);
- }
- out.println();
- }
- }
- void run() {
- try {
- out = new PrintWriter(new File("input.txt"));
- solve();
- out.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- void runIO() {
- in = new FastScanner(System.in);
- out = new PrintWriter(System.out);
- solve();
- out.close();
- }
- class FastScanner {
- BufferedReader br;
- StringTokenizer st;
- public FastScanner(File f) {
- try {
- br = new BufferedReader(new FileReader(f));
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- public FastScanner(InputStream f) {
- br = new BufferedReader(new InputStreamReader(f));
- }
- String next() {
- while (st == null || !st.hasMoreTokens()) {
- String s = null;
- try {
- s = br.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (s == null)
- return null;
- st = new StringTokenizer(s);
- }
- return st.nextToken();
- }
- boolean hasMoreTokens() {
- while (st == null || !st.hasMoreTokens()) {
- String s = null;
- try {
- s = br.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (s == null)
- return false;
- st = new StringTokenizer(s);
- }
- return true;
- }
- int nextInt() {
- return Integer.parseInt(next());
- }
- long nextLong() {
- return Long.parseLong(next());
- }
- double nextDouble() {
- return Double.parseDouble(next());
- }
- }
- public static void main(String[] args) {
- new Gen().runIO();
- }
- }
Add Comment
Please, Sign In to add comment