day3上午模擬賽

一共一百四十,本應一百九

t1,水的dp,還有什麼公式也沒聽,代碼

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,dp[1010][1010];
int main(){
    freopen("star.in","r",stdin);
    freopen("star.out","w",stdout);
    int nx,ny;
    for(int i=1;i<=1000;i++){
        if(i%2) dp[0][i]=dp[i][0]=1;
        else dp[0][i]=dp[i][0]=0;
    }
    dp[0][0]=false;
    for(int i=1;i<=1000;i++){
        for(int j=1;j<=1000;j++){
            nx=i-1; ny=j-1;
            if(nx>=0&&ny>=0){
                if(!dp[nx][ny]){
                    dp[i][j]=true; continue;
                }
            }
            nx=i-1; ny=j;
            if(!dp[nx][ny]){
                dp[i][j]=true; continue;
            }
            nx=i; ny=j-1;
            if(!dp[nx][ny]){
                dp[i][j]=true; continue;
            }
            dp[i][j]=false;
        }
    }
    int n,m;
    scanf("%d%d",&n,&m);
    while(n!=0&&m!=0){
        if(dp[n-1][m-1]){
            printf("Yuri\n");
        }
        else printf("Chito\n");
        scanf("%d%d",&n,&m);
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}

t2,四十分很好水,六十分想出來了,但沒寫完,因爲看錯題了,悲傷!八十分分治(看到二進制一般分治),一百分tried樹,不會,四十分代碼就不發了

t3,三十分不知爲何掛了...五十分線段樹裸題...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章