有一名员工发现日历已经7天没有翻了,于是他连着翻了7页,7天的总和刚好是138,问这一天是几号?

public static int day(int sum, int n, int d)
        {
            int test = n * (n - 1) / 2;
            int test2 = (sum - test) % n;
            if (test2 == 0)
            {
                return (sum - test) / n;
            }
            else
            {
                return day(sum - d - 1, n - 1, d + 1);
            }
        }
原文地址:https://www.cnblogs.com/songxiii/p/3146169.html