結果

問題 No.403 2^2^2
ユーザー watarimaycry2watarimaycry2
提出日時 2020-03-30 20:32:58
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,987 bytes
コンパイル時間 4,778 ms
コンパイル使用メモリ 76,992 KB
実行使用メモリ 60,620 KB
最終ジャッジ日時 2023-09-05 05:56:06
合計ジャッジ時間 9,807 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
56,940 KB
testcase_01 AC 179 ms
57,068 KB
testcase_02 AC 177 ms
57,364 KB
testcase_03 AC 176 ms
57,140 KB
testcase_04 AC 180 ms
57,108 KB
testcase_05 AC 180 ms
56,916 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 179 ms
56,864 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 182 ms
56,716 KB
testcase_14 WA -
testcase_15 AC 181 ms
57,232 KB
testcase_16 AC 185 ms
57,036 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 181 ms
57,024 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 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),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