F - Finding Lines UVALive - 6955 (随机数优化,检测)

题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4967


判断是不是存在有百分之p的点在一条直线上。

嗯,学习了随机化优化的算法。

#include 

using namespace std;
const int MAXN=1e5+7;
int x[MAXN],y[MAXN];
int main()
{
    int i,j;
    int n,p;
    while(~scanf("%d%d",&n,&p))
    {
        int sum;
        p=ceil(p*n*0.01);
        for(i=0;i=p)break;
            }
            if(sum>=p)break;
        }
        if(sum>=p)puts("possible");
        else puts("impossible");
    }
    return 0;
}


你可能感兴趣的:(随机化检测)