結果

問題 No.1184 Hà Nội
ユーザー RISE70226821
提出日時 2020-08-31 13:51:44
言語 Java
(openjdk 23)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 692 bytes
コンパイル時間 2,110 ms
コンパイル使用メモリ 73,936 KB
実行使用メモリ 41,816 KB
最終ジャッジ日時 2024-11-15 21:47:13
合計ジャッジ時間 7,331 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		// 入力
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long L = sc.nextLong();
		long DIV = 998244353L;
		
		// 計算
		long disc = N / L;
		if(N % L != 0){
			disc++;
		}
		
		long ope = myPow(2L, disc, DIV);
		ope--;
		
		// 出力
		System.out.println(ope);
	}
	
	public static long myPow(long x, long n, long m){
		if(n == 0){
			return 1;
		}
		if(n%2 == 0){
			return myPow(x * x % m, n/2, m);
		}else{
			return x * myPow(x, n-1, m) % m;
		}
	}
}
0