Too bad, I can only go to Div2. (I can’t finish ORZ...
HDU respectively:
5054 Alice and Bob
5055 Bob and math problem
5056 Boring count
5057 Argestes and Sequence
# 1001
The meeting can only be in the middle of the coordinates.
#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 FOR0(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)<=eps&&abs(y1-y2)<=eps) puts("YES"); else puts("NO"); }}
# 1002
Check the number, the solution is greedy. 🎜>I wrote it from DFS. . . No one hacked me... >Be careful with this set of data
5
1 1 0 0
10001
And this. >
# 1003 Know that the time complexity is O(n). 🎜>ORZ, I’ve been writing for a long time, but I still haven’t finished it. I’ll write it slowly this week, and hang this up first. #
Submit it slowly. Anyway, it’s on page HDU41.
#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 FOR0(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); }}
#