题目: Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than…
题目链接:http://poj.org/problem?id=2386 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either wa…
POJ 2243 Knight Moves A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboard exactly once. He thinks t…
推箱子 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6416 Accepted Submission(s): 1834 Problem Description 推箱子是一个很经典的游戏.今天我们来玩一个简单版本.在一个M*N的房间里有一个箱子和一个搬运工,搬运工的工作就是把箱子推到指定的位置,注意,搬运工只能推箱子而不能拉箱子,…
Fliptile Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 16558 Accepted: 6056 Description Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in whic…
//题意是 K N, M; //有K个牛 N个牧场,M条路 ,有向的 //把K个牛放到任意的n个不同牧场中,问所有牛都可以到达的牧场数的总和 //这是一道简单的DFS题 //k 100 //n 1000 //m 10000 #include <iostream> #include <cstdio> #include <vector> #include <cstring> using namespace std; int k, n, m; int a[10…
A - 棋盘问题 POJ - 1321 注意条件:不能每放一个棋子,就标记一行和一列,我们直接枚举每一行就可以了. AC代码: #include<iostream> #include<stdio.h> #include<cstring> using namespace std; # define ll long long ; char str[maxn][maxn]; int vis[maxn]; int n,m,num; void dfs(int u,int cnt)…