結果

問題 No.403 2^2^2
ユーザー watarimaycry2watarimaycry2
提出日時 2020-03-30 20:35:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,991 bytes
コンパイル時間 2,398 ms
コンパイル使用メモリ 76,000 KB
実行使用メモリ 59,124 KB
最終ジャッジ日時 2023-09-05 06:01:16
合計ジャッジ時間 9,849 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
56,808 KB
testcase_01 AC 182 ms
57,300 KB
testcase_02 AC 178 ms
56,840 KB
testcase_03 AC 182 ms
57,116 KB
testcase_04 AC 179 ms
57,100 KB
testcase_05 AC 179 ms
56,876 KB
testcase_06 AC 178 ms
56,888 KB
testcase_07 AC 180 ms
56,988 KB
testcase_08 AC 179 ms
56,980 KB
testcase_09 AC 177 ms
54,888 KB
testcase_10 AC 181 ms
56,856 KB
testcase_11 AC 178 ms
56,980 KB
testcase_12 AC 180 ms
58,852 KB
testcase_13 AC 180 ms
56,928 KB
testcase_14 AC 177 ms
56,816 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 176 ms
57,140 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 184 ms
56,996 KB
testcase_23 AC 179 ms
57,024 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 180 ms
57,188 KB
testcase_27 AC 180 ms
56,912 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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 A = Long.parseLong(strA);
          long B = Long.parseLong(strB);
          long C = Long.parseLong(strC);
          long mod = 1000000007;
          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