PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000051. Ước lượng số Pi từ các cặp nguyên tố cùng nhau (Pi)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Ước lượng số Pi từ các cặp nguyên tố cùng nhau (Pi)
Pi
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers, let be the number of index pairs with GCD , and let . If , print the prescribed failure message. Otherwise estimate $$\widehat\pi=\sqrt{\frac{6T}{C}}$$ and print exactly six decimal places.
Input
First line: . Second line: positive integers.
Output
Print the estimate with six digits after the decimal point, or No estimate for this data set..
Subtasks
- Subtask 1 (20 points): ;
- Subtask 2 (30 points): ;
- Subtask 3 (50 points): ;
Examples
Input
3
2 3 4
Output
3.000000
Explanation
There are pairs and coprime pairs, so the estimate is .