0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

初心者プログラマーAtCoderに挑んだ軌跡-ABC420-A-

Posted at

ABC420-A

問題の内容

シンプル足し算
X+Yは何月か?

言語

Rust

解法

足し算して12で割ったあまりを求める

課題

  • 特になし

学んだこと

  • 特になし

工夫点

  • (X+Y)%12にすると0~11になるので(X+Y-1)%12+1にした

提出内容

use proconio::input;

fn main() {
  input! {
    x: usize,
    y: usize,
  }
  let mut result = (x + y - 1) % 12 + 1;
  println!("{}", result);
}

成績

  • 154Byte
  • AC
  • 1ms
  • 2088KiB
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?