ccf 画图
来源:互联网 发布:js判断option是否选中 编辑:程序博客网 时间:2024/06/04 19:52
CCF 画图
#include <iostream>#include <string>#include <memory.h>#include <stack>using namespace std;int main(){ int n,m,q,tag,x1,y1,x2,y2; char c; stack<pair<int,int> > s; while(cin>>n){ cin>>m>>q; char mp[m][n]; memset(mp,'.',sizeof(mp)); for(int i=0;i<q;i++){ cin>>tag>>x1>>y1; if(tag==0){/**»Ïß*/ cin>>x2>>y2; if(x1==x2){/**»ÊúÏß*/ for(int j=min(y1,y2);j<=max(y1,y2);j++){ if(mp[j][x1]=='.') mp[j][x1]='|'; else if(mp[j][x1]=='-') mp[j][x1]='+'; } } else if(y1==y2){/**»ºáÏß*/ for(int j=min(x1,x2);j<=max(x1,x2);j++){ if(mp[y1][j]=='.') mp[y1][j]='-'; else if(mp[y1][j]=='|') mp[y1][j]='+'; } } } else if(tag==1){/**Ìî³ä*/ cin>>c; pair<int,int> t; s.push(make_pair(x1,y1)); while(!s.empty()){ t=s.top();s.pop(); if(mp[t.second][t.first]=='.') mp[t.second][t.first]=c; if(t.first>0&&mp[t.second][t.first-1]=='.') s.push(make_pair(t.first-1,t.second)); if(t.first<n-1&&mp[t.second][t.first+1]=='.') s.push(make_pair(t.first+1,t.second)); if(t.second>0&&mp[t.second-1][t.first]=='.') s.push(make_pair(t.first,t.second-1)); if(t.second<m-1&&mp[t.second+1][t.first]=='.') s.push(make_pair(t.first,t.second+1)); } } } for(int i=0;i<m;i++){ for(int j=0;j<n;j++) cout<<mp[i][j]; cout<<endl; } } return 0;}
0 0
- CCF 画图
- 【CCF】画图
- CCF 画图
- ccf 画图
- CCF 画图
- CCF-画图
- CCF画图
- 【CCF 画图】
- ccf 画图
- ccf 画图
- ccf画图
- ccf题目:画图
- 画图-CCF测试往届题
- ccf 201512-3 画图
- CCF-201512-3 画图
- CCF认证 201409 画图
- CCF 画图(1)
- CCF-201512-3-画图
- iOS剪切板 UIPasteboard
- 2410 \2440时钟体系架构
- 文章标题
- 笔记——service
- javase基础
- ccf 画图
- sublime text 3配置c/c++编译环境
- javascript函数节流
- 【Git/Github学习笔记】Github私钥的问题
- hdu 5438 Ponds 拓扑序+简单dfs
- [后端]部分注解说明
- 科尔多瓦(Cordova)系列1 -- Cordova是什么?
- 3幅图让你了解Spring AOP
- Java中系统属性Properties介绍 System.getProperty()参数大全