結果
問題 | No.491 10^9+1と回文 |
ユーザー | Grenache |
提出日時 | 2017-03-10 23:49:53 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,657 bytes |
コンパイル時間 | 3,445 ms |
コンパイル使用メモリ | 78,508 KB |
実行使用メモリ | 64,196 KB |
最終ジャッジ日時 | 2024-06-24 09:07:58 |
合計ジャッジ時間 | 35,803 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 281 ms
61,304 KB |
testcase_01 | AC | 274 ms
61,040 KB |
testcase_02 | AC | 274 ms
61,212 KB |
testcase_03 | WA | - |
testcase_04 | AC | 289 ms
61,340 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 282 ms
61,524 KB |
testcase_08 | AC | 281 ms
61,276 KB |
testcase_09 | AC | 279 ms
60,900 KB |
testcase_10 | AC | 280 ms
61,292 KB |
testcase_11 | AC | 285 ms
61,088 KB |
testcase_12 | AC | 272 ms
61,040 KB |
testcase_13 | AC | 275 ms
61,216 KB |
testcase_14 | AC | 290 ms
61,436 KB |
testcase_15 | AC | 280 ms
61,512 KB |
testcase_16 | AC | 280 ms
61,184 KB |
testcase_17 | AC | 285 ms
61,012 KB |
testcase_18 | AC | 280 ms
61,176 KB |
testcase_19 | MLE | - |
testcase_20 | AC | 282 ms
61,224 KB |
testcase_21 | AC | 293 ms
61,316 KB |
testcase_22 | AC | 277 ms
61,208 KB |
testcase_23 | AC | 288 ms
61,100 KB |
testcase_24 | AC | 281 ms
61,204 KB |
testcase_25 | AC | 279 ms
61,312 KB |
testcase_26 | AC | 284 ms
62,092 KB |
testcase_27 | AC | 285 ms
60,432 KB |
testcase_28 | AC | 278 ms
61,392 KB |
testcase_29 | AC | 278 ms
61,260 KB |
testcase_30 | AC | 287 ms
61,320 KB |
testcase_31 | AC | 283 ms
61,076 KB |
testcase_32 | AC | 286 ms
61,076 KB |
testcase_33 | AC | 275 ms
61,160 KB |
testcase_34 | AC | 288 ms
61,236 KB |
testcase_35 | AC | 285 ms
61,284 KB |
testcase_36 | AC | 278 ms
61,044 KB |
testcase_37 | AC | 279 ms
61,332 KB |
testcase_38 | AC | 276 ms
60,796 KB |
testcase_39 | AC | 278 ms
61,016 KB |
testcase_40 | AC | 280 ms
61,216 KB |
testcase_41 | AC | 278 ms
61,236 KB |
testcase_42 | AC | 280 ms
60,740 KB |
testcase_43 | AC | 284 ms
60,576 KB |
testcase_44 | AC | 282 ms
62,028 KB |
testcase_45 | AC | 279 ms
61,288 KB |
testcase_46 | AC | 277 ms
61,492 KB |
testcase_47 | AC | 285 ms
61,088 KB |
testcase_48 | AC | 276 ms
60,584 KB |
testcase_49 | AC | 287 ms
61,136 KB |
testcase_50 | AC | 289 ms
61,444 KB |
testcase_51 | AC | 286 ms
61,584 KB |
testcase_52 | AC | 271 ms
60,900 KB |
testcase_53 | AC | 281 ms
61,312 KB |
testcase_54 | AC | 285 ms
61,512 KB |
testcase_55 | AC | 274 ms
61,316 KB |
testcase_56 | AC | 274 ms
61,156 KB |
testcase_57 | AC | 284 ms
60,924 KB |
testcase_58 | AC | 278 ms
61,184 KB |
testcase_59 | AC | 278 ms
61,308 KB |
testcase_60 | AC | 282 ms
61,256 KB |
testcase_61 | AC | 282 ms
61,252 KB |
testcase_62 | AC | 281 ms
61,312 KB |
testcase_63 | AC | 292 ms
61,484 KB |
testcase_64 | AC | 282 ms
61,344 KB |
testcase_65 | AC | 273 ms
61,508 KB |
testcase_66 | AC | 289 ms
60,696 KB |
testcase_67 | WA | - |
testcase_68 | AC | 282 ms
61,260 KB |
testcase_69 | AC | 270 ms
60,944 KB |
testcase_70 | AC | 275 ms
61,168 KB |
testcase_71 | AC | 279 ms
61,692 KB |
testcase_72 | AC | 280 ms
61,408 KB |
testcase_73 | AC | 273 ms
61,156 KB |
testcase_74 | AC | 283 ms
61,204 KB |
testcase_75 | AC | 278 ms
61,200 KB |
testcase_76 | AC | 280 ms
60,968 KB |
testcase_77 | AC | 287 ms
61,160 KB |
testcase_78 | AC | 285 ms
61,408 KB |
testcase_79 | AC | 289 ms
60,468 KB |
testcase_80 | AC | 278 ms
61,152 KB |
testcase_81 | AC | 284 ms
61,244 KB |
testcase_82 | MLE | - |
testcase_83 | AC | 280 ms
60,752 KB |
testcase_84 | AC | 283 ms
61,180 KB |
testcase_85 | AC | 280 ms
61,412 KB |
testcase_86 | AC | 286 ms
61,412 KB |
testcase_87 | AC | 286 ms
61,108 KB |
testcase_88 | AC | 273 ms
60,900 KB |
testcase_89 | AC | 285 ms
61,132 KB |
testcase_90 | AC | 282 ms
61,576 KB |
testcase_91 | AC | 278 ms
61,404 KB |
testcase_92 | AC | 282 ms
61,704 KB |
testcase_93 | AC | 279 ms
61,400 KB |
testcase_94 | AC | 284 ms
60,760 KB |
testcase_95 | AC | 272 ms
61,264 KB |
testcase_96 | AC | 281 ms
60,984 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)); } for (int j = 0; j < m; j++) { tmp2.append(tmp.charAt(j)); } long ltmp = Long.parseLong(tmp2.toString()); if (m * 2 < 10 && t * ltmp <= n) { ret++; } if (tmp2.charAt(m - 1) != '0') { tmp2.deleteCharAt(m - 1); ltmp = Long.parseLong(tmp2.toString()); if (ltmp > 99999 && 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); } } }