Ultraviolet A 239, ultraviolet

Source: Internet
Author: User

Ultraviolet A 239, ultraviolet

Connection: Ultraviolet A 239-Tempus et mobilius. Time and motion

In ancient times, there was a timer with n numbers starting from 1 ~ Then there are three tracks corresponding to 1 minute, 5 minutes, and 1 hour. For example, each track has a ball for 1 hour and 6 minutes. The timer works by rolling out a ball from the ball heap every minute to a one-minute track (the ball heap is a queue). In special cases, there are four balls on the one-minute track, if you enter another ball, it will be 5 minutes. Therefore, the ball will be rolled to a 5-minute track, and the ball on the one-minute track will be put back to the end of the heap in the order of backward, forward, and backward.


In the corresponding 5 minutes, if the track is 11 balls, the next ball will be rolled to the one-hour track, and the seeking in the track will also be pushed back to the ball heap.
Note that the carry of the one-hour orbit here is special. Because the timer cycle is half a day, when there are 11 balls in the hourly orbit, you need to put 12th balls, you need to bounce the first 11 balls back to the heap, and then put the first 12th balls at the end of the heap. This is where all tracks are empty after half a day.

The question is given, asking how many days it will take for the ball in the ball heap to return to the initial state.

Solution: the ball will return to the ball heap every half day. Because the unit is one day, after two half-day simulation, the sequence in the queue is the number of current balls per time (one day) A replacement operation breaks down the replacement cycle. The minimum public multiple of all cycles is the answer.

#include <cstdio>#include <cstring>#include <queue>#include <algorithm>using namespace std;typedef long long ll;const int D = 12 * 60;const int lit[3] = {4, 11, 12};const int maxn = 7005;int N, pos[maxn], v[maxn];ll gcd (ll a, ll b) {    return b == 0 ? a : gcd(b , a % b);}ll lcm (ll a, ll b) {    return a / gcd(a, b) * b;}void init () {    queue<int> que;    int c[3], s[3][20];    memset(v, 0, sizeof(v));    for (int i = 1; i <= N; i++)        que.push(i);    for (int k = 0; k < 2; k++) {        memset(c, 0, sizeof(c));        for (int i = 0; i < D; i++) {            int p = 0;            while (true) {                if (c[p] == lit[p]) {                    while (c[p])                        que.push(s[p][--c[p]]);                    p++;                } else {                    s[p][c[p]++] = que.front();                    que.pop();                    break;                }            }        }        for (int j = 10; j >= 0; j--)            que.push(s[2][j]);        que.push(s[2][11]);    }    int mv = 1;    while (!que.empty()) {        pos[mv++] = que.front();        que.pop();    }}ll solve () {    init();    ll ret = 1;    for (int i = 1; i <= N; i++) {        if (v[i])            continue;        int mv = i;        ll cnt = 0;        while (v[mv] == 0) {            v[mv] = 1;            cnt++;            mv = pos[mv];        }        ret = lcm(ret, cnt);    }    return ret;}int main () {    while (scanf("%d", &N) == 1 && N) {        printf("%d balls cycle after %lld days.\n", N, solve());    }    return 0;}

Sun Protection for military training for students

Which of the following is better for physical and chemical sunscreen?
Depending on your personal preferences, physical sunscreen is heavy, and chemical attacks may hurt your skin a little. However, you only need to remove makeup carefully, so don't worry too much. Nowadays, many sun protection products come from both physical and chemical aspects. You don't need to take this into consideration.
Which of the following is better for sunscreen and cream?
Well ...... The roles are different. You cannot say who is good or bad. If you are really worried about skin damage, you 'd better first wipe the isolation and then wipe the sunscreen. The two are the best, and there are also products that isolate the two in one.
Can I use a 7-in-one BB cream in ojiaxiao?
I have never used it. It is hard to comment. However, the sunscreen effect of the BB cream must not be comparable to that of the professional sunscreen. I have used the mysterious BB cream before. Although the sunscreen index is very high, it is very heavy on my face ...... Dislike. In summer, lightweight sun protection is king.
The recommended sun protection products are light and thin, and the price is not expensive. They are affordable for students.
1. bilou yellow bottle with talcum powder in it. Some people are allergic, but it is dry and not greasy. If your skin is not sensitive, this is suitable for you, the capacity is also large, full body coating can also be used for a summer. About 60
2. The nebi of manxiureton is relatively thin and fresh, but it does not feel fresh and refreshing, and the sunscreen index is relatively high.
3. skinfood tomato, with high online rating and high cost performance. But not refreshing enough
4. In fact, Yafang has a good sunscreen, that is, the sunscreen index is not very high. Let's look at the spf15, which is very comfortable and cheap.
Since my sister is in military training, I still recommend you use a blue-soft yellow bottle. It's very refreshing! Not oily on your face. You can buy it at Watson.

How can I skin become oily? What are some good products?

Dear valued customer, it is a great pleasure to know my medical makeup skin consultant.
We recommend that you try the following effective Whitening Methods.
Tofu green tea mask
Applicable skin type: oily skin
Required materials: tofu 15-20g, green tea powder 5-10g
Homemade and usage: place the bean curd in a clean container, crush it gently with a spoon, and then add the prepared green tea powder together to stir well. After cleansing, apply the facial mask evenly to the face and wash the face with warm water for 15 minutes.
Mask effect: green tea has the antioxidant effect. This mask made with tofu can not only skin whitening and moisturizing, but also effective anti-aging.
For more skin problems, please go to Zhiji medical makeup expert platform or go to Zhiji medical makeup official website for online consultation.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.