Editorial for Hình tròn


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

\(\color{red}{\text{Spoiler Alert}_{{}_{{}^{{}^{v2.0}}}}}\)

\(\color{red}{\text{Khuyến khích bạn đọc trước khi đọc phần lời giải xin hãy thử code ra thuật của mình dù nó có sai hay đúng}}\)

\(\color{red}{\text{Sau đó từ phần bài giải và thuật toán trước đó mà đối chiếu, rút nhận xét với thuật của mình và thu được bài học (không lãng phí thời gian đâu).}}\)



\(\color{orange}{\text{Hint <Math>}}\)

  • Chu vi hình tròn: \(2 \times \times R \pi\)

  • Diện tích hình tròn: \(\pi^2 \times R\)


\(\color{green}{\text{Preference AC Code }}\): Math

\(^{^{\color{purple}{\text{Complexity : }} O(1)\ \color{purple}{\text{time}}\ ||\ O(1)\ \color{purple}{\text{memory}}}}\)

C++
const double PI = 3.14;
int main()
{  
    double R;
    cin >> R;
    cout << setprecision(1) << fixed << 2.0 * R * PI << '\n' << R * R * PI;
    return 0;
}


Comments

There are no comments at the moment.