結果

問題 No.747 循環小数N桁目 Hard
ユーザー nuhehe130
提出日時 2018-10-30 22:47:26
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,074 bytes
コンパイル時間 4,848 ms
コンパイル使用メモリ 74,452 KB
実行使用メモリ 43,896 KB
最終ジャッジ日時 2024-11-19 10:57:02
合計ジャッジ時間 30,086 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2 RE * 2
other WA * 24 RE * 96
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class test {
	public static void main(String[] args) {
//		Scanner s = new Scanner(System.in);
//		String string = s.nextLine();
//		
//		char c[] = string.toCharArray();
//		
//		if (c.length % 2 == 0) {
//			for (int i = 0; i < c.length / 2; i++) {		
//				if (c[i] != c[i + c.length / 2]) {
//					System.out.println("NO");
//					break;
//				}
//				else if (i <= c.length / 2) {
//					System.out.println("YES");
//				}
//			}
//		}
//		else {
//			System.out.println("NO");
//		}
//
//		
////		System.out.println();
//		
//		s.close();
		
		
        Scanner scn = new Scanner(System.in);
        String str1 = scn.nextLine();
        String str2 = scn.nextLine();
        char chars[] = {4,2,8,5,7,1};
        
        int K = Integer.parseInt(str1);
        int N = Integer.parseInt(str2);
        
        int keta = 1;
        //NのK乗桁目
        for (int i = 0;i < K ;i++) {
            keta *= N;
        }
        
        keta %= 6;
        
        System.out.println(chars[keta]);
        scn.close();
        
		
	}
}
0