Ultraviolet A 1560, ultraviolet

Source: Internet
Author: User

Ultraviolet A 1560, ultraviolet

Link to the question: Ultraviolet A 1560-Extended Lights Out

Given a matrix of 5 to 6, each position has a lamp and a switch. The initial matrix indicates the light and darkness of the lamp. If you press the switch at this position, this will change the status of the lights in the surrounding area. Find a switch position to ensure that all the lights are destroyed.

Solution:

  1. Enumerate, enumerate the status of the first row, and then roll out the status of the last four rows.
  2. Gaussian deyuan. For each position of the variable, 30 equations are listed for solving.
C ++ Enumeration#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 10;const int R = 5;const int C = 6;int arr[maxn][maxn], v[maxn][maxn], p[maxn][maxn];bool judge (int s) {    memset(p, 0, sizeof(p));    memset(v, 0, sizeof(v));    for (int i = 0; i < C; i++) {        if (s&(1<<i)) {            p[1][i+1] = 1;            for (int j = 0; j <= 2; j++)                v[1][i+j] ^= 1;            v[2][i+1] ^= 1;        }    }    for (int i = 2; i <= R; i++) {        for (int j = 1; j <= C; j++)            if (v[i-1][j]^arr[i-1][j]) {                p[i][j] = 1;                for (int k = -1; k <= 1; k++)                    v[i][j+k] ^= 1;                v[i+1][j] ^= 1;            }    }    for (int i = 1; i <= C; i++)        if (v[R][i]^arr[R][i])            return false;    for (int i = 1; i <= R; i++) {        for (int j = 1; j < C; j++)            printf("%d ", p[i][j]);        printf("%d\n", p[i][C]);    }    return true;}int main () {    int cas;    scanf("%d", &cas);    for (int kcas = 1; kcas <= cas; kcas++) {        for (int i = 1; i <= R; i++)            for (int j = 1; j <= C; j++)                scanf("%d", &arr[i][j]);        printf("PUZZLE #%d\n", kcas);        for (int s = 0; s < (1<<C); s++)            if (judge(s))                break;    }    return 0;}
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int dir[5][2] = {{0, 0}, {1, 0}, {-1, 0}, {0, 1}, {0, -1}};const int maxn = 30;const int R = 5;const int C = 6;typedef int Mat[maxn+5][maxn+5];Mat A;int v[R+5][C+5];void init () {    memset(A, 0, sizeof(A));    memset(v, 0, sizeof(v));    for (int i = 0; i < R; i++) {        for (int j = 0; j < C; j++) {            int x = i * C + j;            scanf("%d", &A[x][maxn]);            for (int k = 0; k < 5; k++) {                int p = i + dir[k][0];                int q = j + dir[k][1];                if (p < 0 || p >= R || q < 0 || q >= C)                    continue;                A[x][p*C+q] = 1;            }        }    }}void gauss_elimination (Mat a, int n) {    for (int i = 0; i < n; i++) {        int r = i;        while (A[r][i] == 0)            r++;        if (r != i) {            for (int j = 0; j <= n; j++)                swap(A[i][j], A[r][j]);        }        for (int j = i + 1; j < n; j++) {            if (A[j][i]) {                for (int k = 0; k <= n; k++)                    A[j][k] ^= A[i][k];            }        }    }    for (int i = n - 1; i >= 0; i--) {        for (int j = i + 1; j < n; j++)            A[i][n] ^= (A[j][n] * A[i][j]);        if (A[i][n])            v[i/C][i%C] = 1;    }}int main () {    int cas;    scanf("%d", &cas);    for (int kcas = 1; kcas <= cas; kcas++) {        init();        gauss_elimination(A, maxn);        printf("PUZZLE #%d\n", kcas);        for (int i = 0; i < R; i++) {            printf("%d", v[i][0]);            for (int j = 1; j < C; j++)                printf(" %d", v[i][j]);            printf("\n");        }    }    return 0;}

Reduce melanin food

We need to properly suppress melanin production because of the differences in aesthetics. After all, whitening is a fashion topic that never fades in Asia, and it is sufficient for major companies to develop whitening products. Of course, properly inhibiting melanin will not cause health hazards. So how can we make skin healthy while skin whitening? Do not forget to take a scientific view of sun protection and food intake. During skin whitening, the generated melanin is gradually eliminated, while sunscreen can help the skin suppress new melanin production. Using a good sunscreen product, the base and base layers of the skin and the cortex are not affected by ultraviolet rays, which does not stimulate the activity of casein and inhibit the production of melanin. Skin color can also be improved through diet. Drinking plenty of water, eating more vegetables and fruits, enhancing the intake of antioxidant food, vitamin C, vitamin A and other foods can effectively skin whitening and protection. Ripe tomatoes and lemons are rich in vitamin C, while vitamin A is common in some fat-soluble Yellow foods. Some foods rich in copper or zinc will activate the activity of casein to make the skin black, so you should eat less animal liver, beans, peaches and other foods. It is worth noting that eating less acidic food should avoid the production of free radicals and toxin in the body. High-quality whitening products can improve the skin that has formed melanin. For example, the most popular skin whitening elements in the world: Vitamin C, vitamin C derivatives, licorice extract, mulberry extract, bear fruit Gan and other plant skin whitening factors. In the process of melanin formation, vitamin C mainly helps the skin to suppress melanin by reducing the activity of casein. At the same time, vitamin C has a good antioxidant effect, helping cells prolong life and achieve the goal of skin whitening. The plant whitening Queen's licorice extract helps to resist ultraviolet rays and inhibit the activity of casein. It can also improve skin roughness, water shortage, and inflammation. It is a completely functional plant whitening ingredient. Artifacin can help inhibit the formation of melanin by freezing the activity of casein and has the effect of bleaching cells. Grape seeds with good antioxidant activity can also be used as "Booster" for other whitening factors ". [Edit this section] substances that prevent the production of Melanin from changing the melanin production pathway, such as: Bone cyligan peptide quacid, arnitin, and vitamin C, can also be used to create freckle. Effective ingredients for inhibiting the formation of melanin cells include: chloroenol, demixine, vitamin C, 9 carotene, green tea, QuIC acid, black and white, umei, cinnamon, licorice oil, and soluble extract, so how can we prevent the production of Melanin from blackening the skin? 1. Pay attention to labor protection to avoid direct exposure to the sun. ultraviolet rays can promote the production of melanin particles in melanin cells and make the skin black. It is best to apply some whitening sunscreen in the exposed area. 2. Pay attention to diet. Generally, you need to drink more water, eat more fresh vegetables, hawthorn and carrots, and eat less salt to reduce the formation of melanin. 3. Taking vitamin C orally, it can restore doobanoone to doob, thus inhibiting the formation of melanin. 4. Oral administration of Liuwei Dihuang Pills, 8 pills each time, 2-3 times a day. 5. for external use, you can choose to use 3% hydrogen peroxide, 5% white mercury ointment or whitening anti-wrinkle cream, whitening cream, protein skin cream, protein ginseng beauty cream, and special brightening honey. For long-term use, black skin can be converted to white. 6. Disable ointment or cosmetics containing estrogen, because estrogen can promote melanin formation. If you apply these cosmetics, the skin will become darker, and long-term use will lead to skin disease. 7. Keep yourself in a comfortable mood, and avoid worries and anger. 8. Eat a proper amount of food, eat more fresh vegetables and fruits, and do not eat greasy and spicy products and cheese. [Edit this section] the following diet is used in clinical treatment of melanin, And the commonly used diet is satisfactory. I. freckle-removing powder: 250 grams of winter melon kernels, 25 grams of lotus seeds, 15 grams of White Peony powder, and 15 grams of winter melon kernels, lotus seeds, and white hazelnut powder. Boil water after meals each day, topical peach blossom dried and dry winter melon kernels (shelled) equal amount of research for fine, add the right amount of honey evenly, coated before going to bed, wash in the morning, remove freckles, skin cleansing effect. Ii. taobao.com: 10 grams of loofa.com, 10 grams of white Fuling, 10 grams of silkworm, 10 grams of white chrysanthemum, 20 grams of pearl, 3 roses, 10 red dates, add a total of water on the medicine to the juice, then add water thick fried juice, two juice mixed, 1 dose per day, two minutes served, for 30 days. 3. Peel and cut 200 grams of yam, stir-fry 100 grams of glutinous rice, 20 grams of jujube, and add... the remaining full text>

What kind of heating rod does my fish tank use? Enlighten me

The fish tank is not small. About 500 watts should be enough.
If there is no high-power heating rod, you can use a few more, the total power is greater than 500 watts on the line
Yangyinlong does not need to raise the water motor. If there is an upper filter, there are not many fish, then the oxygen filling device is not required.

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.