Heim > Artikel > Web-Frontend > BestCoder Round #11 (Div. 2)_html/css_WEB-ITnose
太菜,只能去Div2.(都做不完 ORZ。。。
分别是 HDU:
5054 Alice and Bob
5055 Bob and math problem
5056 Boring count
5057 Argestes and Sequence
# 1001
碰面只能在坐标中间。
所以判断一下就好了。
#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,b) for(int i= a;i=b ;i--)#define debug puts("==fuck==")#define acfun std::ios::sync_with_stdio(false)#define SIZE 20+10using namespace std;int main(){ int n,m; double x,y; while(~scanf("%d%d%lf%lf",&n,&m,&x,&y)) { double x1,y1,x2,y2; x1=x,y1=y; x2=n-x,y2=m-y; if(abs(x1-x2) <br> <p></p> <p><br> </p> <p># 1002 <br> </p> <p>检查数字,题解给的是贪心。</p> <p>我DFS写的。。。居然没人Hack我……</p> <p>5</p> <p>1 0 0 0 0 <br> </p> <p>-1</p> <p>这组数据小心了。</p> <p>5</p> <p>1 1 0 0 0</p> <p>10001</p> <p>还有这。</p> <p><br> </p> <p></p> <pre name="code" class="sycode">#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,b) for(int i= a;i=b ;i--)#define debug puts("==fuck==")#define acfun std::ios::sync_with_stdio(false)#define SIZE 20+10using namespace std;int a[10],n;bool cmp(int a,int b){ return a>b;}int num[101];bool outflag;void dfs(int m){ if(outflag)return; if(m==n) { if(num[m-1]&1) { FOR(j,0,n) printf("%d",num[j]); printf("\n"); outflag=1; } else return; } FOR0(j,9,0) { if(a[j]) { a[j]--; num[m]=j; dfs(m+1); a[j]++; } }}int main(){ while(~scanf("%d",&n)) { bool flag=0; int odd=0; int even=0; CLR(a,0); outflag=0; FOR(i,0,n) { int tmp; scanf("%d",&tmp); if(tmp&1)flag=1; a[tmp]++; if(tmp&1)odd++; else if(tmp!=0)even++; } if(!flag||(n!=1&&odd==1&&even==0)) { puts("-1"); continue; } dfs(0); }}</cmath></vector></set></list></iostream></stack></map></algorithm></queue></string></cstring></cstdio>
# 1003 知道是维护一个数列。时间复杂度是O(n)的。
ORZ,写了半天,还是没写出来,这周慢慢写吧,先挂这。
#
wait...
#
# 1004 我用线段树的,结果MLE。卡内存有意思?
有人说可以试试 unsigned short 看能不能过。
慢慢交吧。反正在HDU41页。
#
wait...
#