1 solutions
-
0
C++ :
#include<stdio.h> #include<string.h> char fan(char a) { if(a=='-') return '+'; else if(a=='+') return '-'; } int main() { // freopen("in.txt","r",stdin); // freopen("out.txt","w",stdout); int n; scanf("%d",&n); while(n--) { int m; int num[1025]; int i; char vfuhao,bfuhao='-'; int count = 0; int visitedv = 0; scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&num[i]); if(num[i]==1) { if(count<4) { int j; for(j=0;j<count;j++) printf("0"); } count = 0; printf("%c1",bfuhao); bfuhao = fan(bfuhao); if(visitedv == 0) { vfuhao = fan(bfuhao); } } else { count ++; if(count==4) { if(vfuhao==fan(bfuhao)) { printf("000%cV",vfuhao); vfuhao = fan(vfuhao); } else { printf("%cB00%cV",bfuhao,vfuhao); bfuhao = fan(bfuhao); vfuhao = fan(vfuhao); } count = 0; visitedv = 1; } } } printf("\n"); } return 0; }
- 1
Information
- ID
- 1327
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- (None)
- # Submissions
- 7
- Accepted
- 0
- Uploaded By