結果
問題 | No.1275 綺麗な式 |
ユーザー | 遭難者 |
提出日時 | 2020-10-18 20:00:51 |
言語 | Java21 (openjdk 21) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,009 bytes |
コンパイル時間 | 2,205 ms |
コンパイル使用メモリ | 74,628 KB |
実行使用メモリ | 57,716 KB |
最終ジャッジ日時 | 2023-09-28 13:19:11 |
合計ジャッジ時間 | 12,044 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 118 ms
56,128 KB |
testcase_01 | AC | 119 ms
56,180 KB |
testcase_02 | AC | 118 ms
56,352 KB |
testcase_03 | AC | 117 ms
55,648 KB |
testcase_04 | AC | 117 ms
55,924 KB |
testcase_05 | AC | 119 ms
55,548 KB |
testcase_06 | AC | 118 ms
55,848 KB |
testcase_07 | AC | 118 ms
56,912 KB |
testcase_08 | AC | 122 ms
55,752 KB |
testcase_09 | AC | 120 ms
55,900 KB |
testcase_10 | AC | 121 ms
55,928 KB |
testcase_11 | AC | 121 ms
55,668 KB |
testcase_12 | AC | 118 ms
55,948 KB |
testcase_13 | AC | 121 ms
55,880 KB |
testcase_14 | AC | 120 ms
56,244 KB |
testcase_15 | AC | 118 ms
55,884 KB |
testcase_16 | AC | 121 ms
55,996 KB |
testcase_17 | AC | 119 ms
55,700 KB |
testcase_18 | AC | 120 ms
55,880 KB |
testcase_19 | AC | 118 ms
55,804 KB |
testcase_20 | AC | 118 ms
55,680 KB |
testcase_21 | AC | 117 ms
55,868 KB |
testcase_22 | AC | 118 ms
55,600 KB |
testcase_23 | AC | 118 ms
56,144 KB |
testcase_24 | AC | 122 ms
55,728 KB |
testcase_25 | AC | 121 ms
55,668 KB |
testcase_26 | AC | 121 ms
55,728 KB |
testcase_27 | AC | 120 ms
55,612 KB |
testcase_28 | AC | 120 ms
55,704 KB |
testcase_29 | AC | 119 ms
55,796 KB |
testcase_30 | AC | 120 ms
55,540 KB |
testcase_31 | AC | 119 ms
55,720 KB |
testcase_32 | AC | 118 ms
55,812 KB |
testcase_33 | AC | 119 ms
55,828 KB |
testcase_34 | AC | 118 ms
55,904 KB |
testcase_35 | AC | 119 ms
55,812 KB |
testcase_36 | AC | 117 ms
56,312 KB |
testcase_37 | AC | 117 ms
56,168 KB |
testcase_38 | AC | 118 ms
55,380 KB |
testcase_39 | AC | 119 ms
55,404 KB |
testcase_40 | AC | 119 ms
55,780 KB |
testcase_41 | AC | 119 ms
54,048 KB |
testcase_42 | AC | 119 ms
56,228 KB |
testcase_43 | AC | 119 ms
55,752 KB |
testcase_44 | AC | 118 ms
55,528 KB |
testcase_45 | WA | - |
testcase_46 | AC | 120 ms
57,716 KB |
testcase_47 | AC | 121 ms
55,744 KB |
testcase_48 | AC | 119 ms
55,520 KB |
testcase_49 | AC | 120 ms
56,228 KB |
testcase_50 | AC | 117 ms
55,756 KB |
testcase_51 | AC | 117 ms
56,104 KB |
testcase_52 | AC | 120 ms
53,920 KB |
testcase_53 | AC | 120 ms
56,136 KB |
testcase_54 | AC | 116 ms
55,608 KB |
testcase_55 | AC | 120 ms
55,852 KB |
testcase_56 | AC | 120 ms
55,612 KB |
testcase_57 | AC | 121 ms
55,756 KB |
testcase_58 | AC | 118 ms
56,212 KB |
testcase_59 | AC | 123 ms
56,140 KB |
testcase_60 | AC | 121 ms
55,844 KB |
testcase_61 | AC | 121 ms
55,608 KB |
ソースコード
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter ou = new PrintWriter(System.out); int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); long n = Long.parseLong(sc.next()); if(n == 0) ou.println(2); else{ long x = 1; long y = 0; long z = 0; long w = 1; long p = 2 * a; p %= (long)(Math.pow(10 , 9) + 7); long q = b - (a * (long)a) % ((int)Math.pow(10 , 9) + 7); q %= Math.pow(10 , 9) + 7; long r = 1; long s = 0; n--; while(n != 0){ if((n & 1) == 1){ long xx = (x * p) % ((int)Math.pow(10 , 9) + 7) + (y * r) % ((int)Math.pow(10 , 9) + 7); xx %= Math.pow(10 , 9) + 7; long yy = (x * q) % ((int)Math.pow(10 , 9) + 7) + (y * s) % ((int)Math.pow(10 , 9) + 7); yy %= Math.pow(10 , 9) + 7; long zz = (z * p) % ((int)Math.pow(10 , 9) + 7) + (w * r) % ((int)Math.pow(10 , 9) + 7); zz %= Math.pow(10 , 9) + 7; long ww = (z * q) % ((int)Math.pow(10 , 9) + 7) + (w * s) % ((int)Math.pow(10 , 9) + 7); ww %= Math.pow(10 , 9) + 7; x = xx; y = yy; z = zz; w = ww; } long pp = (p * p) % ((int)Math.pow(10 , 9) + 7) + (q * r) % ((int)Math.pow(10 , 9) + 7); pp %= Math.pow(10 , 9) + 7; long qq = (p * q) % ((int)Math.pow(10 , 9) + 7) + (q * s) % ((int)Math.pow(10 , 9) + 7); qq %= Math.pow(10 , 9) + 7; long rr = (p * r) % ((int)Math.pow(10 , 9) + 7) + (r * s) % ((int)Math.pow(10 , 9) + 7); rr %= Math.pow(10 , 9) + 7; long ss = (r * q) % ((int)Math.pow(10 , 9) + 7) + (s * s) % ((int)Math.pow(10 , 9) + 7); ss %= Math.pow(10 , 9) + 7; p = pp; q = qq; r = rr; s = ss; n >>= 1; } x = (2 * (a * x) % ((int)Math.pow(10 , 9) + 7)) % ((int)Math.pow(10 , 9) + 7) + (2 * y) % ((int)Math.pow(10 , 9) + 7); x %= Math.pow(10 , 9) + 7; while(x < 0) x += Math.pow(10 , 9) + 7; ou.println(x); } ou.flush(); sc.close(); } }