Print
카테고리: [ Algorithm ]
조회수: 1985

1. 문제

https://www.acmicpc.net/problem/10091

맞는지 모르겠지만 한번 풀어봤네요.


2 코드

   public static void main(String[] args) {
        int pcCount = 10;

        int[] i1 = { 1, 3, 6, 7, 9 };
        int[] i2 = { 6, 7, 2, 100, 635 };

        for ( int y=0; y<i1.length; y++ ) {
            int result = 0;

            result = i1[y];

            for ( int z=1; z<i2[y]; z++) {
                result *= i1[y];
                result %= pcCount;
            }

            if ( result == 0 ) result = 10;

            System.out.println(i1[y] + " " + i2[y] + " -> " + result);
        }
    }