zju 1002】的更多相关文章

// zju 1002 // #include "stdafx.h" #include <string> #include <iostream> using namespace std; int N = 4; int Max = 0; char a[5][5]; int judge(int row, int col)//测试该坐标是否可以放置 返回 0 可放置,返回 1 不可放置 { for (int i = row - 1; i >= 0; i--)//…
ZOJ Problem Set - 1002 Fire Net Time Limit: 2 Seconds      Memory Limit: 65536 KB Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A…
Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small castle that has four openings through which to shoot. The fo…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1002 题目大意: 给你一个n*n的地图,地图上的空白部分可以放棋子,也有墙,问最多能放多少棋子使得棋子两两不会袭击? 棋子袭击当且仅当处在同一行或者同一列上并且中间没有墙的阻隔. 真是好久没写过搜索题了..这道题都写了这么久!! 直接写dfs(x,y,now) 代表我现在站在x点,y点上,那么就只能产生两种状态,放棋子或者不放棋子. 然后写一个C(x,y)代表当…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1002 题意:给出一个n,有n*n大小的城市,(.)表示空地,从碉堡(O)射出来的子弹可以前后左右四个方向发射,只有墙壁(X)可以挡住子弹,所以同一行同一列不能出现两座碉堡,除非它们中间有墙壁隔着,问最多能放多少座碉堡. 思路:一个个点遍历,看符不符合条件,符合条件座数+1然后继续下一点. #include<iostream> using namespace std; ]…
主题链接:http://pat.zju.edu.cn/contests/pat-b-practise/1002 读入一个自然数n,计算其各位数字之和.用汉语拼音写出和的每一位数字. 输入格式:每一个測试输入包括1个測试用例.即给出自然数n的值.这里保证n小于10100. 输出格式:在一行内输出n的各位数字之和的每一位.拼音数字间有1 空格.但一行中最后一个拼音数字后没有空格. 输入例子: 1234567890987654321123456789 输出例子: yi san wu 代码例如以下: #…
已转战浙大 题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=2 浙大acm 1002 #include <iostream> #include <cstdlib> #include <cmath> #include <list> #define OPEN 1 #define CASTLE 2 #define BLOCK 3 #define WALL 4 // summary: 用贪心…
Bestcoder#5 1002 Poor MitsuiTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 336    Accepted Submission(s): 70 Problem Description Because of the mess Mitsui have made, (not too long ago, Mitsui,…
最近突然想往算法方向走走,做了做航电acm的几道题 二话不说,开始 航电acm 1002 题主要是处理长数据的问题,算法原理比较简单,就是用字符数组代替int,因为int太短需要处理的数据较长 下面是问题描述: Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.     Input The f…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5610 如果杠铃总质量是奇数直接impossible 接着就考验耐心和仔细周全的考虑了.在WA了三次后终于发现问题了,想对自己说是不是撒 首先最好从大的那个开始考虑,我的方案就是两数交换一下,结果输出的时候没有考虑... 然后就是要求a+b最小,那么循环就要从大的开始向小的循环. 其实我也解释不清楚,更解释不清楚的是学长取名的Baby Nero,一直以为铭铭姐是女的的我,在看到真的铭神的照片的时候惊呆了…