June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -0,0 +1,22 @@
|
|||
fn is_self_desc(xx: u64) -> bool
|
||||
{
|
||||
let s: String = xx.to_string();
|
||||
let mut count_vec = vec![0; 10];
|
||||
for c in s.chars() {
|
||||
count_vec[c.to_digit(10).unwrap() as usize] += 1;
|
||||
}
|
||||
for (i, c) in s.chars().enumerate() {
|
||||
if count_vec[i] != c.to_digit(10).unwrap() as usize {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
for i in 1..100000000 {
|
||||
if is_self_desc(i) {
|
||||
println!("{}", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue