Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0240 - INTELLECT LTD |
Engineers working for Intellect Ltd. have proposed an innovative system to check the transfer of digital data. Only n-digit decimal numbers divisible by 11 are used during transfer. The system was implemented on a remote space station transferring data to Earth. Eventually, the mission control center received a message containing (n+1) digits. The analysis indicated that the message had an extra spurious digit.
Write a program that will process the message and determine the number of ways to exclude a single digit so that the resulting number would be divisible by 11.
Limitations
1 ≤ n ≤ 100 000.
Input
The first line of the input file defines the message length n.
The second line contains a decimal number having n+1 digits representing the mes- sage with an extra digit.
Output
The number of ways to exclude a single digit as described above.
Example
№ |
stdin |
stdout |
1 |
3 1352 |
2 |
2 |
2 222 |
3 |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2014-10-08 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE |
Աղբյուրը. | Central QF 2014.B |