結果

問題 No.491 10^9+1と回文
コンテスト
ユーザー packet0
提出日時 2017-03-27 23:23:52
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 425 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,230 ms
コンパイル使用メモリ 203,120 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-27 22:20:33
合計ジャッジ時間 7,991 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 61
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unnecessary parentheses around `for` iterator expression
  --> src/main.rs:10:18
   |
10 |         for i in (1..10) {
   |                  ^     ^
   |
   = note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
   |
10 -         for i in (1..10) {
10 +         for i in 1..10  {
   |

warning: constant `base` should have an upper case name
 --> src/main.rs:1:7
  |
1 | const base: u64 = 1000000001;
  |       ^^^^
  |
  = note: `#[warn(non_upper_case_globals)]` (part of `#[warn(nonstandard_style)]`) on by default
help: convert the identifier to upper case
  |
1 - const base: u64 = 1000000001;
1 + const BASE: u64 = 1000000001;
  |

warning: unused `Result` that must be used
 --> src/main.rs:4:5
  |
4 |     std::io::stdin().read_line(&mut line);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this `Result` may be an `Err` variant, which should be handled
  = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default
help: use `let _ = ...` to ignore the resulting value
  |
4 |     let _ = std::io::stdin().read_line(&mut line);
  |     +++++++

ソースコード

diff #
raw source code

const base: u64 = 1000000001;
fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line);
    let n: u64 = line.trim().parse().unwrap();

    let mut mul = 1;
    let mut count = 0;
    'a: loop {
        for i in (1..10) {
            if mul * i * base > n {
                break 'a;
            }
            count += 1;
        }
        mul = mul * 10 + 1;
    }
    println!("{}", count);
}
0