SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
10.
B-約数の全列挙1
● 整数 の約数は 以下なので、 以下の全ての整
数について、それが の約数かどうかを調べれ
ば良い
● 計算量は
– 部分点1が得られる
N N N
N
N
O(N)
11.
B-約数の全列挙2
● が の約数ならば、 も の約数
● か の片方がわかれば、もう片方もすぐに
分かる。
– 小さい方だけを調べれば良い
● となる条件は
● √ 以下の約数を調べるだけで良い
● 計算量は (√ )
– 満点が得られる
A
A
A≤N / A
A
N N / A N
N / A
A
2
≤N
N
NO
12.
B-注意点
● が平方数の時 となる が存在する
– 誤って を2回足さないように気をつけなければな
らない
● 小課題2の入力が明らかにint型に収まらないの
で、C等の言語を使っている方は気をつけま
しょう
N A=N / A A
A