IUHCoder Contest Round 1

Time limit: 2.0s / Memory limit: 64M

Points: 100

Problem Statement

As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: [five lowercase English letters],[seven lowercase English letters],[five lowercase English letters].
Dolphin wants to convert the comma-separated string s into a space-separated string.
Write a program to perform the conversion for him.

Constraints
  • The length of s is 19.
  • The sixth and fourteenth characters in s are ,.
  • The other characters in s are lowercase English letters.

Input

The input is given from Standard Input in the following format:

s
Output

Print the string after the conversion.


Sample Input 1
happy,newyear,enjoy
Sample Output 1
happy newyear enjoy

Replace all the commas in happy,newyear,enjoy with spaces to obtain happy newyear enjoy.


Sample Input 2
haiku,atcoder,tasks
Sample Output 2
haiku atcoder tasks

Sample Input 3
abcde,fghihgf,edcba
Sample Output 3
abcde fghihgf edcba

Time limit: 2.0s / Memory limit: 64M

Points: 100

Problem Statement

You are given two integers K and S.
Three variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.
How many different assignments of values to X, Y and Z are there such that X + Y + Z = S?

Constraints
  • 2≤K≤2500
  • 0≤S≤3K
  • K and S are integers.

Input

The input is given from Standard Input in the following format:

K S
Output

Print the number of the triples of X, Y and Z that satisfy the condition.


Sample Input 1
2 2
Sample Output 1
6

There are six triples of X, Y and Z that satisfy the condition:

  • X = 0, Y = 0, Z = 2
  • X = 0, Y = 2, Z = 0
  • X = 2, Y = 0, Z = 0
  • X = 0, Y = 1, Z = 1
  • X = 1, Y = 0, Z = 1
  • X = 1, Y = 1, Z = 0

Sample Input 2
5 15
Sample Output 2
1

The maximum value of X + Y + Z is 15, achieved by one triple of X, Y and Z.


Time limit: 2.0s / Memory limit: 64M

Points: 100

Problem Statement

You are given an integer N.
For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.
For example, F(3,11) = 2 since 3 has one digit and 11 has two digits.
Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A ~\times~ B.

Constraints
  • 1 ~\leq~ N ~\leq~ ~10^{10}~
  • N is an integer.

Input

The input is given from Standard Input in the following format:

N
Output

Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A ~\times~ B.


Sample Input 1
10000
Sample Output 1
3

F(A,B) has a minimum value of 3 at (A,B)=(100,100).


Sample Input 2
1000003
Sample Output 2
7

There are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.


Sample Input 3
9876543210
Sample Output 3
6

Time limit: 2.0s / Memory limit: 64M

Points: 100

Mô tả vấn đề

Là một nhà trộn kem tài năng TranLoc đang lên kế hoạch để trộn ra một lượng nhỏ hóa chất C.
Để tạo ra hóa chất C, Lộc cần phải trộn hai hóa chất là A và B theo tỉ lệ thể tích là ~M_a:M_b~.
Thật may mắn là Lộc không có bất kì hóa chất nào trong tay. Nhưng vì đam mê anh ấy đã quyết định sang tiệm thuốc rần nhà để mua một số hóa chất Hiệu thuốc bán N loại hóa chất. Đối với mỗi loại hóa chất, có đúng một gói hóa chất đó trong kho. Gói hóa chất i chứa ~a_i~ grams hóa chất A và ~b_i~ grams hóa chất B, và được bán với ~c_i~ H3.2coin (đồng tiền quyền lực tại lab h3.2).
TranLoc sẽ mua một số gói này. Vì một lý do nào đó, anh ta phải sử dụng tất cả các gói đã mua để tạo ra chất C. Tìm số tiền tối thiểu cần thiết để tạo ra chất C. Nếu không thể tạo ra chất C bằng cách mua bất kỳ gói kết hợp nào ở hiệu thuốc, hãy in ra -1.

Sample Input 1
3 1 1
1 2 1
2 1 2
3 3 10
Sample Output 1
3

Số tiền chi tiêu sẽ được giảm thiểu khi mua gói hóa chất 1 và 2. Trong trường hợp này, hỗn hợp các hóa chất đã mua sẽ gồm 3 gam chất A và 3 gam chất B theo tỉ lệ mong muốn: 3: 3 = 1: 1. Tổng giá của các gói này là 3 H3.2coin.


Sample Input 2
1 1 10
10 10 10
Sample Output 2
-1

Tỷ lệ 1:10 của hai chất A và B không thể được thỏa mãn bằng cách mua bất kỳ sự kết hợp nào của các gói. Do đó, đầu ra phải là -1.