LoginSignup
0
0

More than 5 years have passed since last update.

atcoder ABC108

Posted at

Cは数学的な問題であり、解法が浮かばなかった。Dはやっていない
https://atcoder.jp/contests/abc108

C問題

方針

a+b=Kの倍数
c+b=Kの倍数
a+c=Kの倍数
より、
2*a= Kの倍数
2*b= Kの倍数
2*c= Kの倍数
が導かれる、よって、Kが奇数の時、a,b,c,もKの倍数である必要があるため、1からNについてKの倍数をカウントすれば良い。Kが偶数の時、a,b,cはk/2の倍数である必要があるため、1からNについてK/2の倍数をカウントすれば良い。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0