BestCoder Round #11 (Div. 2)

太菜,只能去Div2.(都做不完 ORZ。。。

分别是 HDU:

5054Alice and Bob

5055Bob and math problem

5056Boring count

5057Argestes and Sequence

# 1001

碰面只能在坐标中间。

所以判断一下就好了。

#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<stack>
#include<iostream>
#include<list>
#include<set>
#include<vector>
#include<cmath>

#define INF 0x7fffffff
#define eps 1e-8
#define LL long long
#define PI 3.141592654
#define CLR(a,b) memset(a,b,sizeof(a))
#define FOR(i,a,b) for(int i= a;i< b ;i++)
#define FOR0(i,a,b) for(int i= a;i>=b ;i--)
#define debug puts("==fuck==")
#define acfun std::ios::sync_with_stdio(false)

#define SIZE 20+10
using namespace std;

int main()
{
    int n,m;
    double x,y;
    while(~scanf("%d%d%lf%lf",&n,&m,&x,&y))
    {
        double x1,y1,x2,y2;
        x1=x,y1=y;

        x2=n-x,y2=m-y;

        if(abs(x1-x2)<=eps&&abs(y1-y2)<=eps)
            puts("YES");
        else
            puts("NO");
    }
}

# 1002

检查数字,题解给的是贪心。

我DFS写的。。。居然没人Hack我……

5

1 0 0 0 0

-1

这组数据小心了。

5

1 1 0 0 0

10001

还有这。

#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<stack>
#include<iostream>
#include<list>
#include<set>
#include<vector>
#include<cmath>

#define INF 0x7fffffff
#define eps 1e-8
#define LL long long
#define PI 3.141592654
#define CLR(a,b) memset(a,b,sizeof(a))
#define FOR(i,a,b) for(int i= a;i< b ;i++)
#define FOR0(i,a,b) for(int i= a;i>=b ;i--)
#define debug puts("==fuck==")
#define acfun std::ios::sync_with_stdio(false)

#define SIZE 20+10
using namespace std;

int a[10],n;
bool cmp(int a,int b)
{
    return a>b;
}
int num[101];
bool outflag;

void dfs(int m)
{
    if(outflag)return;
    if(m==n)
    {
        if(num[m-1]&1)
        {
            FOR(j,0,n)
            printf("%d",num[j]);
            printf("\n");
            outflag=1;
        }
        else
        return;
    }
    FOR0(j,9,0)
    {
        if(a[j])
        {
            a[j]--;
            num[m]=j;
            dfs(m+1);
            a[j]++;
        }
    }
}

int main()
{
    while(~scanf("%d",&n))
    {
        bool flag=0;
        int odd=0;
        int even=0;
        CLR(a,0);
        outflag=0;
        FOR(i,0,n)
        {
            int tmp;
            scanf("%d",&tmp);
            if(tmp&1)flag=1;
            a[tmp]++;
            if(tmp&1)odd++;
            else if(tmp!=0)even++;
        }
        if(!flag||(n!=1&&odd==1&&even==0))
        {
            puts("-1");
            continue;
        }

        dfs(0);
    }
}

# 1003 知道是维护一个数列。时间复杂度是O(n)的。

ORZ,写了半天,还是没写出来,这周慢慢写吧,先挂这。

#

wait...

#

# 1004 我用线段树的,结果MLE。卡内存有意思?

有人说可以试试 unsigned short 看能不能过。

慢慢交吧。反正在HDU41页。

#

wait...

#

时间: 2024-10-02 03:11:36

BestCoder Round #11 (Div. 2)的相关文章

BestCoder Round #11 (Div. 2) 前三题题解

题目链接: huangjing hdu5054 Alice and Bob 思路: 就是(x,y)在两个參考系中的表示演全然一样.那么仅仅可能在这个矩形的中点.. 题目: Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 216    Accepted Submission(s): 166 Problem De

BestCoder Round #11 (Div. 2) 题解

HDOJ5054 Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 302    Accepted Submission(s): 229 Problem Description Bob and Alice got separated in the Square, they agreed that if they

BestCoder Round #11 (Div. 2)题解集合

Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 155    Accepted Submission(s): 110 Problem Description Bob and Alice got separated in the Square, they agreed that if they get sepa

HDU 5056 Boring count(BestCoder Round #11 (Div. 2))

Problem Description: You are given a string S consisting of lowercase letters, and your task is counting the number of substring that the number of each lowercase letter in the substring is no more than K. Input: In the first line there is an integer

DP BestCoder Round #50 (div.2) 1003 The mook jong

题目传送门 1 /* 2 DP:这题赤裸裸的dp,dp[i][1/0]表示第i块板放木桩和不放木桩的方案数.状态转移方程: 3 dp[i][1] = dp[i-3][1] + dp[i-3][0] + 1; dp[i][0] = dp[i-1][1] + dp[i-1][0]; 4 比赛时二维dp写搓了,主要是边界情况的判断出错,比如dp[3][1] = 1,因为第3块放了木桩,其他地方不能再放,dp[3][0]同理 5 解释一下dp[i][1]的三种情况,可能是前面相隔2个放的方案或者是不放的

计算几何(水)BestCoder Round #50 (div.2) 1002 Run

题目传送门 1 /* 2 好吧,我不是地球人,这题只要判断正方形就行了,正三角形和正五边形和正六边形都不可能(点是整数). 3 但是,如果不是整数,那么该怎么做呢?是否就此开启计算几何专题了呢 4 */ 5 /************************************************ 6 * Author :Running_Time 7 * Created Time :2015-8-8 19:54:14 8 * File Name :B.cpp 9 ************

(BestCoder Round #64 (div.2))Array -- BestCoder Round #64 (div.2)

BestCoder Round #64 (div.2) Array 问题描述 Vicky是个热爱数学的魔法师,拥有复制创造的能力. 一开始他拥有一个数列{1}.每过一天,他将他当天的数列复制一遍,放在数列尾,并在两个数列间用0隔开.Vicky想做些改变,于是他将当天新产生的所有数字(包括0)全加1.Vicky现在想考考你,经过100天后,这个数列的前M项和是多少?. 输入描述 输入有多组数据. 第一行包含一个整数T,表示数据组数.T. \left( 1 \leq T \leq 2 * {10}^

hdu5418 BestCoder Round #52 (div.2) Victor and World ( floyd+状压dp)

Problem Description After trying hard for many years, Victor has finally received a pilot license. To have a celebration, he intends to buy himself an airplane and fly around the world. There are n countries on the earth, which are numbered from 1 to

HDU 5651 xiaoxin juju needs help(BestCoder Round #77 (div.1)1001)

传送门 xiaoxin juju needs help Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 861    Accepted Submission(s): 243 Problem Description As we all known, xiaoxin is a brilliant coder. He knew **palin