![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
UVA
moyangxian
总会过去的
展开
-
UVA - 11971 Polygon(概率)
题意:一根长为n的木条,切k次,切成k+1条小木条,求这些小木条能组成一个多边形的概率。题记:首先反过来思考,k+1条小木条怎样才不能组成一个多边形。当其中有一根木条的长度大于等于其他所有木条的总和时,这些小木条不能形成一个多边形。然后将这根长木条首尾相连形成一个圆。然后变成切k+1次(因为将首尾连起来了,所以要切多一刀)。当这k+1次都砍在同一个半圆上,那么有一根木条的长度必定大于等于n/2。第一刀切在圆上哪个位置都是一样的,所以概率是1,其余k刀砍在同一个半圆的概率为1/2。k+1刀都在同一个半圆上原创 2020-09-02 11:40:52 · 116 阅读 · 0 评论 -
UVA 202 Repeating Decimals
原题链接题记:参考了大佬的代码https://blog.csdn.net/mobius_strip/article/details/39870555#include<iostream>#include<cstdio>#include<cstring>using namespace std;int r[3003], u[3003], s[3003...原创 2020-02-05 15:45:24 · 81 阅读 · 0 评论 -
UVA 1368 DNA Consensus String
题目链接题记:多解时要按字典序输出#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;char str[51][1001];char ans[1001];struct node{ char c...原创 2020-02-05 14:29:44 · 69 阅读 · 0 评论 -
UVA 1225 Digit Counting
Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers starting with 1 to N (1 < N < 10000) . After that, he counts the nu...原创 2020-02-04 13:50:08 · 75 阅读 · 0 评论