Problem List
LaTeX
marckerchar
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
const int n=24,m=90;
static mt19937 rd(time(0)),rd1(rd()),rd2(rd1());
string mp[100];
void gotoxy(int x,int y){
COORD pos={x,y};
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut,pos);
}
void hideCursor(){
HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cursorInfo;
GetConsoleCursorInfo(hConsole,&cursorInfo);
cursorInfo.bVisible=FALSE;
SetConsoleCursorInfo(hConsole,&cursorInfo);
}
#define BL (char(5))
char input(){if(_kbhit()) return _getch();}
char waitput(){while(_kbhit()) return _getch();}
struct bcgrd{
int h[1000000],l;
int tot,cnt=0,limcnt=100;
const int liml=15,limr=m-15;
void buildl(int x){
int op=(rd()+rd1()+rd2())%7,nh=h[x+1];
if(op==0&&nh>3) nh--;
else if(op<2&&nh<n) nh++;
else if(nh>18&&op==3&&nh<n) nh++;
else if(nh>18&&18<nh&&nh<n&&op<5&&h[x+1]-h[x+2]>0) nh--;
h[x]=nh;
}
void buildr(int x){
int nh=h[x-1],op=(rd()+rd1()+rd2())%7;
if(op==0&&nh>3) nh--;
else if(op<2&&nh<n) nh++;
else if(nh>18&&op==3&&nh<n) nh++;
else if(nh>18&&18<nh&&nh<n&&op<5&&h[x-1]-h[x-2]>0) nh--;
h[x]=nh;
}
void pushout(int x){
for(int i=n;i>h[x];i--) mp[i][x-l]=BL;
mp[h[x]][x-l]='*';
if(h[x]>18) mp[h[x]][x-l]='&';
for(int i=h[x]-1;i>=19;i--) if(mp[i][x-l]==BL||mp[i][x-l]=='*'||mp[i][x-l]==' '||mp[i][x-l]=='&') mp[i][x-l]='~';
for(int i=min(h[x]-1,18);i>=1;i--) if(mp[i][x-l]==BL||mp[i][x-l]=='*'||mp[i][x-l]=='&') mp[i][x-l]=' ';
}
int get(int x){
return h[x+l];
}
void tole(){
l--;
if(!h[l+1]) buildl(l+1);
}
void tori(){
l++;
if(!h[l+m]) buildr(l+m);
}
}grd;
struct vec{
int x,y;
vec operator +(const vec &q) const{
return vec{x+q.x,y+q.y};
}
};
const int dirup=72,dirdown=80,dirle=75,dirri=77,Stay=40,Stay1=200;
const vec g={1,0};
struct point{
int x,y;char skin;
int cntput;
bool operator == (const point &q) const{
return q.x==x&&q.y==y;
}
bool inmap(){
return x>0&&x<=n&&y>0&&y<=m;
}
void put(){mp[x][y]=skin;}
void tole(){
if(y>grd.liml) y--;
else grd.tole();
}
void tori(){
if(y<grd.limr) y++;
else grd.tori();
}
void move(char op){
if(inmap()) mp[x][y]=' ';
if(op==dirup&&x>1){
if(x>=grd.get(y)-1) x-=2,cntput=0;
else if(x>18) x--,cntput=0;
}
if(op==dirdown&&x<n) x++;
if(op==dirle&&y>1){
if(x<grd.get(y-1)) tole();
else if(x==grd.get(y-1)&&x>=grd.get(y)-1) x--,tole();
}
if(op==dirri&&y<m){
if(x<grd.get(y+1)) tori();
else if(x==grd.get(y+1)&&x>=grd.get(y)-1) x--,tori();
}
if(inmap()) mp[x][y]=skin;
}
bool onground(){
if(x>=grd.get(y)-1) return 1;
else return 0;
}
void remove(){
cntput++;
if(inmap()) mp[x][y]=' ';
if((cntput>=Stay&&x<=18)||(cntput>=Stay1&&x>18)) x+=g.x,x=min(x,n),cntput=0;
if(inmap()) mp[x][y]=skin;
}
};
struct character{
string name;
int blood,health,energe;
point ad;
}me;
struct cardlist{
string line1,line2,line3;
const int sz=4,dis=3;
int num;
int getpos(int x){
if(x>num||x<1) return -1;
return sz*(x-1)+dis*x;
}
int add(string skin){
num++;
int l=getpos(num),r=l+sz-1;
for(int i=l;i<=r;i++) line1[i]='_',line3[i]='_';
line2[l]='|',line2[r]='|',line3[l]='\\',line3[r]='/';
int poss=l+r>>1;
line2[poss]=skin[0],line2[poss+1]=skin[1];
}
void write(){
cout<<line1<<'\n'<<line2<<'\n'<<line3<<'\n';
}
}card;
const string skill[20]={"","刃","疾","瞬","破","升","木","火","风","水","冰","雷","光","电","幻","声","召","灭","凌","旋"};
void init(){
hideCursor();
for(int i=0;i<=m+1;i++) mp[0]+='#',mp[n+1]+='#';
for(int i=1;i<=n;i++){
mp[i]+='#';
for(int j=1;j<=m;j++) mp[i]+=' ';
mp[i]+='#';
}
card.num=0;
for(int i=1;i<=100;i++) card.line1+=' ',card.line2+=' ',card.line3+=' ';
grd.h[500001]=rd()%5+15,grd.l=500000,grd.pushout(500001);
for(int i=2;i<=m;i++) grd.buildr(i+grd.l),grd.pushout(i+grd.l);
me.ad={5,45,'@'};
me.ad.put();
}
void putscreen(){
gotoxy(0,0);
for(int i=1;i<=m;i++) grd.pushout(i+grd.l);
grd.cnt++;
if(grd.cnt>=grd.limcnt) grd.cnt=0,grd.tot++;
if(grd.tot>=10) grd.tot=0;
for(int i=0;i<=n+1;i++) cout<<mp[i]<<'\n';
card.write();
}
void getin(){
auto x=input();
me.ad.move(x);
}
void control(){
if(!me.ad.onground()) me.ad.remove();
}
int main(){
init();
while(1){
putscreen();
getin();
control();
}
return 0;
} 鼠标连点器
POJ ID:5341563165
新标签页:
lbiyoii959@bbttu.com翻译:
oehyver861@vbbsc.storemcblock.top
xiwhqth759@bbttu.comblender
vdfolic414@bbttu.com
