レス書き込み
スレへ戻る
写
レス栞
レス消
プログラミングのお題スレ Part22
PC,スマホ,PHSは
ULA
べっかんこ
公式(スマホ)
公式(PC)
で書き込んでください。
名前
メール
引用切替:
レスアンカーのみ
>>60 > // Rust 双方向イテレータ版 > struct SameCalendarYear(u32); > impl Iterator for SameCalendarYear { > type Item = u32; > fn next(&mut self) -> Option<u32> { > common_next(self.0, false).map(|year| { self.0 = year; year }) > } > } > impl DoubleEndedIterator for SameCalendarYear { > fn next_back(&mut self) -> Option<u32> { > common_next(self.0, true).map(|year| { self.0 = year; year }) > } > } > > fn common_next(start_year: u32, is_before: bool) -> Option<u32> { > let mut day = 0; > let mut year = start_year; > while year > 0 { > if is_before { year -= 1; } > day += 1 + leap(year); > if day >= 7 { day -= 7; } > if !is_before { year += 1; } > if day == 0 && leap(year) == leap(start_year) { > return Some(year); > } > } > None > } > > fn leap(year: u32) -> u32 { > (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) as u32 > }
ローカルルール
SETTING.TXT
他の携帯ブラウザのレス書き込みフォームはこちら。
書き込み設定
で書き込みサイトの設定ができます。
・
ULA
・
べっかんこ(身代わりの術)
・
べっかんこ(通常)
・
公式(スマホ)
・
公式(PC)[PC,スマホ,PHS可]
書き込み設定(板別)
で板別の名前とメールを設定できます。
メモ帳
(0/65535文字)
上
下
板
覧
索
設
栞
歴
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.059s