結果
問題 |
No.756 チャンパーノウン定数 (1)
|
ユーザー |
|
提出日時 | 2018-12-06 12:12:21 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 699 bytes |
コンパイル時間 | 23,010 ms |
コンパイル使用メモリ | 377,324 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-14 02:25:09 |
合計ジャッジ時間 | 15,372 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
warning: function `getline` is never used --> src/main.rs:3:4 | 3 | fn getline() -> String{ | ^^^^^^^ | = note: `#[warn(dead_code)]` on by default
ソースコード
use std::io::BufRead; fn getline() -> String{ let mut __ret=String::new(); std::io::stdin().read_line(&mut __ret).ok(); return __ret; } fn main(){ let starting:i64=1; let bse=10; //loop { // let s=getline(); let stdin = std::io::stdin(); for line in stdin.lock().lines() { match line { Ok(s) => { let mut n:i64=s.trim().parse().unwrap(); n+=starting-2; let mut digits:i64=1; let mut expbase:i64=1; let mut x:i64=bse-1; while x<=n { digits+=1; expbase*=bse; n-=x; x=digits*expbase*(bse-1); } let mut num:i64=expbase+n/digits; let mut d:i64=digits-1-n%digits; while d>0 { num/=bse; d-=1; } println!("{}",num%bse); }, Err(_) => () }} }