ENG
RUS
Timus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board
Discussion of Problem
1716
. Alternative Solution
O(1)
Posted by
zwqzwq
23 Aug 2021 08:52
a is the number of NO ; b is the number of YES
ans=a/n+(n-1)*(a/n)*(b/(n-1))+(n-1)*(b/n)*(a/(n-1))
=a/n+2ab/n
=a*(1+2b)/n
© 2000–2024
Timus Online Judge Team
. All rights reserved.