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 1295. Crazy Notions

Help me!
Posted by Arsenal911 (Samara) 18 Jul 2011 21:12
import java.util.*;
import java.math.*;

public class B1295
{
    public static void main (String [] args)
     {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
    BigInteger t1=BigInteger.valueOf(2).pow(n);
        BigInteger t2=BigInteger.valueOf(3).pow(n);
        BigInteger t3=BigInteger.valueOf(4).pow(n);
    BigInteger t=BigInteger.valueOf(0);
    t=t.add(t1);
    t=t.add(t2);
    t=t.add(t3);
    t=t.add(BigInteger.valueOf(1));
    BigInteger k=BigInteger.valueOf(0);
    while(t.mod(BigInteger.valueOf(10))==BigInteger.valueOf(0))
    {
        k=k.add(BigInteger.valueOf(1));
            t=t.divide(BigInteger.valueOf(10));
    }
    System.out.println(k);
    }
}

This program give AC

Edited by author 19.07.2011 12:09

Edited by author 19.07.2011 12:09