zoukankan      html  css  js  c++  java
  • POJ 1852 Ants

    理解这个问题很easy。

    有很多蚂蚁上一棒,都面临着坚守在爬行中间的位置。

    两人见面,他们都转身和爬行,这可以被理解为不相互两个蚂蚁之间干涉。

    (swap一点点)。


    头的距离就好了。


    #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,n) for(int i= a;i< n ;i++)
    #define FOR0(i,a,b) for(int i=a;i>=b;i--)
    #define pb push_back
    #define mp make_pair
    #define ft first
    #define sd second
    #define sf scanf
    #define pf printf
    #define acfun std::ios::sync_with_stdio(false)
    
    #define SIZE 10000+1
    using namespace std;
    
    int m,n;
    
    int main()
    {
        int t;
        sf("%d",&t);
        while(t--)
        {
            sf("%d%d",&m,&n);
            int maxn=-INF,minn=-INF;
            FOR(i,0,n)
            {
                int tmp;
                sf("%d",&tmp);
                maxn=max(maxn,max(tmp,m-tmp));
                minn=max(minn,min(tmp,m-tmp));
            }
            pf("%d %d
    ",minn,maxn);
        }
    }
    


    版权声明:本文博客原创文章。博客,未经同意,不得转载。

  • 相关阅读:
    update condition 字段报错
    Xshell连接Linux服务器总掉线
    sleep php函数
    ubuntu 16.04 镜像下载
    多线程Parallel和Task
    AngularJS 时间格式化
    正则表达式
    手机抓包
    内存泄漏
    字符集编码和排列规则
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/4648984.html
Copyright © 2011-2022 走看看