UVA227】的更多相关文章

书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 题目:算法竞赛入门经典 3-4/UVa455:Periodic Strings 代码: //UVa455 #include<iostream> int main() { char str[82]; int num; std::cin >> num; while (num--) { std::cin>>str; char *ps = str; while (*++ps != '\0') {…
步骤:1.把输入的数字和空格保存.(这里用到gets函数读取整行)2.定位空格.3.输入指令. #include<stdio.h> #include<string.h> ][];//声明数组 int main(){ memset(a,,sizeof(a)); ; ; ]; ]; //输入网格 gets(a[]); gets(a[]); gets(a[]); gets(a[]); gets(a[]); //定位空格 ; x<; x++) { ; y<; y++) { if…
题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=163 #   Problem Verdict Language Run Time Submission Date 13767338 227 Puzzle Accepted C++ 0.026 2014-06-19 02:39:04 13766276 227 Puzzle Wrong…
这道题目还是不难的,但是要注意gcc里面gets已经不能用了,用gets_s还是可以的,尽管我并不知道有什么区别 #include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char a[20][20]; int x, y; char s[1000]; int blank_x = 0, blank_y = 0; int flag = 1; gets_s(a[0]); gets_s(a[1]); get…
各位大佬都好厉害…… 这个ACM/ICPC1993总决赛算黄题%%% 我个人认为至少要绿题. 虽然算法上面不是要求很大 但是操作模拟是真的恶心…… 主要是输入输出的难. 对于ABLR只需要模拟即可 遇到非法指令退出 (输入输出真的很麻烦啊!!) 贴代码 #include<bits/stdc++.h> #define MAXN 5 using namespace std; char grid[MAXN][MAXN]; int blankrow, blankcol, nextrow, nextco…
题目描述:算法竞赛入门经典习题3-5 题目思路:模拟题 #include <stdio.h> #include <string.h> #define maxn 55 char gird[maxn][maxn] ; char cmd[maxn] ; int blank_x,blank_y ; int main(int argc, char *argv[]) { ; ;i<;i++) gets(gird[i]) ; ;i<;i++) ;j<;j++) if(gird[…
A children’s puzzle that was popular years ago consisted of a × frame which contained small squares of equal size. A unique letter of the alphabet was printed on each small square. Since there were only squares within the frame, the frame also contai…
题目: 题目浏览传送门 题意: 给出一个5*5的方格,里边有一个格子是空的,现在给出一串指令,A->空格向上移动,B->空格向下移动,R->空格向右移动,L->空格向左移动. 输出移动后的结果. 思路: 直接上模拟就好了,不过就是输入处理有点恶心,最好用scanf和printf来处理输入输出. 1.空格移动出界和出现不是‘A’.‘B’.‘R’.‘L’中的指令,这两种情况都算是“This puzzle has no final configuration.”. 2.另外在处理指令的时…
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> using namespace std; char maps[5][7]; char cmd[1001]; int main() { int cases = 0; while (gets(maps[0])) {…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟题.. 输入稍微恶心了点. getchar()一个一个搞就好. [代码] #include <bits/stdc++.h> using namespace std; const int N = 5; string s[N + 5],s2; char S[N + 5][N + 5]; int x, y; bool ok() { bool ok = true; for (char key = getchar();key !='…