2014年1月13日

SGU 467 Chessmaster 几何

摘要: ------------------int n;int main(){ int cas=0; while (~scanf("%d",&n)){ int ans=0; if (n==0) ans=0; else if (n<=78) ans=1; else if (n<=95) ans=2; else if (n<=99) ans=3; else ans=4; printf("Case #%d: %d\n",++cas,ans); } return 0;}------------------ 阅读全文

posted @ 2014-01-13 20:40 电子幼体 阅读(176) 评论(0) 推荐(0) 编辑

POJ 2784 Buy or Build 最小生成树

摘要: 枚举方案后做最小生成树。------------const int maxn=1100;const int maxm=10000;int n,q;vectorg[10];int c[10];struct Point{ int x,y; int getValueTo(Point p){ return (p.x-x)*(p.x-x)+(p.y-y)*(p.y-y); }}p[maxn];struct EDGE{ int u,v,d; bool operator<(const EDGE& rhs) const{ return d<rhs.d;... 阅读全文

posted @ 2014-01-13 20:39 电子幼体 阅读(201) 评论(0) 推荐(0) 编辑

URAL 1023 Buttons 博弈

摘要: 当K是L+1的倍数时,先手必败。又因为L>=2,特殊考虑2*p的数据。--------#include #include using namespace std;int main(){ int K,i,L; while (cin>>K){ for (i=3;i4) L=K/2-1; else L=K-1; cout<<L<<endl; } return 0;}-------- 阅读全文

posted @ 2014-01-13 20:37 电子幼体 阅读(109) 评论(0) 推荐(0) 编辑

导航