摘要:
```cpp include include using namespace std; int f[102]; int found(int x){ return f[x] = f[x] == x ? x : found(f[x]); // if(x == f[x]) // return x; // 阅读全文
摘要:
题目大意:在一个数字串中找到连个连续的字串(这两个字串可以相邻),使得两个字串和最大。 思路:最大字串的变形。找出每个数字左边和最大的串,右边和最大的串, 然后左右相加算出最大的和。 代码如下: cpp include include include define MAX 0x6fffffff us 阅读全文
摘要:
for循环的使用 1 在list 或 dictionary 使用
list = [1,2,3,4,5,6]
for i in list: list print(i) for item in dic: dictionary print(dic[item]) 2 使用range()函数,该函数... 阅读全文