1.6.5 图形化编辑器 Graphical Editor
思路&题解
PC/UVA 110105/10267
本题需要注意的就是,它指的(x,y)是x列y行
//author: CHC//First Edit Time: 2014-01-12 13:14//Last Edit Time: 2014-01-12 13:14//Filename:1.cpp#include <iostream>#include <cstdio>#include <string.h>#include <queue>#include <algorithm>using namespace std;int n,m;char map[300][300];int dx[]={ 0,0,1,-1 };int dy[]={ 1,-1,0,0 };void dfs(int x,int y,char color,char fill){ if(x<1||x>n||y<1||y>m)return ; if(map[x][y]!=co ...
1.6.4 液晶显示屏 LC-Display
思路&题解
PC/UVA 110104/704
本题。只需要模拟即可
//author: CHC//First Edit Time: 2014-01-11 12:58//Last Edit Time: 2014-01-11 13:47//Filename:1.cpp#include <iostream>#include <cstdio>#include <string.h>#include <queue>#include <algorithm>using namespace std;int s,n,len;char temp[1000];char tt[]="---------------------------------";void print(int i){ for(int j=0;j<len;j++) { int num=temp[j]-'0'; if(num==0) { ...
1.6.3 旅行 The Trip
思路&题解
PC/UVA 110103/10137
这题有点坑。没读好题。我的问题。
//author: CHC//First Edit Time: 2014-01-10 23:58//Last Edit Time: 2014-01-10 23:58//Filename:1.cpp#include <iostream>#include <cstdio>#include <string.h>#include <queue>#include <algorithm>using namespace std;int n;double a[1010];char temp[1000];int main(){ while(~scanf("%d",&n)&&n) { double sum=0; for(int i=0;i<n;i++) { scanf("%lf" ...
1.6.2 扫雷 Minesweeper
思路&题解
PC/UVA 110102/10189
水题。看样例输入输出即可明白题意。我的做法是用一个hash直接处理就成
//author: CHC//First Edit Time: 2014-01-10 23:39//Last Edit Time: 2014-01-10 23:39//Filename:1.cpp#include <iostream>#include <cstdio>#include <string.h>#include <queue>#include <algorithm>using namespace std;int n,m;char map[120][120];int main(){ int cas=0; int flag=0; while(~scanf("%d%d",&n,&m)&&(n||m)) { if(flag)puts(""); mem ...
1.6.1 3n+1问题 The 3n+1 problem
思路&题解
PC/UVA 110101/100
水题。数据范围大。需要预处理。之前处理过的+处理到这个地方的
//author: CHC//First Edit Time: 2014-01-10 18:30//Last Edit Time: 2014-01-10 18:30//Filename:1.cpp#include <iostream>#include <cstdio>#include <string.h>#include <queue>#include <algorithm>using namespace std;long long cs[1000001]={ 0 };int main(){ for(int j=1;j<1000001;j++) { int i=1; long long n=j; while(n!=1) { if(n%2)n=n*3+1; ...