首页 > TAG信息列表 > 1190

菜学C++ Day56 OJ题目1190 对角线I

我的解法:直接是两个for循环当i==j的时候输出1 #include<iostream> #include<iomanip> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j)cout << setw(3) << 1;

[LeetCode] 1190. Reverse Substrings Between Each Pair of Parentheses 反转每对括号间的子串

You are given a string s that consists of lower case English letters and brackets. Reverse the strings in each pair of matching parentheses, starting from the innermost one. Your result should not contain any brackets. Example 1: Input: s = "(abcd)&q

1190:生日蛋糕,深搜逻辑思路、枚举、剪枝

原题:http://bailian.openjudge.cn/practice/1190/ 描述 7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。设从下往上数第i(1 <= i <= M)层蛋糕是半径为Ri, 高度为Hi的圆柱。当i < M时,要求Ri > Ri+1且Hi > Hi+1。由于要在蛋糕上抹奶油,为尽可能

POJ-1190 生日蛋糕(dfs+剪枝)

生日蛋糕 题目链接http://poj.org/problem?id=1190 Time Limit: 1000MS Memory Limit: 10000K Description 7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。 设从下往上数第i(1 <= i <= M)层蛋糕是半径为Ri, 高度为Hi的圆柱。当i < M时,要

1190. 反转每对括号间的子串

给出一个字符串 s(仅含有小写英文字母和括号)。 请你按照从括号内到外的顺序,逐层反转每对匹配括号中的字符串,并返回最终的结果。 注意,您的结果中 不应 包含任何括号。   示例 1: 输入:s = "(abcd)" 输出:"dcba" 示例 2: 输入:s = "(u(love)i)" 输出:"iloveu" 示例 3: 输入:s = "(ed(et