포럼
문제 ICPC00366

A. Accidental Arithmetic

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

shadows

It is the 25th of January, 2025. You are working on your final report for the statistics class. However, when you enter the calculations into your trusted Brittle Arithmetic Portable Calculator, you notice that the + and - buttons have malfunctioned. Whenever you press a numeric button (a button from 0 through 9 ), an additional button press may be registered immediately after: either the + button, or the - button, or neither (but never both). "Ugh," you think to yourself, "why did I not buy a Backup Arithmetic Portable Calculator..." But then you get an idea to save yourself from getting a low grade.

After some experimentation, you statistically determined that pressing a numeric button results in an additional + input \(45\%\) of the time, and the same holds for the - button (and never both at the same time). You decide that you should write your report about your findings. In addition to statistical analysis, the teacher requires you to perform some probabilistic predictions based on a statistical model. You decide to investigate what your calculator does when you try to simply input a natural number.

Given a natural number \(n\), you consider entering the number into the calculator by pressing the numeric buttons corresponding to the standard base \(10\) representation of \(n\). The calculator may register a + or - button press in between the digits of \(n\), which results in an arithmetic expression. You wonder what happens if you press = to evaluate the expression. Luckily, if your expression ends with a + or - , the calculator ignores this, such that this evaluation always results in an integer. To finish your report, you decide to write a program that determines the expected value of this result for any given value of \(n\).

제약
입력 형식

The input consists of:
- One line with an integer \(n\) (\(0 \leq n < 10^{1000}\)), the number that you will enter into the calculator.

출력 형식

Output the expected value of the result.

Your answer should have an absolute or relative error of at most \(10^{-6}\).

예제 1
입력
12345
출력
5.4321
예제 2
입력
777777
출력
42
예제 3
입력
31415926535897932384626433832795028841971693993751
출력
141.5189
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC BAPC 2025

평가 및 의견

A. Accidental Arithmetic

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

A. Accidental Arithmetic

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8