日々精進

新しく学んだことを書き留めていきます

SRM488 Div2 Easy

問題の分析
n+m人の友人がいます。最初のn人は退屈しています。残りのm人はそうではありません。
j番目とb番目の友人を退屈させた場合、退屈している人の数を求めなさい。
方針
本当にやるだけの問題なので言うことがありません。
ソースコード

using System;
using System.Collections.Generic;
using System.Text;
 
 
public class TheBoredomDivTwo
{
    public int find(int n, int m, int j, int b)
    {
        int cnt = n;
        if (j > n) cnt++;
        if (b > n) cnt++;
        return cnt;
    }
}