poj 5444
来源:互联网 发布:yezubuluotop永久域名 编辑:程序博客网 时间:2024/06/01 17:36
这题。。其实我对树这玩意还是有点恐惧的。。(:зゝ∠)
直接模拟不就好了!
#include<stdio.h>#include<iostream>#include<string>#include<string.h>#include<algorithm>#include<iomanip>#include<vector>#include<time.h>#include<queue>#include<stack>#include<iterator>#include<math.h>#include<stdlib.h>#include<limits.h>#include<map>#include<set>#include<bitset>//#define ONLINE_JUDGE#define eps 1e-5#define INF 0x7fffffff#define FOR(i,a) for((i)=0;i<(a);(i)++)#define MEM(a) (memset((a),0,sizeof(a)))#define sfs(a) scanf("%s",a)#define sf(a) scanf("%d",&a)#define sfI(a) scanf("%I64d",&a)#define pf(a) printf("%d\n",a)#define pfI(a) printf("%I64d\n",a)#define pfs(a) printf("%s\n",a)#define sfd(a,b) scanf("%d%d",&a,&b)#define sft(a,b,num) scanf("%d%d%d",&a,&b,&num)#define for1(i,a,b) for(int i=(a);i<b;i++)#define for2(i,a,b) for(int i=(a);i<=b;i++)#define for3(i,a,b)for(int i=(b);i>=a;i--)#define MEM1(a) memset(a,0,sizeof(a))#define MEM2(a) memset(a,-1,sizeof(a))#define ll __int64const double PI=acos(-1.0);template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}template<class T> inline T Min(T a,T b){return a<b?a:b;}template<class T> inline T Max(T a,T b){return a>b?a:b;}using namespace std;//#pragma comment(linker,"/STACK:1024000000,1024000000")int n,m,q;#define M 1110#define N 100010#define Mod 1000000000#define p(x,y) make_pair(x,y)const int MAX_len=550;int a[1010];int main(){#ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin);// freopen("out.txt", "w", stdout);#endif int T; sf(T); while(T--){ sf(n); for(int i=0;i<n;i++) sf(a[i]); sf(m); int x; for(int i=0;i<m;i++){ sf(x); int tmp = a[0]; if(x == a[0]){ printf("\n"); continue; } int flag = (x>a[0]?1:0); for(int j=1;j<n;j++){ if(flag){ while(j<n&&a[j]<tmp)j++; tmp = a[j]; printf("W"); if (x < a[j]) flag = 0; } else if(!flag){ while(j<n&&a[j]>tmp)j++; tmp = a[j]; printf("E"); if(x>a[j]) flag=1; } if(a[j] == x) break; } printf("\n"); } } return 0;}
0 0
- poj 5444
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- zip函数解析
- C++的STL进一步总结之set
- Apache CXF Tutorial – WS-Security with Spring
- String to Integer (atoi)
- 正则表达式提取电话号码
- poj 5444
- 第七章 Transact-SQL 查询
- 博客链接
- nyoj--27--水池数目
- matlab用几张图片形成一个三维图
- linux和windows 中 File.separator代替 / ,解决路径问题
- 单线程下载和多线程下载
- 电商系统中的商品模型的分析与设计
- ZOJ 2747 Windows Message Queue