• HDU 1432 Lining Up (POJ 1118)


    枚举,枚举点 复杂度为n^3。

    还能够枚举边的,n*n*log(n)。


    POJ 1118 要推断0退出。


    #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 700+1
    using namespace std;
    
    struct lx
    {
        int x,y;
    }p[SIZE];
    int n;
    
    int main()
    {
        while(~sf("%d",&n))
        //while(~sf("%d",&n),n)
        {
            FOR(i,0,n)
            sf("%d%d",&p[i].x,&p[i].y);
            int ans=0;
            int maxn=0;
            FOR(i,0,n)
            {
                FOR(j,i+1,n)
                {
                    maxn=0;
                    FOR(k,j+1,n)
                    {
                        if((p[j].x-p[i].x)*(p[k].y-p[j].y)==(p[j].y-p[i].y)*(p[k].x-p[j].x))
                            maxn++;
                    }
                    ans=max(maxn,ans);
                }
            }
            pf("%d
    ",ans+2);
        }
    }
    
    
    


  • 相关阅读:
    React同构直出优化总结
    Kubenertes资源分配之Request和Limit解析
    Node Server零基础——开发环境文件自动重载
    Vue组件开发实践之scopedSlot的传递
    【干货合集】Docker快速入门与进阶
    ES6 中的 Set
    十个书写Node.js REST API的最佳实践(上)
    oozie配置安装与原理
    Livy原理详解
    阿里(蚂蚁金服)招聘
  • 原文地址:https://www.cnblogs.com/bhlsheji/p/4256272.html
Copyright © 2020-2023  润新知