11.一个游戏,前20关是每一关自身的分数,1-30关每一关是10分,31-40关,每一关是20分,1-49关,每一关是30分,第50关是100分,输入你现在闯到的关卡数,求你现在拥有的分数.利用if嵌套for. Console.Write("输入你闯的关卡数:"); int a = int.Parse(Console.ReadLine()); sum = 0; if(a<=20) { for (int i = 1; i <=a;i++ ) { sum += i; } }…
18.11 Imagine you have a square matrix, where each cell (pixel) is either black or white. Design an algorithm to find the maximum subsquare such that all four borders are filled with black pixels. LeetCode上的原题,请参见我之前的解法Maximal Square.书上给了两种解法,但是比较长:…