题目链接:https://codeforc.es/gym/101981/attachments 题意:在 n * m 的平面上有若干个袋鼠和墙(1为袋鼠,0为墙),每次可以把所有袋鼠整体往一个方向移动一步(不能走出边界和不能走到墙),为在不超过5e4步的情况下能否把全部袋鼠聚集在同一个位置. 题解:先预处理每个袋鼠到其他袋鼠的初始方向,然后每次选两个不同的袋鼠,其中一个向另一个逼近,直到聚集在一起,然后重复该操作.因为n,m <= 20,所以最多只有400个袋鼠,而每两个不同的袋鼠逼近的过程中最…
题意: 数一个金字塔里面有多少个正三角形. 题解: ans[n]=n*(n-1)*(n-2)*(n-3)/24 #include<bits/stdc++.h> using namespace std; typedef long long ll; ; )/; int main() { long long i,j,k,n,m,t; scanf("%lld",&t); while(t--) { scanf("%lld",&n); ll ans=…
题目链接:http://codeforces.com/gym/101981/problem/K Your friend has made a computer video game called “Kangaroo Puzzle” and wants you to give it a try for him. As the name of this game indicates, there are some (at least 2) kangaroos stranded in a puzzle…
题意 在 n * m 的平面上有若干个袋鼠和墙(1为袋鼠,0为墙),每次可以把所有袋鼠整体往一个方向移动一步(不能走出边界和不能走到墙),为在不超过50000步的情况下能否把全部袋鼠聚集在同一个位置.(类似于2048游戏) 分析 看到网上的题解惊了, 不知道这样做为什么能A,但是写起来真的简单. #include<bits/stdc++.h> using namespace std; int n, m; ]; char dirc[] = {'U', 'D', 'L', 'R'}; int ma…