gh_stars>0
package cn.cstn.algorithm.offer;

/**
 * 输入一个整数 n ，求1～n这n个整数的十进制表示中1出现的次数。
 * <p>
 * <p>
 * 例如，输入12，1～12这些整数中包含1 的数字有1、10、11和12，1一共出现了5次。
 * <p>
 * <p>
 * 示例 1：
 * <p>
 * 输入：n = 12
 * <p>
 * 输出：5
 * <p>
 * <p>
 * 示例 2：
 * <p>
 * 输入：n = 13
 * <p>
 * 输出：6
 * <p>
 * <p>
 * 限制：
 * <p>
 * 1 <= n < 2^31
 * <p>
 *
 * @author zhaohuiqiang
 * @date 2020/7/10 11:03
 */
public class CountDigitOne {

    public static void main(String[] args) {
        System.out.println(countDigitOne(13));
    }

    public static int countDigitOne(int n) {
        int r = n / 10, c = n % 10, l = 0, d = 1, res = 0;

        while (r!= 0 || c!= 0) {
            if (c < 1) res += r * d;
            else if (c == 1) res += r * d + l + 1;
            else res += (r + 1) * d;
            l += c * d;
            c = r % 10;
            r /= 10;
            d *= 10;
        }

        return res;
    }

}
Finding a divorce attorney that you can trust is important if you want to get through your divorce without any drama. You want to find an attorney who is experienced in divorce law and who will work diligently to help you through the process as smoothly as possible. You should also look for an attorney who is accessible and willing to answer any questions that you may have.
What qualities should a divorce lawyer have?
Experience: A good divorce lawyer will have plenty of experience in the area. This will give them the know-how to help you through the process smoothly.
Honesty and Integrity: A good lawyer will always be honest with you and will keep your best interests in mind.
Knowledge of the Law: A good lawyer will be familiar with the divorce law in your state. This will help them provide you with the best possible service.
Availability and Flexibility: A good lawyer will be available to you 24/7, regardless of whether they are in their office or not. They will also be flexible with regards to scheduling.
How can you determine whether or not you can trust your lawyer?
Finding the right divorce lawyer is an important decision, and one that you should not take lightly. After all, your lawyer will be responsible for representing your interests during your divorce proceedings, and you want to ensure that you can trust them to do so.
One way to determine whether or not you can trust your lawyer is to look at their track record. Ask around to see if anyone has had any negative experiences with the lawyer, and if so, what transpired. Additionally, ask the lawyer about their experience with divorce proceedings in general. If they have experience with similar cases, this will give you a good indication of their skills.
Another way to determine whether or not you can trust your lawyer is to listen to what they have to say. Ask them about their experience with divorce proceedings, and what sorts of things they have seen happen during them. This will give you a better understanding of their approach and knowledge.
Ultimately, the best way to determine whether or not you can trust your lawyer is to talk to them directly. Ask them about their experience with divorce proceedings, and what sorts of things they have seen happen during them. If they are able to provide you with a positive response, then you can feel confident that they will represent your interests in a manner that is both ethical and effective.
What are some red flags that may indicate that your lawyer is not trustworthy?
When looking for a divorce attorney, it is important to find someone you can trust. Some red flags that may indicate that your lawyer is not trustworthy include if they are unwilling to answer your questions, if they are unyielding in negotiations, or if they make sudden changes in their approach to your case. It is also important to be aware of any possible conflicts of interest, such as if your lawyer is representing a party involved in your case. If you have any concerns about your lawyer, it is important to speak up and ask for a new lawyer.
What should you do if you begin to have doubts about your lawyer?
If you are considering a divorce, it is important to find an attorney you can trust. A good way to start is by asking around. Talk to friends, family, and colleagues who have recently gotten divorced and ask them who they used and what their experience was. Additionally, check online reviews of divorce attorneys to see if anyone has had negative experiences. Finally, don’t be afraid to ask your lawyer for references.
When you are considering finding a divorce attorney, it is important to find someone you can trust. It is also important to make sure the lawyer you choose is qualified and experienced in family law. You should also research the lawyer’s background and reviews before making a decision.
I dunno where you live but I'll throw a little fun fact about the price of the PW2.

Here in Italy IKEA has just started offering PV systems with LiFePO batteries and we're looking around to get a PV system so I checked price here and there. Turns out that, per kWh, PW2 has the lowest price of EVERYTHING: 60% cheaper than IKEA and Varta, 40% cheaper than LGChem HV pack and almost as cheap as a deep cycle lead acid. That's stupidly good given the fact that a lot of PV companies offers the PW2 so you are not forced to go through tesla to get one.On Wednesday, March 8, which is International Women’s Day, people around the world plan to "act together for equity, justice, and the human rights of women and all gender-oppressed people, through a one-day demonstration of economic solidarity." The organizers (who were also behind the Women’s March on Washington) have dubbed the demonstration "A Day Without a Woman," and anyone who is interested and able to participate is encouraged to take one or more of the following actions on March 8: Take the day off from both paid and unpaid labor; avoid shopping for the day (with exceptions for businesses that are small and women- and minority-owned); wear red.
Unlike the February 16 "A Day Without Immigrants" strike, March 8 isn’t resonating as strongly among restaurants in the Denver area. We’ll be tracking local restaurants’ plans for the day here, whether they’re closing, staying open but donating money to women-related charities, or taking other actions in solidarity.
Comal, an operation ran for and by Latino immigrant women who are learning how to open their own businesses through this eatery, is offering 10% off to every woman who stops in for lunch. Dine in or take out between 11:00 a.m. and 2:00 p.m.
On March 8, International Women’s Day, women around the country are going on strike to demand gender equality. Denver Cat Company will stand with them and be closed for business on Wednesday, March 8, 2017.
The cat cafe is a business owned by a woman, staffed entirely by women, and caters primarily to women. I was conflicted about the statement it makes to close such a business. But I have faith in our community and I know you will support us ten times harder all the rest of the week and month that we are open to make up for revenue loss. And, although I want to show solidarity for the cause of liberation and equality, I understand the strike is experienced differently by employees who are not salaried; therefore, cat cafe staff will be paid as if they had worked their usual shifts and will not lose wages because of the closure.
I also wanted to make my own personal statement by striking today: immigrants, like me, are job creators and make meaningful contributions to their communities and to the American economy. Without the opportunities created by feminist ideals, I would not have come to this country at age 21 to make a better life. To the extent any of this work and its doers are invisible, this is one small step to making it more visible. Let’s all honor the contributions of women and immigrants and welcome more of it, not less, and on fair terms.
If nothing else, wear red.
In Boulder, at Wild Standard, the team led by chef-owner Brandon Heap just introduced a cocktail list dedicated to influential women. The selection includes a variety of house-made creations named after notable women in history. The Maya Angelou with dry gin, lemon, alpine herbal liquer, mint and prosecco; and the Alice Waters with vodka, celery juice, verjus, elderflower, prosecco and thyme are just a couple of the featured cocktails. Other nods to to J.K. Rowling, Frida