結果
問題 | No.491 10^9+1と回文 |
ユーザー | Grenache |
提出日時 | 2017-03-10 23:26:26 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,510 bytes |
コンパイル時間 | 4,504 ms |
コンパイル使用メモリ | 78,600 KB |
実行使用メモリ | 59,052 KB |
最終ジャッジ日時 | 2024-06-24 08:47:24 |
合計ジャッジ時間 | 29,120 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 202 ms
56,948 KB |
testcase_01 | AC | 201 ms
57,076 KB |
testcase_02 | AC | 205 ms
57,144 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 207 ms
57,052 KB |
testcase_08 | AC | 205 ms
56,972 KB |
testcase_09 | AC | 202 ms
56,768 KB |
testcase_10 | AC | 201 ms
57,040 KB |
testcase_11 | AC | 202 ms
57,048 KB |
testcase_12 | AC | 283 ms
56,944 KB |
testcase_13 | AC | 295 ms
56,888 KB |
testcase_14 | WA | - |
testcase_15 | AC | 202 ms
57,112 KB |
testcase_16 | AC | 210 ms
57,108 KB |
testcase_17 | AC | 210 ms
56,864 KB |
testcase_18 | AC | 188 ms
56,696 KB |
testcase_19 | AC | 200 ms
56,832 KB |
testcase_20 | AC | 202 ms
56,860 KB |
testcase_21 | AC | 200 ms
56,964 KB |
testcase_22 | AC | 197 ms
56,840 KB |
testcase_23 | WA | - |
testcase_24 | AC | 197 ms
57,052 KB |
testcase_25 | AC | 197 ms
56,684 KB |
testcase_26 | AC | 205 ms
56,804 KB |
testcase_27 | AC | 205 ms
56,932 KB |
testcase_28 | AC | 198 ms
56,984 KB |
testcase_29 | AC | 196 ms
56,848 KB |
testcase_30 | AC | 207 ms
56,972 KB |
testcase_31 | AC | 204 ms
57,016 KB |
testcase_32 | AC | 205 ms
56,952 KB |
testcase_33 | AC | 239 ms
56,944 KB |
testcase_34 | AC | 235 ms
57,036 KB |
testcase_35 | AC | 262 ms
56,992 KB |
testcase_36 | AC | 238 ms
57,148 KB |
testcase_37 | AC | 234 ms
57,104 KB |
testcase_38 | AC | 237 ms
56,856 KB |
testcase_39 | AC | 234 ms
57,084 KB |
testcase_40 | AC | 243 ms
57,036 KB |
testcase_41 | AC | 232 ms
57,080 KB |
testcase_42 | AC | 243 ms
56,868 KB |
testcase_43 | AC | 236 ms
57,120 KB |
testcase_44 | AC | 202 ms
57,188 KB |
testcase_45 | AC | 205 ms
56,900 KB |
testcase_46 | AC | 200 ms
57,476 KB |
testcase_47 | AC | 208 ms
56,852 KB |
testcase_48 | AC | 203 ms
56,864 KB |
testcase_49 | AC | 203 ms
58,940 KB |
testcase_50 | AC | 199 ms
57,064 KB |
testcase_51 | AC | 212 ms
57,344 KB |
testcase_52 | AC | 205 ms
56,980 KB |
testcase_53 | AC | 200 ms
56,940 KB |
testcase_54 | AC | 209 ms
56,692 KB |
testcase_55 | AC | 200 ms
56,936 KB |
testcase_56 | AC | 199 ms
56,868 KB |
testcase_57 | AC | 203 ms
56,664 KB |
testcase_58 | WA | - |
testcase_59 | AC | 197 ms
56,892 KB |
testcase_60 | AC | 204 ms
56,668 KB |
testcase_61 | AC | 198 ms
56,888 KB |
testcase_62 | AC | 201 ms
56,820 KB |
testcase_63 | WA | - |
testcase_64 | AC | 192 ms
56,824 KB |
testcase_65 | AC | 192 ms
56,872 KB |
testcase_66 | AC | 197 ms
57,084 KB |
testcase_67 | WA | - |
testcase_68 | AC | 201 ms
57,180 KB |
testcase_69 | AC | 199 ms
56,980 KB |
testcase_70 | AC | 207 ms
56,896 KB |
testcase_71 | AC | 202 ms
56,868 KB |
testcase_72 | AC | 200 ms
56,984 KB |
testcase_73 | AC | 203 ms
57,068 KB |
testcase_74 | AC | 189 ms
56,776 KB |
testcase_75 | AC | 199 ms
56,868 KB |
testcase_76 | AC | 196 ms
56,940 KB |
testcase_77 | AC | 207 ms
57,064 KB |
testcase_78 | AC | 206 ms
56,864 KB |
testcase_79 | AC | 210 ms
56,744 KB |
testcase_80 | AC | 201 ms
56,736 KB |
testcase_81 | AC | 200 ms
56,584 KB |
testcase_82 | AC | 202 ms
56,852 KB |
testcase_83 | AC | 206 ms
57,320 KB |
testcase_84 | AC | 189 ms
56,872 KB |
testcase_85 | AC | 200 ms
56,944 KB |
testcase_86 | AC | 200 ms
56,856 KB |
testcase_87 | AC | 206 ms
57,236 KB |
testcase_88 | AC | 197 ms
57,056 KB |
testcase_89 | AC | 204 ms
56,988 KB |
testcase_90 | AC | 199 ms
57,068 KB |
testcase_91 | AC | 196 ms
56,932 KB |
testcase_92 | AC | 201 ms
57,188 KB |
testcase_93 | AC | 198 ms
56,960 KB |
testcase_94 | AC | 206 ms
57,076 KB |
testcase_95 | AC | 197 ms
57,060 KB |
testcase_96 | AC | 198 ms
57,048 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 < 100000; 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) { tmp.insert(0, '0'); int m = tmp.length(); if (m * 2 < 6) { continue; } 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++; } } } 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); } } }