LoginSignup
1
0

More than 3 years have passed since last update.

C#でAtCoder Beginners Selection(ABC081A - Placing Marbles)

Last updated at Posted at 2021-01-19

準備

C#でAtCoderデビューのための準備
のあとで AtCoder Beginners Selection をやってみました。

問題文

ABC081A - Placing Marbles
https://atcoder.jp/contests/abs/tasks/abc081_a

提出結果

using System;

class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        int okCount = 0;
        for(int i = 0; i < 3; i++)
        {
            char c = input[i];
            if (c == '1') okCount++;
        }
        Console.WriteLine(okCount);
    }
}

テスト実行

image.png
image.png

1
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
1
0