Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class Average {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("average.in"));
- }
- }
- public class Easy {
- public static void main(String[] args) {
- System.out.println("This was unexpectedly easy.");
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class Lithp {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("lithp.in"));
- int test = scan.nextInt();
- scan.nextLine();
- for(int i = 0; i < test; i++) {
- System.out.println(scan.nextLine().replace("s", "th"));
- }
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class Metanumbers {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("metanumbers.in"));
- int test = scan.nextInt();
- scan.nextLine();
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class Mirror {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("esrever.in"));
- int nums = scan.nextInt();
- scan.nextLine();
- for(int i = 0; i < nums; i++) {
- String[] words = scan.nextLine().split(" ");
- for(int j = 1; j < words.length; j+=2) {
- String trans = "";
- for(int a = trans.length() - 1; a >= 0; a--) {
- trans += words[j].charAt(a);
- }
- words[j] = trans;
- }
- for(String e: words) {
- System.out.print(e+ " ");
- }
- System.out.println("");
- }
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class Msschniggles {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("msschniggles.in"));
- int test = scan.nextInt();
- scan.nextLine();
- for(int i = 0; i < test; i++) {
- String input = scan.nextLine();
- int times = scan.nextInt();
- scan.nextLine();
- for(int j = 0; j < times; j++) {
- System.out.println(input);
- }
- System.out.println("");
- }
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class Multiplication {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("multiplicationsquare.in"));
- long num = scan.nextLong();
- for(long i = 1; i <= num; i++) {
- for(long j = 1; j <= num; j++) {
- System.out.print(i*j+ " ");
- }
- System.out.println("");
- }
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.math.BigInteger;
- import java.util.Scanner;
- public class Tens {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("tens.in"));
- int test = scan.nextInt();
- scan.nextLine();
- for(int i = 0; i < test; i++) {
- BigInteger e = new BigInteger(10 + "");
- System.out.println(e.pow(scan.nextInt()));
- }
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class WeirdSort {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("weirdsort.in"));
- int test = scan.nextInt();
- scan.nextLine();
- for(int i = 0; i < test; i++) {
- String[] input = scan.nextLine().split(" ");
- for(int j = 0; j < input.length; j++) {
- for(int k = 0; k < input.length - 1; k++) {
- char a0 = input[k].charAt(0);
- char b0 = input[k].charAt(1);
- char c0 = input[k].charAt(2);
- char a1 = input[k+1].charAt(0);
- char b1 = input[k+1].charAt(1);
- char c1 = input[k+1].charAt(2);
- if(b0 < b1) {
- String temp = input[k];
- input[k] = input[k+1];
- input[k+1] = temp;
- } else {
- if(c0 < c1) {
- String temp = input[k];
- input[k] = input[k+1];
- input[k+1] = temp;
- } else {
- if(a0 < a1) {
- String temp = input[k];
- input[k] = input[k+1];
- input[k+1] = temp;
- }
- }
- }
- }
- }
- for(String e: input) {
- System.out.print(e+" ");
- }
- System.out.println("");
- }
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class boolee {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("boolee.in"));
- int test = scan.nextInt();
- scan.nextLine();
- for(int i = 0; i < test; i++) {
- String[] data = scan.nextLine().split(" ");
- double result = 0;
- double tesst = 1;
- if(data[0].equals("ADD"))
- for(int a = 1; a < data.length; a++)
- result += Double.parseDouble(data[a]);
- else if(data[0].equals("SUB")) {
- tesst = Double.parseDouble(data[1]);
- for(int a = 2; a < data.length; a++)
- tesst -= Double.parseDouble(data[a]);
- }
- else if(data[0].equals("MUL"))
- for(int a = 1; a < data.length; a++)
- tesst *= Double.parseDouble(data[a]);
- else {
- tesst = Double.parseDouble(data[1]);
- for(int a = 2; a < data.length; a++) {
- tesst /= Double.parseDouble(data[a]);
- }
- }
- System.out.print(data[0]+" ");
- System.out.printf("%.2f%n", result);
- }
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class passfail {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("passfail.in"));
- scan.nextLine();
- while(scan.hasNextLine()) {
- String name = scan.nextLine();
- if(Integer.parseInt(name.replaceAll("[^1234567890]", "")) < 70) {
- System.out.println(name.replaceAll("[1234567890]", ""));
- }
- }
- }
- }
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class sleepingsally {
- public static void main(String[] args) throws FileNotFoundException {
- Scanner scan = new Scanner(new File("sleepingsally.in"));
- int tests = scan.nextInt();
- scan.nextLine();
- for(int i = 0; i < tests; i++) {
- String[] data = scan.nextLine().split(" ");
- int length = Integer.parseInt(data[0]);
- int width = Integer.parseInt(data[1]);
- Node[][] mat = new Node[length][width];
- Node start = new Node('F');
- for(int c = 0; c < length; c++) {
- char[] ar = scan.nextLine().toCharArray();
- for(int d = 0; d < width; d++) {
- mat[c][d] = new Node(ar[d]);
- if(mat[c][d].c == 'S') {
- start = mat[c][d];
- }
- }
- }
- int time = scan.nextInt();
- scan.nextLine();
- process(mat, time);
- }
- }
- public static void process(Node[][] mat, int time) {
- boolean changed = true;
- while(changed) {
- changed = false;
- for(int i = 0; i < mat.length; i++) {
- for(int j = 0; j < mat[i].length; j++) {
- if(mat[i][j].c != '#') {
- for(int k = -1; k < 2; k++) {
- for(int l = -1; l < 2; l++) {
- if(l == 0 ^ k == 0) {
- try {
- if(mat[i][j].dist < mat[i+k][j+l].dist-1) {
- mat[i+k][j+l].dist = mat[i][j].dist+1;
- changed = true;
- }
- } catch(Exception e) {}
- }
- }
- }
- }
- }
- }
- }
- for(int i = 0; i < mat.length; i++) {
- for(int j = 0; j < mat[i].length; j++) {
- if(mat[i][j].c == 'S') {
- System.out.println((mat[i][j].dist < time || (mat[i][j].dist == 8 && time == 8)) ? "Success" : "Failure");
- }
- }
- }
- }
- }
- class Node {
- public int dist;
- public char c;
- public Node(char c) {
- this.c = c;
- if(c == '#') {
- dist = Integer.MIN_VALUE;
- } else if(c == 'B') {
- dist = 0;
- } else {
- dist = Integer.MAX_VALUE;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement