import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[][] array=new int[4][13];
		for(int i=1; i<=n; i++){
			String s=sc.next();
			int a=sc.nextInt();
			if(s.equals("S")){
				array[0][a-1]=1;
			}else if(s.equals("H")){
				array[1][a-1]=1;
			}else if(s.equals("C")){
				array[2][a-1]=1;
			}else if(s.equals("D")){
				array[3][a-1]=1;
			}
		}
		for(int i=0; i<array.length; i++){
			for(int j=0; j<array[0].length; j++){
				if(array[i][j]==0 && i==0){
					System.out.println("S "+(j+1));
				}else if(array[i][j]==0 && i==1){
					System.out.println("H "+(j+1));
				}else if(array[i][j]==0 && i==2){
					System.out.println("C "+(j+1));
				}else if(array[i][j]==0 && i==3){
					System.out.println("D "+(j+1));
				}
			}
		}

	}

}

Finding Missing Cards

Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).

The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.

Input

In the first line, the number of cards n (n ≤ 52) is given.

In the following n lines, data of the n cards are given. Each card is given by a pair of a character and an integer which represent its suit and rank respectively. A suit is represented by 'S', 'H', 'C' and 'D' for spades, hearts, clubs and diamonds respectively. A rank is represented by an integer from 1 to 13.

Output

Print the missing cards. The same as the input format, each card should be printed with a character and an integer separated by a space character in a line.
Arrange the missing cards in the following priorities:

Print cards of spades, hearts, clubs and diamonds in this order.

If the suits are equal, print cards with lower ranks first.

Sample Input

47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 8
S 9
H 6
H 8
H 9
H 10
H 11
H 4
H 5
S 2
S 3
S 4
S 5
H 12
H 13
C 1
C 2
D 1
D 2
D 3
D 4
D 5
D 6
D 7
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13

Sample Output

S 1
H 3
H 7
C 12
D 8

Note

      解説


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) throws IOException {
        Deck deck = new Deck();

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            br.readLine();//1行目は捨てる;
            br.lines().map(Card::new).forEach(deck::add);//行ごとにカード生成してデッキに追加
        }

        System.out.print(deck);
    }
}

class Deck {
    private final Map<String, Suit> suits;

    public void add(Card card) {
        suits.get(card.getSuitSymbol()).add(card.getRank());
    }

    private boolean isMissing(String suitSymbol, int rank) {
        return suits.get(suitSymbol).isMissing(rank);
    }

    private String getMissingCardListAsString() {
        List<String> missingCardList = new ArrayList<>();
        String[] suitSymbol = {"S", "H", "C", "D"};

        for(int i = 0; i < 4; i++) {
            for (int j = 1; j <= 13; j++) {
                if (isMissing(suitSymbol[i], j)) {
                    missingCardList.add(suitSymbol[i] + " " + j);
                }
            }
        }
        if(missingCardList.size() > 0) {
            return missingCardList.stream().collect(Collectors.joining(String.format("%n"),"", String.format("%n")));
        } else {
            return "";
        }
    }

    @Override
    public String toString() {
        return getMissingCardListAsString();
    }

    public Deck(){
        super();
        suits = new HashMap<>();
        suits.put("S", new Suit());
        suits.put("C", new Suit());
        suits.put("H", new Suit());
        suits.put("D", new Suit());
    }
}

class Suit {
    private final boolean[] cards;

    public void add(int rank) {
        cards[rank - 1] = true;
    }

    public boolean isMissing(int rank) {
        return !cards[rank - 1];
    }

    public Suit() {
        super();
        cards = new boolean[13];
    }
}

class Card {
    private final String suitSymbol;
    private final int rank;

    public String getSuitSymbol() {
        return suitSymbol;
    }

    public int getRank() {
        return rank;
    }

    private Card(String suitSymbol, int rank) {
        super();
        this.suitSymbol = suitSymbol;
        this.rank = rank;
    }

    public Card(String lineString) {
        this(lineString.split(" ")[0], lineString.split(" ")[1]);
    }

    private Card(String suitSymbol, String rank) {
        this(suitSymbol, Integer.parseInt(rank));
    }
}

Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.

Submitted source-code file size, in bytes.

Execution CPU time reported by official Project CodeNet metadata, in milliseconds.

Peak memory usage reported by official Project CodeNet metadata, in kilobytes.


import java.util.Scanner;

public class Main {
       public static void main(String[] args) {
           int n;
           String a;
           int i;
           int j;

        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        String [] [] c = new String [4] [13];

        while(n!=0){
            n--;
            switch(a = sc.next().toUpperCase()){
                case "S":
                  i = 0;
                  j = sc.nextInt();
                  c [i] [j-1] = a+" "+j;
                break;
                case "H":
                    i = 1;
                    j = sc.nextInt();
                    c [i] [j-1] = a+ " " + j;
                break;
                case "C":
                    i = 2;
                    j = sc.nextInt();
                    c [i] [j-1] = a+ " " + j;
                break;
                case "D":
                    i = 3;
                    j = sc.nextInt();
                    c [i] [j-1] = a+ " " + j;
                break;
          }
        }
          for ( i = 0; i <4; i++){
            for (j = 0; j<13; j++){
                int k = j+1;
                if( c[i][j]== null){
                switch(i){
                    case 0:
                    System.out.println("S "+ k);
                    break;
                    case 1:
                    System.out.println("H "+ k);
                    break;
                    case 2:
                    System.out.println("C "+ k);
                    break;
                    case 3:
                    System.out.println("D "+ k);
                    break;
                }
                }
                }
          }
          }
}


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		boolean[][] card = new boolean[4][13];
		for (int i = 0; i < n; ++i) {
			String s = scanner.next();
			int num = scanner.nextInt();
			card[s.equals("S") ? 0 : s.equals("H") ? 1 : s.equals("C") ? 2 : 3][num - 1] = true;
		}
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 13; ++j) {
				if (!card[i][j])
					System.out.printf("%s %d\n", i == 0 ? "S" : i == 1 ? "H" : i == 2 ? "C" : "D", j + 1);
			}
		}
	}
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int b,f,r,v;
		int d[][][] = new int[4][3][10];

		for(int i=1;i<=n;i++){
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			d[b-1][f-1][r-1] = d[b-1][f-1][r-1]+v;
		}
		for(int i=0;i<4;i++){
			for(int j=0;j<3;j++){
				for(int k=0;k<9;k++){
					System.out.print(d[i][j][k]+" ");
				}
				System.out.println(d[i][j][9]);
			}
			if(i!=3){
				System.out.println("####################");
			}
		}
		System.out.println();
	}
}

Official House

You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.

For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that −v persons left.

Assume that initially no person lives in the building.

Input

In the first line, the number of notices n is given. In the following n lines, a set of four integers b, f, r and v which represents ith notice is given in a line.

Output

For each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print "####################" (20 '#') between buildings.

Constraints

No incorrect building, floor and room numbers are given.

0 ≤ the number of tenants during the management ≤ 9

Sample Input

3
1 1 3 8
3 2 2 7
4 3 8 1

Sample Output

0 0 8 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
####################
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
####################
0 0 0 0 0 0 0 0 0 0
0 7 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
####################
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int bfrv[][][] = new int[5][4][11];
        int b = 0;
        int f = 0;
        int r = 0;
        int v = 0;
        for (int i = 0; i < n; i++) {

            b = sc.nextInt();
            f = sc.nextInt();
            r = sc.nextInt();
            v = sc.nextInt();

            bfrv[b][f][r] += v;
            if (bfrv[b][f][r] < 0) {
                bfrv[b][f][r] = 0;
            }
        }
        for (int i = 1; i < 5; i++) {
            for (int j = 1; j < 4; j++) {
                for (int k = 1; k < 11; k++) {
                    System.out.print(bfrv[i][j][k]);
                    if (k != 10) {
                        System.out.print(" ");
                    }
                }
                System.out.println("");
            }
            if (i != 4) {
                System.out.println("####################");
            }
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        int i,j;

        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();

        Matrix A=new Matrix(n,m);
        for(i=0;i<n;i++){
            for(j=0;j<m;j++)A.setElement(i,j,sc.nextInt());
        }

        Matrix B=new Matrix(m,1);
        for(i=0;i<m;i++)B.setElement(i,0,sc.nextInt());

        Matrix C=new Matrix(n,1);
        C.product(A,B);
        C.printElement();
    }
}
class Matrix{
    private int row;
    private int col;
    private int elm[][];
    Matrix(int a,int b){
        this.row=a;
        this.col=b;
        elm=new int[a][b];
    }
    void setElement(int a,int b,int x){
        this.elm[a][b]=x;
    }
    void printElement(){
        for(int i=0;i<this.row;i++){
            for(int j=0;j<this.col;j++){
                if(j==0)System.out.printf("%d",this.elm[i][j]);
                else System.out.printf(" %d",this.elm[i][j]);
            }
            System.out.printf("\n");
        }
    }
    void product(Matrix a,Matrix b){
        if(a.col!=b.row){
            System.out.println("wrong input");
            System.exit(0);
        }

        for(int i=0;i<a.row;i++){
            for(int k=0;k<b.col;k++){
                for(int j=0;j<a.col;j++){
                    this.elm[i][k]+=a.elm[i][j]*b.elm[j][k];
                }
            }
        }
    }
}

MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Matrix Vector Multiplication

Write a program which reads a $ n \times m$ matrix $A$ and a $m \times 1$ vector $b$, and prints their product $Ab$.

A column vector with m elements is represented by the following equation.

\[
b = \left(
\begin{array}{c}
b_1 \\
b_2 \\
: \\
b_m \\
\end{array}
\right)
\]

A $n \times m$ matrix with $m$ column vectors, each of which consists of $n$ elements, is represented by the following equation.

\[
A = \left(
\begin{array}{cccc}
a_{11} & a_{12} & ... & a_{1m} \\
a_{21} & a_{22} & ... & a_{2m} \\
: & : & : & : \\
a_{n1} & a_{n2} & ... & a_{nm} \\
\end{array}
\right)
\]

$i$-th element of a $m \times 1$ column vector $b$ is represented by $b_i$ ($i = 1, 2, ..., m$), and the element in $i$-th row and $j$-th column of a matrix $A$ is represented by $a_{ij}$ ($i = 1, 2, ..., n,$ $j = 1, 2, ..., m$).

The product of a $n \times m$ matrix $A$ and a $m \times 1$ column vector $b$ is a $n \times 1$ column vector $c$, and $c_i$ is obtained by the following formula:

\[
c_i = \sum_{j=1}^m a_{ij}b_j = a_{i1}b_1 + a_{i2}b_2 + ... + a_{im}b_m
\]

Input

In the first line, two integers $n$ and $m$ are given. In the following $n$ lines, $a_{ij}$ are given separated by a single space character. In the next $m$ lines, $b_i$ is given in a line.

Output

The output consists of $n$ lines. Print $c_i$ in a line.

Constraints

$1 \leq n, m \leq 100$

$0 \leq b_i, a_{ij} \leq 1000$

Sample Input

3 4
1 2 0 1
0 3 0 1
4 1 1 0
1
2
3
0

Sample Output

5
6
9


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[][] a = new int[n][m];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				a[i][j] = scan.nextInt();
			}
		}
		int[] b = new int[m];
		for(int j = 0; j < m; j++){
			b[j] = scan.nextInt();
		}
		for(int i = 0; i < n; i++){
			int num = 0;
			for(int j = 0; j < m; j++){
				num += a[i][j] * b[j];
			}
			System.out.println(num);
		}
	}
}


import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] strs = br.readLine().split("\\s+");
		int n = Integer.parseInt(strs[0]);
		int m = Integer.parseInt(strs[1]);

		int[][] A = new int[n][m];
		int[] b = new int[m];
		int[] c = new int[n];

		for (int i = 0; i < n; i++) {
			strs = br.readLine().split("\\s+");
			for (int j = 0; j < m; j++) A[i][j] = Integer.parseInt(strs[j]);
		}

		for (int i = 0; i < m; i++) b[i] = Integer.parseInt(br.readLine());

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				c[i] += A[i][j] * b[j];
			}
			System.out.println(c[i]);
		}

	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		Scanner scan = new Scanner(System.in);

		boolean isContinue = true;

		//?????°???????´?????????????
		int[] score = new int[3];
		//????????????????´????????????¬????????§????????????
		ArrayList<String> list = new ArrayList<String>();

		while(isContinue){

			int m = scan.nextInt();
			int f = scan.nextInt();
			int r = scan.nextInt();

			int intScore = 0;
			//????????????????????´??????intScore????¨????
			if(m != -1 && f != -1){
				intScore = m + f;
			}

			//while????????????????????¶
			if(m == -1 && f == -1 && r == -1){
				isContinue = false;
				scan.close();

			//????????????????????????????????????list???????´?
			}else if(m == -1 || f == -1 || intScore < 30 ){

				list.add("F");
			}else if(80 <= intScore){

				list.add("A");
			}else if(65 <= intScore){

				list.add("B");
			}else if(50 <= intScore){

				list.add("C");
			}else if(30 <= intScore &&  50 <= r){

				list.add("C");

			}else{

				list.add("D");
			}
			//System.out.println("list.size():" + list.size());
		}

		for(int i = 0; i < list.size(); i++){

			System.out.println(list.get(i));
		}

	}
}

Grading

Write a program which reads a list of student test scores and evaluates the performance for each student.

The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup examination r (out of 100). If the student does not take the examination, the score is indicated by -1.

The final performance of a student is evaluated by the following procedure:

If the student does not take the midterm or final examination, the student's grade shall be F.

If the total score of the midterm and final examination is greater than or equal to 80, the student's grade shall be A.

If the total score of the midterm and final examination is greater than or equal to 65 and less than 80, the student's grade shall be B.

If the total score of the midterm and final examination is greater than or equal to 50 and less than 65, the student's grade shall be C.

If the total score of the midterm and final examination is greater than or equal to 30 and less than 50, the student's grade shall be D. However, if the score of the makeup examination is greater than or equal to 50, the grade shall be C.

If the total score of the midterm and final examination is less than 30, the student's grade shall be F.

Input

The input consists of multiple datasets. For each dataset, three integers m, f and r are given in a line.

The input ends with three -1 for m, f and r respectively. Your program should not process for the terminal symbols.

The number of datasets (the number of students) does not exceed 50.

Output

For each dataset, print the grade (A, B, C, D or F) in a line.

Sample Input

40 42 -1
20 30 -1
0 2 -1
-1 -1 -1

Sample Output

A
C
F


import java.util.Scanner;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner scan = new Scanner(System.in);
		ArrayList<Integer> number = new ArrayList<Integer>();

		int n = 0;
		int x = 0;
		int countA = 0;

		while(true){
			n = scan.nextInt();
			x = scan.nextInt();
			int count = 0;
			if(n == 0 && x == 0){
				break;
			}

			for (int i = 1; i <= n; i++) {
				for (int j = 1; j <= n; j++) {
					for (int k = 1; k <= n; k++) {
						if (i == j || j == k) {
							continue;
						} else if (i < j && j < k) {
							int s = i + j + k;
							if (s == x) {
								count = count + 1;
							}
						}
					}
				}
			}
			number.add(count);
			countA++;
		}
		for(int h = 0; h < countA; h++){
			System.out.println(number.get(h));
		}
	}
}

How many ways?

Write a program which identifies the number of combinations of three integers which satisfy the following conditions:

You should select three distinct integers from 1 to n.

A total sum of the three integers is x.

For example, there are two combinations for n = 5 and x = 9.

1 + 3 + 5 = 9

2 + 3 + 4 = 9

Input

The input consists of multiple datasets. For each dataset, two integers n and x are given in a line.

The input ends with two zeros for n and x respectively. Your program should not process for these terminal symbols.

Constraints

3 ≤ n ≤ 100

0 ≤ x ≤ 300

Output

For each dataset, print the number of combinations in a line.

Sample Input

5 9
0 0

Sample Output

2

Note

      解説


import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        String[] inputs = scan.nextLine().split(" ");
        int n = Integer.parseInt(inputs[0]);
        int x = Integer.parseInt(inputs[1]);
        int num = 0;
        int k;

        for (int i=1; i<n-1; i++){
            for (int j=i+1; j<n; j++){
                //for (int k=j+1; k<n+1; k++){
                //    if (i+j+k == x)
                //        num += 1;
                //        break;

                //?????????????¶?????????¶??? i+j+k <= x
                //???????????? k <= x-i-j

                k = x-i-j;
                if (k > j && k <= n)
                    num += 1;
            }
        }
        if (num != 0){
            System.out.println(num);
        }
    }
}


import java.util.*;
public class Main {
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args) {

    while(kbd.hasNext()){
        int n = kbd.nextInt();
        int x = kbd.nextInt();
        int z=0;
        if(!(n==0 && x==0)){
        for(int a=1; a<=n-2; a++){
            for(int b=2; b<=n-1; b++){
            for(int c=3; c<=n; c++){
                //System.out.println(a+" "+b+" "+c);
                if(m(a,b,c,x)) z++;
            }
            }
        }
        System.out.println(z);
        }
    }
    }
    static boolean m(int a, int b, int c, int x){
    boolean p = a+b+c==x;
    boolean q = a<b && b<c;
    return p&&q;
    }
}


import java.util.*;
//import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(true){
            int n=sc.nextInt();
            int x=sc.nextInt();
            if(n==0 && x==0) break;
            int ans=0;
            for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) for(int k=j+1;k<=n;k++){
                if(i+j+k==x) ans++;
            }
            System.out.println(ans);
        }
        sc.close();
    }
}


import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int r = in.nextInt();
        int c = in.nextInt();
        int gou = 0;
        int[][] a = new int [r+1][c+1];
        for(int i = 0; i<r; i++){
            int g = 0;
            int o = 0;
            for(int j = 0; j <c + 1; j++){
                if(c == j){
                    o += g;
                    System.out.print(g);

                }else{
                    int h = in.nextInt();
                    System.out.print(h + " ");
                    g += h;
                    a[i][j] = h;
                }
            }
        }
        System.out.println();
            for(int j = 0; j<c ; j++){
            int g2 = 0;
            for(int i = 0; i<r; i++){
                g2 += a[i][j];
                }
                gou += g2;
            System.out.print(g2 + " ");
            }
        System.out.print(gou);

    }
}

Spreadsheet

Your task is to perform a simple table calculation.

Write a program which reads the number of rows r, columns c and a table of r × c elements, and prints a new table, which includes the total sum for each row and column.

Input

In the first line, two integers r and c are given. Next, the table is given by r lines, each of which consists of c integers separated by space characters.

Output

Print the new table of (r+1) × (c+1) elements. Put a single space character between adjacent elements. For each row, print the sum of it's elements in the last column. For each column, print the sum of it's elements in the last row. Print the total sum of the elements at the bottom right corner of the table.

Constraints

1 ≤ r, c ≤ 100

0 ≤ an element of the table ≤ 100

Sample Input

4 5
1 1 3 4 5
2 2 2 4 5
3 3 0 1 1
2 3 4 4 6

Sample Output

1 1 3 4 5 14
2 2 2 4 5 15
3 3 0 1 1 8
2 3 4 4 6 19
8 9 9 13 17 56


import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] input = br.readLine().split(" ");
        int r = Integer.valueOf(input[0]);
        int c = Integer.valueOf(input[1]);

        int[][] matrix = new int[r+1][c+1];

        //input data
        for(int i = 0; i < r; i++){
            String[] line = br.readLine().split(" " , c);
            for(int j = 0; j < c; j++){
                matrix[i][j] = Integer.parseInt(line[j]);
            }
        }

        for(int i = 0; i < r; i++){
            for(int j = 0; j < c; j++){
                matrix[i][c] += matrix[i][j];
            }
        }

        for(int i = 0; i < c+1; i++){
            for(int j = 0; j < r; j++){
                matrix[r][i] += matrix[j][i];
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i = 0; i <= r; i++){
            for(int j = 0; j <= c; j++){
                sb.append(matrix[i][j]);
                if(j != c) sb.append(" ");
            }
            if(i != r)sb.append("\n");
        }
        System.out.print(sb);

    }
}


import java.io.*;
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    int l=sc.nextInt();
    long A[][];
    long B[][];
    long C[][];
    A=new long [n][m];
    B=new long [m][l];
    C=new long [n][l];
    for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
        A[i][j]=(long)sc.nextInt();
      }
    }
    for(int i=0;i<m;i++){
      for(int j=0;j<l;j++){
        B[i][j]=(long)sc.nextInt();
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<l;j++){
        for(int k=0;k<m;k++){
          C[i][j]+=A[i][k]*B[k][j];
        }
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<l;j++){
        System.out.print(C[i][j]);
        if(j!=l-1) System.out.print(" ");
        else System.out.println();
      }
    }
  }
}

MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Matrix Multiplication

Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula:

\[
c_{ij} = \sum_{k=1}^m a_{ik}b_{kj}
\]

where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ respectively.

Input

In the first line, three integers $n$, $m$ and $l$ are given separated by space characters

In the following lines, the $n \times m$ matrix $A$ and the $m \times l$ matrix $B$ are given.

Output

Print elements of the $n \times l$ matrix $C$ ($c_{ij}$). Print a single space character between adjacent elements.

Constraints

$1 \leq n, m, l \leq 100$

$0 \leq a_{ij}, b_{ij} \leq 10000$

Sample Input

3 2 3
1 2
0 3
4 5
1 2 1
0 3 2

Sample Output

1 8 5
0 9 6
4 23 14

Note

      解説


import java.util.Scanner;

public class Main{
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int l = sc.nextInt();
		int work = 0;
		int A[][] = new int[n][m];
		int B[][] = new int[m][l];
		long C[][] = new long[n][l];

		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				A[i][j] = sc.nextInt();
			}
		}

		for(int i = 0; i < m; i++){
			for(int j = 0; j < l; j++){
				B[i][j] = sc.nextInt();
			}
		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < l; j++){
				for(int k = 0; k < m; k++){
					work += (A[i][k] * B[k][j]);
				}
				C[i][j] = work;
				work = 0;
			}
		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < l; j++){
				System.out.print(C[i][j]);
				if(j == l - 1){
					System.out.println("");
				}else{
					System.out.print(" ");
				}
			}
		}
	}
}


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

			int i;
			int j;
			int k;

			int n = sc.nextInt();
			int m = sc.nextInt();
			int l = sc.nextInt();

			int A[][] = new int[n][m];
			int B[][] = new int[m][l];
			int C[][] = new int[n][l];

			for(i = 0; i < n; i++) {
				for(j = 0; j < m; j++) {
					int a_ij = sc.nextInt();
					A[i][j] = a_ij;
				}
			}

			for(i = 0; i < m; i++) {
				for(j = 0; j < l; j++) {
					int b_ij = sc.nextInt();
					B[i][j] = b_ij;
				}
			}

			for(i = 0; i < n; i++) {
				for(j = 0; j < l; j++) {
					for(k = 0; k < m; k++) {
						C[i][j] = C[i][j] + A[i][k] * B[k][j];
					}
					if(j == l - 1) {
						System.out.println(C[i][j]);
					} else {
						System.out.print(C[i][j] + " ");
					}
				}
			}

	}
}


import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		String[] strarray = str.split(" ");
		for(int i = 0; i < strarray.length; i++) {
			char[] carray = strarray[i].toCharArray();
			for (char c : carray) {
				if (Character.isUpperCase(c)) {
					c = Character.toLowerCase(c);
				} else if (Character.isLowerCase(c)) {
					c = Character.toUpperCase(c);
				}
				System.out.print(c);
			}
			if (i != strarray.length - 1)System.out.print(" ");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Toggling Cases

Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string.

Input

A string is given in a line.

Output

Print the converted string in a line. Note that you do not need to convert any characters other than alphabetical letters.

Constraints

The length of the input string < 1200

Sample Input

fAIR, LATER, OCCASIONALLY CLOUDY.

Sample Output

Fair, later, occasionally cloudy.


import java.util.Scanner;

public class Main{
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		String input = sc.nextLine();
		String work = "";
		for(int i = 0; i < input.length(); i++){
			work = input.substring(i,i+1);
			if(Character.isUpperCase(work.charAt(0))){
				System.out.print(work.toLowerCase());
			}else{
				System.out.print(work.toUpperCase());
			}
		}
	}
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        for(char c : str.toCharArray()){
            if(65 <= c && c <= 90) System.out.print((char)(c + 32));
            else if(97 <= c && c <= 122) System.out.print((char)(c - 32));
            else System.out.print(c);
        }
    }

}


import java.util.*;
public class Main{
      public static void main(String[] args){
          Scanner sc =new Scanner (System.in);
          String a;
          int n ;
          a = sc.nextLine();
          int l =a.length();
          for (n=0;n<l;n++){
              char b =a.charAt(n);
              if(Character.isLowerCase(b)){
                  System.out.print(Character.toUpperCase(b));
              }else if(Character.isUpperCase(b)){
                  System.out.print(Character.toLowerCase(b));
              }
             }

          System.out.printf("\n");
            }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    int sum;
    while(true){
      String line = br.readLine();
      if("0".equals(line)){
      break;
    }
    char[] c = line.toCharArray();
    sum = 0;
    for(int i = 0; i < c.length; i++){
      sum = sum + Character.getNumericValue(c[i]);
    }
    sb.append(sum);
    sb.append("\n");
  }
  System.out.print(sb);
}
}

Sum of Numbers

Write a program which reads an integer and prints sum of its digits.

Input

The input consists of multiple datasets. For each dataset, an integer x is given in a line. The number of digits in x does not exceed 1000.

The input ends with a line including single zero. Your program should not process for this terminal symbol.

Output

For each dataset, print the sum of digits in x.

Sample Input

123
55
1000
0

Sample Output

6
10
1


import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
            String x;
            while(true){
                x=sc.next();
                if(x.equals("0")) break;
                int sum=0;
                for(int i=0;i<x.length();i++){
                    sum+=x.charAt(i)-'0';
                }
                System.out.println(sum);
            }
        }
    }


import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String x = scanner.nextLine();
        while(!x.equals("0")){
            char ch[] = x.toCharArray();
            int sum = 0;
            for(int i=0; i < x.length(); i++){
                sum += Character.getNumericValue(ch[i]);
            }
            System.out.println(sum);

            x = scanner.nextLine();
        }
    }
}


Counting Characters

Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters.

Input

A sentence in English is given in several lines.

Output

Prints the number of alphabetical letters in the following format:

a : The number of 'a'
b : The number of 'b'
c : The number of 'c'
.
.
z : The number of 'z'

Constraints

The number of characters in the sentence < 1200

Sample Input

This is a pen.

Sample Output

a : 1
b : 0
c : 0
d : 0
e : 1
f : 0
g : 0
h : 1
i : 2
j : 0
k : 0
l : 0
m : 0
n : 1
o : 0
p : 1
q : 0
r : 0
s : 2
t : 1
u : 0
v : 0
w : 0
x : 0
y : 0
z : 0


import java.util.Scanner;

class Main{
       public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	String number = scan.nextLine();
    	String change = number.toLowerCase();

    	char[] ca = change.toCharArray();
    	int[] count = new int[26];
    	int num;
    	char alphabet = 'a';

    	for(int i = 0; i < ca.length; i++){
    		num = ca[i] - 'a';
    		if(num >= 0 && num < 26){
    			count[num]++;
    		}
    	}

    	for(int i = 0; i < 26; i++){;
    		System.out.println(alphabet + ":" + count[i]);
    		alphabet += 1;
    	}
     }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);

        StringBuilder s = new StringBuilder();

        while(inp.hasNext()){
            s.append(inp.nextLine());
        }

        count(s.toString());
    }

    public static void count(String s) {
        for (int alpha = 0; alpha < 26; alpha++) {
            String letter;
            int counter = 0;

            switch (alpha) {
                case 0: letter = "a";
                        break;
                case 1: letter = "b";
                        break;
                case 2: letter = "c";
                        break;
                case 3: letter = "d";
                    break;
                case 4: letter = "e";
                    break;
                case 5: letter = "f";
                    break;
                case 6: letter = "g";
                    break;
                case 7: letter = "h";
                    break;
                case 8: letter = "i";
                    break;
                case 9: letter = "j";
                    break;
                case 10: letter = "k";
                    break;
                case 11: letter = "l";
                    break;
                case 12: letter = "m";
                    break;
                case 13: letter = "n";
                    break;
                case 14: letter = "o";
                    break;
                case 15: letter = "p";
                    break;
                case 16: letter = "q";
                    break;
                case 17: letter = "r";
                    break;
                case 18: letter = "s";
                    break;
                case 19: letter = "t";
                    break;
                case 20: letter = "u";
                    break;
                case 21: letter = "v";
                    break;
                case 22: letter = "w";
                    break;
                case 23: letter = "x";
                    break;
                case 24: letter = "y";
                    break;
                default: letter = "z";
                    break;
            }
            String letterUp = letter.toUpperCase();

            for (int i = 0; i < s.length(); i++) {
                if ((""+s.charAt(i)).equals(letter) || (""+s.charAt(i)).equals(letterUp)) {
                    counter++;
                }
            }

            System.out.println(letter + " : " + counter);
        }
    }
}


import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    String[] str = sc.nextLine().split("");
    String p = sc.nextLine();
    for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    }
  }
}

MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Ring

Write a program which finds a pattern $p$ in a ring shaped text $s$.

Input

In the first line, the text $s$ is given.

In the second line, the pattern $p$ is given.

Output

If $p$ is in $s$, print Yes in a line, otherwise No.

Constraints

$1 \leq $ length of $p \leq $ length of $s \leq 100$

$s$ and $p$ consists of lower-case letters

Sample Input 1

vanceknowledgetoad
advance

Sample Output 1

Yes

Sample Input 2

vanceknowledgetoad
advanced

Sample Output 2

No


import java.io.IOException;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws IOException {

		Scanner scanner = new Scanner(System.in);
		String ans = scanner.nextLine().toLowerCase();
		int count = 0;

		end:
		while (scanner.hasNext()) {
			String str = scanner.nextLine().toLowerCase();
			String[] strs = str.split(" ");
			for (int i = 0; i < strs.length; i++) {
				if(strs[i].equals("end_of_text")){
					break end;
				}
				if (strs[i].contains(ans)) {
					count++;
				}
			}
			System.out.println(count);
		}
	}
}

Finding a Word

Write a program which reads a word W and a text T, and prints the number of word W which appears in text T

T consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive.

Constraints

The length of W ≤ 10

W consists of lower case letters

The length of T in a line ≤ 1000

Input

In the first line, the word W is given. In the following lines, the text T is given separated by space characters and newlines.

"END_OF_TEXT" indicates the end of the text.

Output

Print the number of W in the text.

Sample Input

computer
Nurtures computer scientists and highly-skilled computer engineers
who will create and exploit "knowledge" for the new era.
Provides an outstanding computer environment.
END_OF_TEXT

Sample Output

3


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int count = 0;
        String key = sc.next().toString();
        String cmp;

        String input = sc.next();
        while(! input.equals("END_OF_TEXT")) {
            cmp = input.toLowerCase();
            if(input.equals(cmp))
                count++;
            input = sc.next();
        }
        System.out.println(count);
    }
}


import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    int a=0,end = 0;
    String ans;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try{
      String line = reader.readLine();
      ans = line;

      while (true) {
        line = reader.readLine();
        for(String splitted: line.split(" ")){
           if (ans.equalsIgnoreCase(splitted)) a++;
           if (splitted.equals("END_OF_TEXT")) end = 1;
        }
        if(end == 1) break;
      }

		}catch(Exception e){
    }
  System.out.println(a);

  }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input;
        int m;

        while (!(input = sc.next()).equals("-")) {
            m = sc.nextInt();
            int[] h = new int[m];
            char[] output = new char[input.length()];
            for (int i = 0; i < m; i++) {
                h[i] = sc.nextInt();
            }
            for (int i = 0; i < input.length(); i++) {
                output[i] = input.charAt(i);
            }

            for (int i = 0; i < m; i++) {
                output = change(output, input.length(), h[i]);
            }
            for (char c : output) System.out.print(c);
            System.out.println();
        }
    }

    public static char[] change(char[] input, int length, int n) {
        char[] output = new char[length];

        for (int i = 0; i < length - n; i++) {
            output[i] = input[i+n];
        }
        for (int i = length - n; i < length; i++) {
            output[i] = input[i + n - length];
        }

        return output;
    }
}

Shuffle

Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter.

A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck.

The deck of cards is represented by a string as follows.

abcdeefab

The first character and the last character correspond to the card located at the bottom of the deck and the card on the top of the deck respectively.

For example, a shuffle with h = 4 to the above deck, moves the first 4 characters "abcd" to the end of the remaining characters "eefab", and generates the following deck:

eefababcd

You can repeat such shuffle operations.

Write a program which reads a deck (a string) and a sequence of h, and prints the final state (a string).

Input

The input consists of multiple datasets. Each dataset is given in the following format:

A string which represents a deck
The number of shuffle m
h1
h2
.
.
hm

The input ends with a single character '-' for the string.

Constraints

The length of the string ≤ 200

1 ≤ m ≤ 100

1 ≤ hi < The length of the string

The number of datasets ≤ 10

Output

For each dataset, print a string which represents the final state in a line.

Sample Input

aabc
3
1
2
1
vwxyz
2
3
4
-

Sample Output

aabc
xyzvw


import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	final static String END_SIGN = "-";

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		ArrayList<String> resultList = new ArrayList<String>();

		String str;
		while (EndDecision(str = sc.nextLine())) {

			int shuffleCount = Integer.parseInt(sc.nextLine());

			for (int i = 0; i < shuffleCount; i++) {
				str = Shuffle(str, Integer.parseInt(sc.nextLine()));
			}
			resultList.add(str);
		}

		for (String s : resultList) {
			System.out.println(s);
		}

	}

	static String Shuffle(String str, int num) {
		String result = str.substring(num);
		result += str.substring(0, num);
		return result;
	}

	// 終了判定
	public static boolean EndDecision(String array) {
		if (array.equals(END_SIGN)) {
			return false;
		} else {
			return true;
		}

	}

}


import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String target = sc.next();
        int num = sc.nextInt();
        for(int i = 0; i < num; i++){
            String command = sc.next();
            int a = sc.nextInt();
            int b = sc.nextInt();
            String c = "";
            if(command.equals("replace")){
                c = sc.next();
            }

            if(command.equals("print")){
                System.out.println(target.substring(a, b));
            }else if(command.equals("reverse")){
                char[] charArray = target.substring(a, b).toCharArray();
                String str = "";
                for(int j = charArray.length - 1; j >= 0; j--){
                    str += charArray[j];
                }
                target = target.substring(0, a) + str + target.substring(b);
            }else if(command.equals("replace")){
                target = target.substring(0, a) + c + target.substring(b);
            }
        }
    }
}

MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Transformation

Write a program which performs a sequence of commands to a given string $str$. The command is one of:

print a b: print from the a-th character to the b-th character of $str$

reverse a b: reverse from the a-th character to the b-th character of $str$

replace a b p: replace from the a-th character to the b-th character of $str$ with p

Note that the indices of $str$ start with 0.

Input

In the first line, a string $str$ is given. $str$ consists of lowercase letters. In the second line, the number of commands q is given. In the next q lines, each command is given in the above mentioned format.

Output

For each print command, print a string in a line.

Constraints

$1 \leq $ length of $str \leq 1000$

$1 \leq q \leq 100$

$0 \leq a \leq b < $ length of $str$

for replace command, $b - a + 1 = $ length of $p$

Sample Input 1

abcde
3
replace 1 3 xyz
reverse 0 2
print 1 4

Sample Output 1

xaze

Sample Input 2

xyz
3
print 0 2
replace 0 2 abc
print 0 2

Sample Output 2

xyz
abc


import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		try (Scanner sc = new Scanner(System.in)) {
			StringBuilder str = new StringBuilder();
			int n = sc.nextInt();
			for(int i = 1; i < n + 1; i++) {
				str.append(i);
			}
			permutation(str.toString(),"");
		}
	}
	public static void permutation(String q, String ans){
		if(q.length() <= 1) {
			for(char output : ans.toCharArray()) {
				System.out.print(output + " ");
			}
			System.out.println(q);
		}
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1), ans + q.charAt(i));
			}
		}
	}
}

Permutation Enumeration

For given an integer $n$, print all permutations of $\{1, 2, ..., n\}$ in lexicographic order.

Input

An integer $n$ is given in a line.

Output

Print each permutation in a line in order. Separate adjacency elements by a space character.

Constraints

$1 \leq n \leq 9$

Sample Input 1

2

Sample Output 1

1 2
2 1

Sample Input 2

3

Sample Output 2

1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1


import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AOJ problem = new AOJ(sc);
        problem.solve(out);

        out.flush();
    }

}

class AOJ {

    final int m, n, mod;

    AOJ(FastScanner sc) {
        m = sc.nextInt();
        n = sc.nextInt();
        mod = (int) 1e9 + 7;
    }

    void solve(PrintWriter out) {
        out.println(pow(m, n));
    }

    long pow(long x, long n) {
        if (n == 0) return 1;
        long res = pow(x * x % mod, n / 2);
        if (n % 2 == 1) res = res * x % mod;
        return res;
    }
}

class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int[] arrayInt(int N) {
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = nextInt();
        }
        return array;
    }

    public long[] arrayLong(int N) {
        long[] array = new long[N];
        for (int i = 0; i < N; i++) {
            array[i] = nextLong();
        }
        return array;
    }

    public double[] arrayDouble(int N) {
        double[] array = new double[N];
        for (int i = 0; i < N; i++) {
            array[i] = nextDouble();
        }
        return array;
    }

    public String[] arrayString(int N) {
        String[] array = new String[N];
        for (int i = 0; i < N; i++) {
            array[i] = next();
        }
        return array;
    }

}

Power

For given integers m and n, compute mn (mod 1,000,000,007). Here, A (mod M) is the remainder when A is divided by M.

Input

m n

Two integers m and n are given in a line.

Output

Print mn (mod 1,000,000,007) in a line.

Constraints

1 ≤ m ≤ 100

1 ≤ n ≤ 109

Sample Input 1

2 3

Sample Output 1

8

Sample Input 2

5 8

Sample Output 2

390625


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int k = sc.nextInt();

	    StringBuffer sb = new StringBuffer();
	    for (int i = 0; i < k; i++) {
	    	sb.append("ACL");
	    }

	    System.out.println(sb.toString());
	}

}

Score : 100 points

Problem Statement

You are given an integer K.
Print the string obtained by repeating the string ACL K times and concatenating them.

For example, if K = 3, print ACLACLACL.

Constraints

1 \leq K \leq 5

All values in input are integers.

Input

Input is given from Standard Input in the following format:

K

Output

Print the string obtained by repeating the string ACL K times and concatenating them.

Sample Input 1

3

Sample Output 1

ACLACLACL


import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {

	public static final long MOD = 998244353;

	public static long mod_inv(long a, long m){
		return (a == 1 ? 1 : (1 - m*mod_inv(m%a, a)) / a + m);
	}

	public static long[] fact_10_memo;
	public static long[][] suc_lazy_memo;

	public static class LazySetSumSegmentTree {
		int n;
		long[] dat, lazy;
		boolean[] push;

		public LazySetSumSegmentTree(int n_) {
			int n = 1;
			while(n < n_){ n *= 2; }
			this.n = n;
			dat = new long[this.n * 2 - 1];
			lazy = new long[this.n * 2 - 1];
			push = new boolean[this.n * 2 - 1];
		}

		private void evaluate_lazy(int k, int l, int r) {
			if(!push[k]){
				return;
			}
			dat[k] = suc_lazy_memo[(int)(lazy[k])][(r - l)];
			if(k < n - 1){
				lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
				push[k * 2 + 1] = push[k * 2 + 2] = true;
			}
			lazy[k] = 0;
			push[k] = false;
		}

		private void update_node(int k, int l, int r) {
			dat[k] = (((dat[k * 2 + 1] * fact_10_memo[(r - l) / 2]) % MOD) + (dat[k * 2 + 2])) % MOD;
		}

		public void set(long v, int a, int b) {
			set(v, a, b, 0, 0, this.n);
		}

		public void set(long v, int a, int b, int k, int l, int r) {
			evaluate_lazy(k, l, r);
			if(r <= a || b <= l){
				return;
			}else if(a <= l && r <= b){
				lazy[k] = v;
				push[k] = true;
				evaluate_lazy(k, l, r);
			}else{
				set(v, a, b, k * 2 + 1, l, (l + r) / 2);
				set(v, a, b, k * 2 + 2, (l + r) / 2, r);
				update_node(k, l, r);
			}
		}

		public long sum(int a, int b) {
			return sum(a, b, 0, 0, this.n);
		}

		public long sum(int a, int b, int k, int l, int r) {
			evaluate_lazy(k, l, r);
			if(r <= a || b <= l){
				return 0;
			}else if(a <= l && r <= b){
				return dat[k];
			}else{
				final long v1 = sum(a, b, k * 2 + 1, l, (l + r) / 2);
				final long v2 = sum(a, b, k * 2 + 2, (l + r) / 2, r);
				update_node(k, l, r);
				return ((v1 * fact_10_memo[(r - l) / 2] % MOD) + v2) % MOD;
			}
		}
	}

	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			final int Q = sc.nextInt();

			LazySetSumSegmentTree seg = new LazySetSumSegmentTree(N);
			final int size_diff = seg.n - N;

			fact_10_memo = new long[seg.n + 1];
			fact_10_memo[0] = 1;
			for(int i = 0; i < seg.n; i++) {
				fact_10_memo[i + 1] = (fact_10_memo[i] * 10) % MOD;
			}

			suc_lazy_memo = new long[10][seg.n + 1];
			for(int i = 0; i < 10; i++) {
				suc_lazy_memo[i][0] = 0;
				for(int j = 0; j < seg.n; j++) {
					suc_lazy_memo[i][j + 1] = (suc_lazy_memo[i][j] * 10 + i) % MOD;
				}
			}

			seg.set(1, 0, N);
			//System.out.println(seg.sum(0, N) * mod_inv(mod_pow(10, size_diff, MOD), MOD) % MOD);

			final long mod_size_diff = mod_inv(fact_10_memo[size_diff], MOD);

			PrintWriter out = new PrintWriter(System.out);
			for(int q = 0; q < Q; q++) {
				final int l = sc.nextInt() - 1;
				final int r = sc.nextInt() - 1;
				final int D = sc.nextInt();
				seg.set(D, l, r + 1);

				out.println(seg.sum(0, N) * mod_size_diff % MOD);
			}

			out.flush();

		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Score : 500 points

Problem Statement

You have a string S of length N.
Initially, all characters in S are 1s.

You will perform queries Q times.
In the i-th query, you are given two integers L_i, R_i and a character D_i (which is a digit).
Then, you must replace all characters from the L_i-th to the R_i-th (inclusive) with D_i.

After each query, read the string S as a decimal integer, and print its value modulo 998,244,353.

Constraints

1 \leq N, Q \leq 200,000

1 \leq L_i \leq R_i \leq N

1 \leq D_i \leq 9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N Q
L_1 R_1 D_1
:
L_Q R_Q D_Q

Output

Print Q lines.
In the i-th line print the value of S after the i-th query, modulo 998,244,353.

Sample Input 1

8 5
3 6 2
1 4 7
3 8 3
2 2 2
4 5 1

Sample Output 1

11222211
77772211
77333333
72333333
72311333

Sample Input 2

200000 1
123 456 7

Sample Output 2

641437905

Don't forget to take the modulo.


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.next();
        scanner.close();

        if(input.endsWith("s")){
            System.out.println(input + "es");
        }else{
            System.out.println(input+"s");
        }

    }

}

Score : 100 points

Problem Statement

In the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.

In Taknese, the plural form of a noun is spelled based on the following rules:

If a noun's singular form does not end with s, append s to the end of the singular form.

If a noun's singular form ends with s, append es to the end of the singular form.

You are given the singular form S of a Taknese noun. Output its plural form.

Constraints

S is a string of length 1 between 1000, inclusive.

S contains only lowercase English letters.

Input

Input is given from Standard Input in the following format:

S

Output

Print the plural form of the given Taknese word.

Sample Input 1

apple

Sample Output 1

apples

apple ends with e, so its plural form is apples.

Sample Input 2

bus

Sample Output 2

buses

bus ends with s, so its plural form is buses.

Sample Input 3

box

Sample Output 3

boxs


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            }
            if (count >= 3) {
                flg = true;
                break;
            }
        }
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}

Score : 200 points

Problem Statement

Tak performed the following action N times: rolling two dice.
The result of the i-th roll is D_{i,1} and D_{i,2}.

Check if doublets occurred at least three times in a row.
Specifically, check if there exists at lease one i such that D_{i,1}=D_{i,2}, D_{i+1,1}=D_{i+1,2} and D_{i+2,1}=D_{i+2,2} hold.

Constraints

3 \leq N \leq 100

1\leq D_{i,j} \leq 6

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
D_{1,1} D_{1,2}
\vdots
D_{N,1} D_{N,2}

Output

Print Yes if doublets occurred at least three times in a row. Print No otherwise.

Sample Input 1

5
1 2
6 6
4 4
3 3
3 2

Sample Output 1

Yes

From the second roll to the fourth roll, three doublets occurred in a row.

Sample Input 2

5
1 1
2 2
3 4
5 5
6 6

Sample Output 2

No

Sample Input 3

6
1 1
2 2
3 3
4 4
5 5
6 6

Sample Output 3

Yes


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
	    int  n =fs.nextInt();
	    int count=0;
	    boolean present=false;
	    while(n-->0) {
	    	 int si=fs.nextInt();
	    	 int ei =fs.nextInt();
	    	 if(si==ei) {
	    		 count++;
	    	 }
	    	 if(count==3) {
	    		 present=true;
	    	 }
	    	 if(si!=ei) {
	    		 count=0;
	    	 }
	    }
	  if(present)System.out.println("Yes");
	  else System.out.println("No");
	}
	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for(int i:a) l.add(i);
		Collections.sort(l);
		for(int i=0;i<l.size();i++) a[i]=l.get(i);
	}
	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a = new int[n];
			for(int i=0;i<n;i++)a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


import java.util.*;
import java.util.Scanner;
import java.io.*;
import javax.lang.model.util.ElementScanner6;

public class Main
{

    public static void main(String args[])
    {

        FastReader in=new FastReader();
        PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int t=1;

        //t=in.nextInt();
        while(t-->0)
        {
           int n=in.nextInt();
           if(n==1)pr.println(0);

           else pr.println(1);

        }
        pr.flush();
    }

    static int gcd(int a,int b)
    {

        if(a==0)
            return b;
        return gcd(a%b,b);
    }

    static int lcm(int a,int b)
    {
        return (a*b)/gcd(a,b);
    }

    static boolean prime[];

    static void sieveofe()
    {
        int n=1000000;

        prime=new boolean[n+1];
        Arrays.fill(prime,true);
        prime[1]=false;
        for(int i=2;i*i<=n;i++)
        {
            if(prime[i]==true)
            {
                for(int j=i*i;j<=n;j+=i)
                {
                    prime[j]=false;
                }
            }
        }

    }

    static void sort(long[] a) {
		ArrayList<Long> l = new ArrayList<>();
		for (long i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}

Score : 100 points

Problem Statement

Given is an integer x that is greater than or equal to 0, and less than or equal to 1.
Output 1 if x is equal to 0, or 0 if x is equal to 1.

Constraints

0 \leq x \leq 1

x is an integer

Input

Input is given from Standard Input in the following format:

x

Output

Print 1 if x is equal to 0, or 0 if x is equal to 1.

Sample Input 1

1

Sample Output 1

0

Sample Input 2

0

Sample Output 2

1


import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);

		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long d = sc.nextLong();

		long ans = 0;
		if(a < 0 && b <= 0 && c < 0 && d <= 0) {
			ans = a * c;
			System.out.print(ans);
		}else if(a < 0 && b <= 0) {
			if(c < 0) {
				ans = a * c;
				System.out.print(ans);
			}else{
				ans = b * c;
				System.out.print(ans);
			}
		}else if(c < 0 && d <= 0) {
			if(a < 0) {
				ans = a * c;
				System.out.print(ans);
			}else{
				ans = a * d;
				System.out.print(ans);
			}
		}else {
			ans = b * d;
			System.out.print(ans);
		}

		sc.close();
	}
}

Score : 200 points

Problem Statement

Given are integers a,b,c and d.
If x and y are integers and a \leq x \leq b and c\leq y \leq d hold, what is the maximum possible value of x \times y?

Constraints

-10^9 \leq a \leq b \leq 10^9

-10^9 \leq c \leq d \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

a b c d

Output

Print the answer.

Sample Input 1

1 2 1 1

Sample Output 1

2

If x = 1 and y = 1 then x \times y = 1.
If x = 2 and y = 1 then x \times y = 2.
Therefore, the answer is 2.

Sample Input 2

3 5 -4 -2

Sample Output 2

-6

The answer can be negative.

Sample Input 3

-1000000000 0 -1000000000 0

Sample Output 3

1000000000000000000


import java.util.Scanner;

/**
 * @author kep
 * @date 2020-09-14
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long ans = 0;
        long[] max = new long[4];
        long[] min = new long[4];
        for(int i = 0;i<4;i++){
            max[i] = Long.MIN_VALUE;
            min[i] = Long.MAX_VALUE;
        }
        for(int i = 0;i<n;i++){
            long x = scanner.nextLong();
            long y = scanner.nextLong();
            for(int j = 0;j<4;j++){
                long tmp_x = (j >> 1) == 1?-x:x;
                long tmp_y = (j & 1) == 1?-y:y;
                long tmp = tmp_x + tmp_y ;
                min[j] = Math.min(min[j],tmp);
                max[j] = Math.max(max[j],tmp);
                ans = Math.max(ans,max[j]-min[j]);
            }
        }
        System.out.println(ans);
    }
}

Score : 500 points

Problem Statement

There are N points on the 2D plane, i-th of which is located on (x_i, y_i).
There can be multiple points that share the same coordinate.
What is the maximum possible Manhattan distance between two distinct points?

Here, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq x_i,y_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
x_2 y_2
:
x_N y_N

Output

Print the answer.

Sample Input 1

3
1 1
2 4
3 2

Sample Output 1

4

The Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.

Sample Input 2

2
1 1
1 1

Sample Output 2

0


import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int num = Integer.parseInt(line);

        int[] xList = new int[num];
        int[] yList = new int[num];

        int[] xList2 = new int[2];
        int[] yList2 = new int[2];
        for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int x = Integer.parseInt(lines[0]);
            int y = Integer.parseInt(lines[1]);
            xList[i] = x;
            yList[i] = y;

            if (i < 2) {
                xList2[i] = x;
                yList2[i] = y;
            } else {
                int manO = manh(xList2[0], yList2[0], xList2[1], yList2[1]);
                int man1 = manh(xList2[0], yList2[0], x, y);
                int man2 = manh(xList2[1], yList2[1], x, y);
                if (man1 > manO && man1 > man2) {
                    xList2[1] = x;
                    yList2[1] = y;
                } else if (man2 > manO && man2 > man1) {
                    xList2[0] = x;
                    yList2[0] = y;
                }
            }
        }

        long min = Long.MAX_VALUE;
        int minNumber = 0;
        int minX = Integer.MAX_VALUE;
        int minXNumber = 0;
        int maxX = 0;
        int maxXNumber = 0;
        int minY = Integer.MAX_VALUE;
        int minYNumber = 0;
        int maxY = 0;
        int maxYNumber = 0;
        long max = 0;
        int maxNumber = 0;
        for (int i = 0; i < num; i++) {
            if (xList[i] + yList[i] > max) {
                max = xList[i] + yList[i];
                maxNumber = i;
            }
            if (xList[i] + yList[i] < min) {
                min = xList[i] + yList[i];
                minNumber = i;
            }
            if (xList[i] > maxX) {
                maxX = xList[i];
                maxXNumber = i;
            }
            if (xList[i] < minX) {
                minX = xList[i];
                minXNumber = i;
            }
            if (yList[i] > maxY) {
                maxY = yList[i];
                maxYNumber = i;
            }
            if (yList[i] < minY) {
                minY = yList[i];
                minYNumber = i;
            }
        }

        int[] ret = new int[30];
        int b = minNumber;
        ret[0] = Math.abs(xList[maxNumber] - xList[b]) + Math.abs(yList[maxNumber] - yList[b]);
        ret[1] = Math.abs(xList[maxXNumber] - xList[b]) + Math.abs(yList[maxXNumber] - yList[b]);
        ret[2] = Math.abs(xList[minXNumber] - xList[b]) + Math.abs(yList[minXNumber] - yList[b]);
        ret[3] = Math.abs(xList[maxYNumber] - xList[b]) + Math.abs(yList[maxYNumber] - yList[b]);
        ret[4] = Math.abs(xList[minYNumber] - xList[b]) + Math.abs(yList[minYNumber] - yList[b]);

        b = maxNumber;
        ret[5] = Math.abs(xList[minNumber] - xList[b]) + Math.abs(yList[minNumber] - yList[b]);
        ret[6] = Math.abs(xList[maxXNumber] - xList[b]) + Math.abs(yList[maxXNumber] - yList[b]);
        ret[7] = Math.abs(xList[minXNumber] - xList[b]) + Math.abs(yList[minXNumber] - yList[b]);
        ret[8] = Math.abs(xList[maxYNumber] - xList[b]) + Math.abs(yList[maxYNumber] - yList[b]);
        ret[9] = Math.abs(xList[minYNumber] - xList[b]) + Math.abs(yList[minYNumber] - yList[b]);

        b = maxXNumber;
        ret[10] = Math.abs(xList[minNumber] - xList[b]) + Math.abs(yList[minNumber] - yList[b]);
        ret[11] = Math.abs(xList[maxNumber] - xList[b]) + Math.abs(yList[maxNumber] - yList[b]);
        ret[12] = Math.abs(xList[minXNumber] - xList[b]) + Math.abs(yList[minXNumber] - yList[b]);
        ret[13] = Math.abs(xList[maxYNumber] - xList[b]) + Math.abs(yList[maxYNumber] - yList[b]);
        ret[14] = Math.abs(xList[minYNumber] - xList[b]) + Math.abs(yList[minYNumber] - yList[b]);

        b = minXNumber;
        ret[15] = Math.abs(xList[minNumber] - xList[b]) + Math.abs(yList[minNumber] - yList[b]);
        ret[16] = Math.abs(xList[maxNumber] - xList[b]) + Math.abs(yList[maxNumber] - yList[b]);
        ret[17] = Math.abs(xList[maxXNumber] - xList[b]) + Math.abs(yList[maxXNumber] - yList[b]);
        ret[18] = Math.abs(xList[maxYNumber] - xList[b]) + Math.abs(yList[maxYNumber] - yList[b]);
        ret[19] = Math.abs(xList[minYNumber] - xList[b]) + Math.abs(yList[minYNumber] - yList[b]);

        b = maxYNumber;
        ret[20] = Math.abs(xList[minNumber] - xList[b]) + Math.abs(yList[minNumber] - yList[b]);
        ret[21] = Math.abs(xList[maxNumber] - xList[b]) + Math.abs(yList[maxNumber] - yList[b]);
        ret[22] = Math.abs(xList[minXNumber] - xList[b]) + Math.abs(yList[minXNumber] - yList[b]);
        ret[23] = Math.abs(xList[maxXNumber] - xList[b]) + Math.abs(yList[maxXNumber] - yList[b]);
        ret[24] = Math.abs(xList[minYNumber] - xList[b]) + Math.abs(yList[minYNumber] - yList[b]);

        b = minYNumber;
        ret[25] = Math.abs(xList[minNumber] - xList[b]) + Math.abs(yList[minNumber] - yList[b]);
        ret[26] = Math.abs(xList[maxNumber] - xList[b]) + Math.abs(yList[maxNumber] - yList[b]);
        ret[27] = Math.abs(xList[minXNumber] - xList[b]) + Math.abs(yList[minXNumber] - yList[b]);
        ret[28] = Math.abs(xList[maxYNumber] - xList[b]) + Math.abs(yList[maxYNumber] - yList[b]);
        ret[29] = Math.abs(xList[maxXNumber] - xList[b]) + Math.abs(yList[maxXNumber] - yList[b]);

        int result = 0;
        for (int i = 0; i < 30; i++) {
            if (ret[i] > result) {
                result = ret[i];
            }
        }
        int result2 = manh(xList2[0], yList2[0], xList2[1], yList2[1]);

        System.out.println(Math.max(result, result2));
    }

    public static int manh (int x1, int y1, int x2, int y2) {
        return Math.abs(x1 - x2) + Math.abs(y1 - y2);
    }
}


import java.util.*;
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int d = sc.nextInt();
        int t = sc.nextInt();
        int s = sc.nextInt();

        if (t >= d / s){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Score : 100 points

Problem Statement

Takahashi is meeting up with Aoki.

They have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.

Takahashi will leave his house now and go straight to the place at a speed of S meters per minute.

Will he arrive in time?

Constraints

1 \leq D \leq 10000

1 \leq T \leq 10000

1 \leq S \leq 10000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

D T S

Output

If Takahashi will reach the place in time, print Yes; otherwise, print No.

Sample Input 1

1000 15 80

Sample Output 1

Yes

It takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.

Sample Input 2

2000 20 100

Sample Output 2

Yes

It takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.

Sample Input 3

10000 1 1

Sample Output 3

No

He will be late.


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	 static class FastReader
	    {
	        BufferedReader br;
	        StringTokenizer st;

	        public FastReader()
	        {
	            br = new BufferedReader(new
	                     InputStreamReader(System.in));
	        }

	        String next()
	        {
	            while (st == null || !st.hasMoreElements())
	            {
	                try
	                {
	                    st = new StringTokenizer(br.readLine());
	                }
	                catch (IOException  e)
	                {
	                    e.printStackTrace();
	                }
	            }
	            return st.nextToken();
	        }

	        int nextInt()
	        {
	            return Integer.parseInt(next());
	        }

	        long nextLong()
	        {
	            return Long.parseLong(next());
	        }

	        double nextDouble()
	        {
	            return Double.parseDouble(next());
	        }

	        String nextLine()
	        {
	            String str = "";
	            try
	            {
	                str = br.readLine();
	            }
	            catch (IOException e)
	            {
	                e.printStackTrace();
	            }
	            return str;
	        }
	    }
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		FastReader sc = new FastReader();
		double d = sc.nextDouble();
		double t = sc.nextDouble();
		double s = sc.nextInt();

		if(s!=0)
		{
		if(d/s <= t )
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
		}
		else
		{
			System.out.println("No");
		}
	}

}


import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int d = sc.nextInt();
	    int t = sc.nextInt();
	    int s = sc.nextInt();

	    if (Math.ceil(d / s) <= t) {
	    	System.out.println("Yes");
	    } else {
	    	System.out.println("No");
	    }
	}
}


import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double d = sc.nextDouble();
		double t = sc.nextDouble();
		double s = sc.nextDouble();

		if(d / s <= t)
		System.out.println("Yes");
		else
		System.out.println("No");
	}
}


import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int D = Integer.parseInt(tokens[0]);
		int T = Integer.parseInt(tokens[1]);
		int S = Integer.parseInt(tokens[2]);
		if (T * S >= D) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	void calc() {
	}

	void showResult() {
	}
}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main {
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[1_000_010]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
    void solve(Reader sc, PrintWriter pw) throws IOException {
        int H, W;
        H = sc.nextInt();
        W = sc.nextInt();
        int INF = H * W + 1;
        int[][] grid = new int[H + 1][W + 1];
        for (int i = 1; i < grid.length; i++) {
            Arrays.fill(grid[i], INF);
        }
        int[] begin = new int[W];
        int[] end = new int[W];
        for (int i = 0; i < H; i++) {
            begin[i] = sc.nextInt() - 1;
            end[i] = sc.nextInt() - 1;
        }
        int[] result = new int[H];
        for (int i = 0; i < H; i++) {
            int rowMin = INF;
            for (int j = 0; j < W; j++) {
                if (i > 0) {
                    rowMin = Math.min(rowMin, grid[i][j]);
                }
//                System.out.print(grid[i][j] + " ");
                if (grid[i][j] == INF) {
                    continue;
                }
                grid[i][j + 1] = Math.min(grid[i][j + 1], grid[i][j] + 1);
                if (j < begin[i] || j > end[i]) {
                    grid[i + 1][j] = Math.min(grid[i + 1][j], grid[i][j] + 1);
                }
            }
//            System.out.println();
            if (i > 0)
            pw.println( rowMin == INF ? -1 : rowMin);
        }
        pw.println(-1);
    }
    public static void main(String[] args) throws IOException {
        Reader sc = new Reader();
        PrintWriter pw = new PrintWriter(System.out);
//        PrintWriter pw = new PrintWriter(System.out, true);
        new Main().solve(sc, pw);
        pw.flush();
        pw.close();
        sc.close();
    }
}

Score : 600 points

Problem Statement

There is a grid of squares with H+1 horizontal rows and W vertical columns.

You will start at one of the squares in the top row and repeat moving one square right or down. However, for each integer i from 1 through H, you cannot move down from the A_i-th, (A_i + 1)-th, \ldots, B_i-th squares from the left in the i-th row from the top.

For each integer k from 1 through H, find the minimum number of moves needed to reach one of the squares in the (k+1)-th row from the top. (The starting square can be chosen individually for each case.) If, starting from any square in the top row, none of the squares in the (k+1)-th row can be reached, print -1 instead.

Constraints

1 \leq H,W \leq 2\times 10^5

1 \leq A_i \leq B_i \leq W

Input

Input is given from Standard Input in the following format:

H W
A_1 B_1
A_2 B_2
:
A_H B_H

Output

Print H lines. The i-th line should contain the answer for the case k=i.

Sample Input 1

4 4
2 4
1 1
2 3
2 4

Sample Output 1

1
3
6
-1

Let (i,j) denote the square at the i-th row from the top and j-th column from the left.

For k=1, we need one move such as (1,1) → (2,1).

For k=2, we need three moves such as (1,1) → (2,1) → (2,2) → (3,2).

For k=3, we need six moves such as (1,1) → (2,1) → (2,2) → (3,2) → (3,3) → (3,4) → (4,4).

For k=4, it is impossible to reach any square in the fifth row from the top.


import java.io.*;
import java.util.*;

public class Main{
	static int inf=(int)1e9;
	static class segmentTree {
		long[][]sTree;
		long[]lazy;
		int N;
		int max;
		public segmentTree(int n) {//in array is 1-based array
			max=n-1;
			N=1;
			while(N<n) {
				N<<=1;
			}
			sTree=new long[N<<1][2];
			for(int i=1;i<sTree.length;i++) {
				sTree[i]=new long[] {inf,inf};
			}
			int i=N;
			int idx=1;
			while(i<sTree.length) {
				sTree[i++]=new long[] {0,idx++};
			}
			lazy=new long[N<<1];
		}
		long[] query(int left,int right) {
			return query(1, 1, N, left, right);
		}
		long[] query(int node,int curLeft,int curRight,int left,int right) {
			if(curLeft>right || curRight<left)return new long[] {inf,inf};//the value that won't affect the required operation

			if(curLeft>=left && curRight<=right) {
				return sTree[node];
			}
			int mid=(curLeft+curRight)>>1;
			int leftChild=node<<1,rightChild=node<<1|1;
			propagate(node, curLeft, mid, curRight);
			long[] q1=query(leftChild, curLeft, mid, left, right);
			long[] q2=query(rightChild, mid+1, curRight, left, right);

			if(q1[0]+q1[1]>max && q2[0]+q2[1]>max) {
				return new long[] {inf,inf};
			}
			else {
				if(q1[0]+q1[1]>max) {
					return q2;
				}
				else {
					if(q2[0]+q2[1]>max) {
						return q1;
					}
				}
			}
			if(q1[0]<q2[0] || (q1[0]==q2[0] && q1[1]<q2[1])) {
				return q1;
			}
			return q2;
		}
		long[] query_point(int i){
			return query_point(1,1,N,i);
		}

		long[] query_point(int node,int curLeft,int curRight,int idx){

			if(curLeft==curRight) {
				return sTree[node];
			}
			int mid=(curLeft+curRight)>>1;
			int leftChild=node<<1,rightChild=node<<1|1;
			propagate(node, curLeft, mid, curRight);
			if(idx<=mid) {
				return query_point(leftChild, curLeft, mid,idx);
			}
			return query_point(rightChild, mid+1, curRight,idx);

		}

		void update_range(int i, int j, int val){
			update_range(1,1,N,i,j,val);
		}

		void update_range(int node,int curLeft,int curRight,int left,int right,int val) {
			if(curLeft>right || curRight<left)return;

			if(curLeft>=left && curRight<=right) {
				sTree[node][0] += val;
				lazy[node] += val;
				return;
			}
			int mid=(curLeft+curRight)>>1;
			int leftChild=node<<1,rightChild=node<<1|1;
			propagate(node, curLeft, mid, curRight);
			update_range(leftChild, curLeft, mid, left, right,val);
			update_range(rightChild, mid+1, curRight, left, right,val);

			if(sTree[leftChild][0]+sTree[leftChild][1]>max && sTree[rightChild][0]+sTree[rightChild][1]>max) {
				sTree[node]=new long[] {inf,inf};
				return;
			}
			else {
				if(sTree[leftChild][0]+sTree[leftChild][1]>max) {
					sTree[node]=sTree[rightChild];
					return;
				}
				else {
					if(sTree[rightChild][0]+sTree[rightChild][1]>max) {
						sTree[node]=sTree[leftChild];
						return;
					}
				}
			}

			if(sTree[leftChild][0]<sTree[rightChild][0] || (sTree[leftChild][0]==sTree[rightChild][0] && sTree[leftChild][1]<sTree[rightChild][1])) {
				sTree[node]=sTree[leftChild];
			}
			else
				sTree[node]=sTree[rightChild];

		}

		void update_Point(int i, int val){
			update_Point(1,1,N,i,val);
		}

		void update_Point(int node,int curLeft,int curRight,int idx,int val) {
			if(curLeft==curRight) {
				sTree[node][0] += val;
				lazy[node] += val;
				return;
			}
			int mid=(curLeft+curRight)>>1;
			int leftChild=node<<1,rightChild=node<<1|1;
			propagate(node, curLeft, mid, curRight);
			if(idx<=mid)
				update_Point(leftChild, curLeft, mid, idx, val);
			else
				update_Point(rightChild, mid+1, curRight, idx ,val);

			if(sTree[leftChild][0]+sTree[leftChild][1]>max && sTree[rightChild][0]+sTree[rightChild][1]>max) {
				sTree[node]=new long[] {inf,inf};
				return;
			}
			else {
				if(sTree[leftChild][0]+sTree[leftChild][1]>max) {
					sTree[node]=sTree[rightChild];
					return;
				}
				else {
					if(sTree[rightChild][0]+sTree[rightChild][1]>max) {
						sTree[node]=sTree[leftChild];
						return;
					}
				}
			}

		}
		void propagate(int node, int b, int mid, int e){
			lazy[node<<1] += lazy[node];
			lazy[node<<1|1] += lazy[node];
			sTree[node<<1][0] += lazy[node];
			sTree[node<<1|1][0] += lazy[node];
			lazy[node] = 0;//the value that won't affect the required operation
		}

	}
	static void main() throws Exception{
		int n=sc.nextInt(),m=sc.nextInt();
		segmentTree st=new segmentTree(m+1);
		int[]assign=new int[m+2];
		for(int i=1;i<=m;i++) {
			assign[i]=i;
		}
		for(int i=1;i<=n;i++) {
			int a=sc.nextInt(),b=sc.nextInt();
			int left=a,right=b-1;
			if(left<=right) {
				st.update_range(left, right, inf);
			}
			left=assign[a];right=a-1;
			if(left<=right) {
//				System.out.println(left+" "+right+" "+(b-a+1));
				st.update_range(left, right, b-a+1);
			}
			st.update_Point(b, 1);
			assign[b+1]=assign[b];
			long[]best=st.query(1, m);
//			System.out.println(Arrays.toString(best)+" "+Arrays.toString(st.query_point(1)));
			if(best[0]>=inf || best[0]+best[1]>m) {
				pw.println(-1);
			}
			else
				pw.println(i+best[0]);
		}
	}
	public static void main(String[] args) throws Exception{
		sc=new MScanner(System.in);
		pw = new PrintWriter(System.out);
		int tc=1;
//		tc=sc.nextInt();
		while(tc-->0)
			main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}


import java.util.*;
import java.io.*;
import java.text.*;

class Main{
    //SOLUTION BEGIN
    //Into the Hardware Mode
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int H = ni(), W = ni();
        int min = 1;
        for(int i = 2; i<= H+1; i++){
            int a = ni(), b = ni()+1;
            if(min >= a)min = Math.max(min, b);
            if(min > W)pn(-1);
            else pn(min+i-2);
        }
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}
    final long IINF = (long)1e17;
    final int INF = (int)1e9+2;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = false, memory = false, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        if (fileIO) {
            in = new FastReader("");
            out = new PrintWriter("");
        } else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //Solution Credits: Taranpreet Singh
        int T = multipleTC? ni():1;
        pre();
        for (int t = 1; t <= T; t++) solve(t);
        out.flush();
        out.close();
        System.err.println(System.currentTimeMillis() - ct);
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();System.exit(1);}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    int[][] make(int n, int e, int[] from, int[] to, boolean f){
        int[][] g = new int[n][];int[]cnt = new int[n];
        for(int i = 0; i< e; i++){
            cnt[from[i]]++;
            if(f)cnt[to[i]]++;
        }
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];
        for(int i = 0; i< e; i++){
            g[from[i]][--cnt[from[i]]] = to[i];
            if(f)g[to[i]][--cnt[to[i]]] = from[i];
        }
        return g;
    }
    int[][][] makeS(int n, int e, int[] from, int[] to, boolean f){
        int[][][] g = new int[n][][];int[]cnt = new int[n];
        for(int i = 0; i< e; i++){
            cnt[from[i]]++;
            if(f)cnt[to[i]]++;
        }
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];
        for(int i = 0; i< e; i++){
            g[from[i]][--cnt[from[i]]] = new int[]{to[i], i, 0};
            if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i, 1};
        }
        return g;
    }
    int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}
    int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object... o){for(Object oo:o)out.print(oo+" ");}
    void pn(Object... o){for(Object oo:o)out.print(oo+" ");out.println();}
    void pni(Object... o){for(Object oo:o)out.print(oo+" ");out.println();out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str;
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
 public class Main
 {
 	public static void main(String[]args)
 	{
 		Scanner sc=new Scanner (System.in);
 		int n=sc.nextInt();
 		int x=sc.nextInt();
 		int t=sc.nextInt();
 		System.out.println((n/x)*t);
 	}
 }

Score : 100 points

Problem Statement

Takahashi loves takoyaki - a ball-shaped snack.

With a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.

How long does it take to make N takoyaki?

Constraints

1 \leq N,X,T \leq 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N X T

Output

Print an integer representing the minimum number of minutes needed to make N pieces of takoyaki.

Sample Input 1

20 12 6

Sample Output 1

12

He can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.

Note that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.

Sample Input 2

1000 1 1000

Sample Output 2

1000000

It seems to take a long time to make this kind of takoyaki.


import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		int t = Integer.parseInt(sc.next());
		long time = 0;
		while(n > 0){
			n -= x;
			time += t;
		}
		System.out.println(time);
	}
}