Kết quả 1 đến 1 của 1
Chủ đề: ai giúp em 2 bài này với
-
10-18-2015, 03:54 PM #1Junior Member
- Ngày tham gia
- Aug 2015
- Bài viết
- 0
ai giúp em 2 bài này với
Help me!!!
I want code...help me please!!!
Problem B: Mysterious Treasure
The planet of Nine Dragons is famous not only for its beautiful scene but also for the legend about the
secret treasures. As an astronaut, you have found an old map guiding you to the secret cave where the
treasures are hidden. Unfortunately, the door of the cave is locked and is only opened at certain times of
the day.
A day in this planet is very long as it has 10
9
minutes. The door of the cave is opened at the n
th
minutes
(from midnight) if n! = 1 ×2 ×… nis divisible by n
3
(i.e., n! mod n
3
= 0).
Given n, your task is to write a program to determine if the door of the cave is opened at the n
th
minute.
Input
The input file consists of several data sets. The first line of the input file contains the number of data
sets which is a positive integer and is not bigger than 20. The following lines describe the data sets.
Each data set consists of one line containing the integer n(1< n< 10
9
).
Output
For each data set write in one line “YES” if the door is opened at the given n
th
minute or “NO”
otherwise.
Sample Input Sample Output
2
6
12
NO
YES
Problem C: Prime Concatenation
Given two positive integers nand d, your task is to write a program to find the smallest positive integer
mwith at least 2ddigits, satisfying the following conditions:
• m≥ n
• mis a concatenation of two prime numbers, each number has at least ddigits.
For example, given d= 2, n= 1112, then the smallest mis 1113 which is the concatenation of two 2-digit primes 11 and 13.
Input
The input file consists of several data sets. The first line of the input file contains the number of data
sets which is a positive integer and is not bigger than 20. The following lines describe the data sets.
Each data set consists of one line containing two space-separated positive integers nand d(1≤ n≤ 10
9
và 1 ≤ d≤ 5).
Output
For each data set write in one line the desired number m.
Sample Input Sample Output
3
1112 2 1113
10 1 22
2011 2 2311View more random threads:
- Ai giúp mình bài quy hoạch động này với!!!
- Giải giúp em bài tập pascal
- Thuật toán tạo và tìm xâu đối xứng
- Tìm nhiều giá trị nhỏ nhất trong một mảng record Pascal
- Giải thích giúp mình thuật toán của bài này cho minh với( khó quá)
- Tham khảo ý kiến
- Giúp làm bài tập Pascal 11
- ai giúp em 2 bài này với
- Download Borland Pascal 7.0 Full Free win 7
- Vụ người nhà bức xúc vì sản phụ tử vong: Thông tin trái ngược về thỏa thuận bồi thường
Những sản phẩm được thanh lý và tái sử dụng không chỉ mang lại lợi ích kinh tế mà còn giúp tạo ra một môi trường sống xanh, sạch đẹp. Sự tiến bộ và phát triển của xã hội không đến mà không có những...
Tái sinh tài nguyên: Đóng góp của...