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に挑んだ軌跡-ABC398-A-

Posted at

ABC398-A

問題の内容

真ん中だけ=になるように出力する

言語

Rust

解法

奇数の時と偶数の時に分けて力技で出力した

課題

なんかもっといいものがあるかもしれないのと、
数が大きくなったらたぶんTLE出るから短縮したものを考える必要がある。10ごととか

学んだこと

書くのにかかった秒数

4分半/目標40秒

提出内容

use proconio::input;

fn main() {
    input! {
        n: usize,
    }

    if n % 2 == 0 {
        for _ in 0..(n / 2 - 1) {
            print!("-");
        }
        print!("==");
        for _ in 0..(n / 2 - 1) {
            print!("-");
        }
    } else {
        let m = n - 1;
        for _ in 0..(m / 2) {
            print!("-");
        }
        print!("=");
        for _ in 0..(m / 2) {
            print!("-");
        }
    }
    println!();
}

成績

  • 490Byte
  • AC
  • 1ms
  • 1996KiB
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?