結果
問題 | No.491 10^9+1と回文 |
ユーザー | Grenache |
提出日時 | 2017-03-10 23:37:41 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,513 bytes |
コンパイル時間 | 4,014 ms |
コンパイル使用メモリ | 78,484 KB |
実行使用メモリ | 64,744 KB |
最終ジャッジ日時 | 2024-06-24 09:00:12 |
合計ジャッジ時間 | 35,190 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 265 ms
60,184 KB |
testcase_01 | AC | 266 ms
59,700 KB |
testcase_02 | AC | 268 ms
60,452 KB |
testcase_03 | WA | - |
testcase_04 | AC | 276 ms
60,232 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 274 ms
60,456 KB |
testcase_08 | AC | 269 ms
59,544 KB |
testcase_09 | AC | 265 ms
60,628 KB |
testcase_10 | AC | 266 ms
59,852 KB |
testcase_11 | AC | 268 ms
59,708 KB |
testcase_12 | AC | 305 ms
60,984 KB |
testcase_13 | AC | 263 ms
59,536 KB |
testcase_14 | AC | 270 ms
61,224 KB |
testcase_15 | AC | 268 ms
60,388 KB |
testcase_16 | AC | 268 ms
59,784 KB |
testcase_17 | AC | 267 ms
59,796 KB |
testcase_18 | AC | 270 ms
60,792 KB |
testcase_19 | AC | 265 ms
60,052 KB |
testcase_20 | AC | 262 ms
59,856 KB |
testcase_21 | AC | 267 ms
60,232 KB |
testcase_22 | MLE | - |
testcase_23 | AC | 265 ms
60,068 KB |
testcase_24 | AC | 258 ms
59,368 KB |
testcase_25 | AC | 267 ms
62,236 KB |
testcase_26 | AC | 278 ms
60,540 KB |
testcase_27 | AC | 263 ms
59,488 KB |
testcase_28 | AC | 267 ms
60,316 KB |
testcase_29 | AC | 275 ms
60,632 KB |
testcase_30 | AC | 268 ms
60,596 KB |
testcase_31 | AC | 265 ms
59,556 KB |
testcase_32 | AC | 281 ms
60,876 KB |
testcase_33 | AC | 269 ms
59,772 KB |
testcase_34 | AC | 278 ms
60,964 KB |
testcase_35 | AC | 284 ms
60,000 KB |
testcase_36 | AC | 267 ms
59,864 KB |
testcase_37 | AC | 260 ms
60,240 KB |
testcase_38 | AC | 260 ms
59,756 KB |
testcase_39 | AC | 280 ms
60,648 KB |
testcase_40 | AC | 267 ms
60,328 KB |
testcase_41 | AC | 277 ms
60,800 KB |
testcase_42 | AC | 271 ms
60,096 KB |
testcase_43 | AC | 275 ms
60,580 KB |
testcase_44 | AC | 261 ms
59,744 KB |
testcase_45 | AC | 267 ms
59,880 KB |
testcase_46 | AC | 266 ms
60,672 KB |
testcase_47 | AC | 265 ms
60,196 KB |
testcase_48 | AC | 264 ms
59,744 KB |
testcase_49 | AC | 272 ms
60,572 KB |
testcase_50 | AC | 267 ms
60,408 KB |
testcase_51 | AC | 280 ms
61,032 KB |
testcase_52 | AC | 263 ms
60,152 KB |
testcase_53 | AC | 263 ms
60,064 KB |
testcase_54 | AC | 273 ms
60,360 KB |
testcase_55 | AC | 273 ms
60,780 KB |
testcase_56 | AC | 266 ms
60,040 KB |
testcase_57 | AC | 268 ms
59,524 KB |
testcase_58 | AC | 270 ms
60,584 KB |
testcase_59 | AC | 264 ms
59,412 KB |
testcase_60 | AC | 271 ms
60,216 KB |
testcase_61 | AC | 268 ms
59,872 KB |
testcase_62 | AC | 270 ms
60,796 KB |
testcase_63 | AC | 280 ms
60,324 KB |
testcase_64 | AC | 271 ms
60,144 KB |
testcase_65 | AC | 276 ms
60,036 KB |
testcase_66 | AC | 264 ms
60,088 KB |
testcase_67 | WA | - |
testcase_68 | AC | 264 ms
59,888 KB |
testcase_69 | AC | 275 ms
60,764 KB |
testcase_70 | AC | 268 ms
59,608 KB |
testcase_71 | AC | 283 ms
61,048 KB |
testcase_72 | AC | 267 ms
60,208 KB |
testcase_73 | AC | 282 ms
59,800 KB |
testcase_74 | AC | 279 ms
60,704 KB |
testcase_75 | AC | 267 ms
59,844 KB |
testcase_76 | AC | 269 ms
59,876 KB |
testcase_77 | AC | 271 ms
60,056 KB |
testcase_78 | AC | 272 ms
60,260 KB |
testcase_79 | AC | 263 ms
60,044 KB |
testcase_80 | AC | 264 ms
59,700 KB |
testcase_81 | AC | 277 ms
60,820 KB |
testcase_82 | AC | 264 ms
60,380 KB |
testcase_83 | AC | 264 ms
60,272 KB |
testcase_84 | AC | 266 ms
59,756 KB |
testcase_85 | AC | 271 ms
60,456 KB |
testcase_86 | AC | 276 ms
59,608 KB |
testcase_87 | AC | 284 ms
60,632 KB |
testcase_88 | AC | 284 ms
60,304 KB |
testcase_89 | AC | 283 ms
60,560 KB |
testcase_90 | AC | 277 ms
59,504 KB |
testcase_91 | AC | 279 ms
60,304 KB |
testcase_92 | AC | 289 ms
60,836 KB |
testcase_93 | AC | 275 ms
59,996 KB |
testcase_94 | AC | 287 ms
60,408 KB |
testcase_95 | AC | 285 ms
60,152 KB |
testcase_96 | AC | 272 ms
60,420 KB |
testcase_97 | WA | - |
testcase_98 | WA | - |
testcase_99 | WA | - |
testcase_100 | WA | - |
testcase_101 | WA | - |
testcase_102 | WA | - |
testcase_103 | WA | - |
testcase_104 | WA | - |
testcase_105 | WA | - |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder491 { private static Scanner sc; private static Printer pr; private static void solve() { long n = sc.nextLong(); long t = 1_000_000_001; int ret = 0; for (int i = 1; i < 100_000; i++) { if (i % 10 == 0) { continue; } StringBuilder tmp = new StringBuilder(); tmp.append(i); if (t * i <= n) { if (isPalindrome(tmp)) { ret++; } } while (tmp.length() <= 5) { int m = tmp.length(); if (m * 2 >= 6) { StringBuilder tmp2 = new StringBuilder(); for (int j = 0; j < m; j++) { tmp2.append(tmp.charAt(m - 1 - j)); } if (m == 5) { tmp2.deleteCharAt(m - 1); } for (int j = 0; j < m; j++) { tmp2.append(tmp.charAt(j)); } long ltmp = Long.parseLong(tmp2.toString()); if (t * ltmp <= n) { ret++; } } tmp.insert(0, '0'); } } pr.println(ret); } private static boolean isPalindrome(StringBuilder str) { int n = str.length(); boolean flag = true; for (int i = 0; i < n / 2; i++) { if (str.charAt(i) != str.charAt(n - 1 - i)) { flag = false; break; } } return flag; } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }