Zoj monthly, June, December 2014, bcdefgh

Source: Internet
Author: User

Competition link: Click to open the link

I first started F and C, and found that the status was incorrect. In the afternoon, the brain holes were wide open ,,

Brainless wa, brainless ce... The same mistake is committed twice ..

I had a few shots at my head, and I got a G code in the last 20 minutes. I don't know why I can't use 1 as a station that can't be refueled .. Too weak ..

Well, I'm too lazy to answer questions the next day ..


B: Gears

Query set

Question: Click the open link.


C: consecutive blocks

Discretization and then simulate

Question: Click the open link.


D: an easy game

Set DP [I] [J] to the number of methods where the first I position matches the J position.

#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>#include <queue>#include <string>#include <vector>#include <stack>#include <map>#include <set>#include <algorithm>#include <iostream>using namespace std;#define ll long long#define mod 1000000009#define N 105int n, K, m;int dp[N][N];int C[N][N];string s1;string s2;int dfs(int differ, int left) {    if (left == 0) {        return differ == 0;    }    else {        if (~dp[differ][left]) {            return dp[differ][left];        }        int &ans = dp[differ][left];        ans = 0;        int a = differ;        int b = n - differ;        for (int i = 0; i <= differ && i <= m; ++i) {            if (b >= m - i) {                ans += (int)((ll)C[b][m - i] * C[a][i] % mod * dfs(differ - i + (m - i), left - 1) % mod);                ans %= mod;            }        }        return ans;    }}int main(){    for (int i = 0; i < N; ++i) {        C[i][i] = 1;        for (int j = 0; j < i; ++j) {            C[i][j] = C[i - 1][j - 1] + C[i - 1][j];            C[i][j] %= mod;        }    }    while (cin >> n >> K >> m){        cin >> s1 >> s2;        int nSum = 0;        int nLen = s1.length();        for (int i = 0; i < nLen; ++i) {            if (s1[i] != s2[i]) {                ++nSum;            }        }        memset(dp, -1, sizeof(dp));        int ans = dfs(nSum, K);        printf("%d\n", ans);    }    return 0;}


E: Romantic Value

Simple minimal cut.

Question: Click the open link.


F: First Digit

Silk question ..

#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <vector>#include <queue>#include <set>#include <map>#include <string>#include <math.h>#include <stdlib.h>#include <time.h>using namespace std;int main(){    int T ,m,u,v,w; scanf("%d",&T);    while(T--){ scanf("%d%d",&u,&v);puts("1"); }    return 0;}

G: greedy driver

Spfa2 times ,,

Question: Click the open link.


H: Grouping

Finding the longest chain in the point-down topological order

Question: Click the open link.

Zoj monthly, June, December 2014, bcdefgh

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.