fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. double k = 1;
  7. while ( cin >> n ) {
  8. for ( int i = 366 - n; i <= 365; i++ ) {
  9. k = k * i;
  10. k = k / 365;
  11. }
  12. cout << fixed;
  13. cout.precision(8);
  14. cout << 100 * ( 1 - k ) << "%" << endl;
  15. k=1;
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 4368KB
stdin
399
stdout
100.00000000%