ENG  RUSTimus 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 1513. Lemon Tale

up to 10 lines of code, oeis.org shows you why it is dp after using some tests like 4 1,4 2, 4 3, 4 4 / simple task
Posted by esbybb 2 Dec 2016 03:15
Re: up to 10 lines of code, oeis.org shows you why it is dp after using some tests like 4 1,4 2, 4 3, 4 4 / simple task
Posted by esbybb 2 Dec 2016 03:16
        int f = sc.nextInt();
        int ff = sc.nextInt();
        int inx=0;
        for (int i=(int) Math.pow(2,f); i<Math.pow(2,f+1); i++) {
            String t=Integer.toBinaryString(i).replaceFirst("1","");
            System.out.println(t);
            int itn=0;
            for (char tt:t.toCharArray()) {
                if (tt=='1') itn++; else itn=0;
                if (itn>ff) break;
            }
            if (itn<=ff) inx++;
        }
        System.out.println(inx);