Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.math.*;
- import java.util.*;
- public class Main {
- public static void main(String[] a) throws Exception {
- Scanner s = new Scanner(new File("input.txt"));
- String t = s.next();
- int l = t.length(), i = l - 2;
- BigInteger p = BigInteger.ONE, c = p, n = p.subtract(p);
- PrintWriter o = new PrintWriter("output.txt");
- if (l == 1)
- n = p;
- else
- for (; i >= 0; --i) {
- if (t.charAt(i) == 48 || t.substring(i, i + 2).compareTo("33") > 0)
- n = c;
- else
- n = c.add(p);
- p = c;
- c = n;
- }
- o.println(n);
- o.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement