結果

問題 No.403 2^2^2
ユーザー watarimaycry2watarimaycry2
提出日時 2020-03-30 20:35:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,020 bytes
コンパイル時間 3,615 ms
コンパイル使用メモリ 81,556 KB
実行使用メモリ 58,976 KB
最終ジャッジ日時 2023-09-05 06:02:29
合計ジャッジ時間 9,851 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 180 ms
56,668 KB
testcase_01 AC 176 ms
56,916 KB
testcase_02 AC 179 ms
57,164 KB
testcase_03 AC 181 ms
56,848 KB
testcase_04 AC 180 ms
56,720 KB
testcase_05 AC 178 ms
56,684 KB
testcase_06 AC 177 ms
57,068 KB
testcase_07 AC 178 ms
57,244 KB
testcase_08 AC 178 ms
56,944 KB
testcase_09 AC 181 ms
56,840 KB
testcase_10 AC 181 ms
56,772 KB
testcase_11 AC 178 ms
56,668 KB
testcase_12 AC 179 ms
56,912 KB
testcase_13 AC 181 ms
56,972 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 180 ms
56,836 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 181 ms
56,972 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 181 ms
56,932 KB
testcase_23 AC 181 ms
56,840 KB
testcase_24 WA -
testcase_25 AC 181 ms
58,908 KB
testcase_26 AC 181 ms
56,732 KB
testcase_27 AC 181 ms
54,936 KB
testcase_28 WA -
testcase_29 AC 182 ms
56,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean hasNext(){return sc.hasNext();}
        static char[] mySplit(String str){return str.toCharArray();}
        public static void main(String[] args){
          char[] tmp = mySplit(getStr());
          String strA = "";
          String strB = "";
          String strC = "";
          boolean accessA = false;
          boolean accessB = false;
          for(int i = 0; i < tmp.length; i++){
            if(!accessA){
              if(tmp[i] != '^'){
                strA += tmp[i];
              }else{
                accessA = true;
              }
            }else if(!accessB){
              if(tmp[i] != '^'){
                strB += tmp[i];
              }else{
                accessB = true;
              }
            }else{
              strC += tmp[i];
            }
          }
          long mod = 1000000007;
          long A = Long.parseLong(strA) % mod;
          long B = Long.parseLong(strB) % mod;
          long C = Long.parseLong(strC) % mod;
          
          myout(originPow(originPow(A,B,mod),C,mod) + " " + originPow(A,originPow(B,C,mod - 1),mod));
        }
        //Method addition frame start
static long originPow(long x, long n) {return originPow(x,n,-1);}
static long originPow(long x, long n, long m) {
        long ans = 1;
        while (n > 0) {
                if ((n & 1) == 1){
                  ans = ans * x;
                  if(m != -1){ans %= m;}
                }
                x = x * x;
                if(m != -1){x %= m;}
                n >>= 1;
        }
        return ans;
}
        //Method addition frame end
}
0