const 变量能被其他文件 extern 引用吗?为什么? 先来看一段代码: // 来源:公众号编程珠玑 // main.cc #include<stdio.h> // 引用外部定义的const_int变量 extern const int const_int; int main() { prin ...
分类:
其他好文 时间:
2021-07-13 17:45:44
阅读次数:
0
# 1.算数运算符import b as bx = 10y = 3.1z = 3print(x + y)print(x*z)print(x/z) # 结果带小数print(x//z) # 结果只保留整数print(x % z) # 取模,取余数print(x**z) # 取幂# 2.比较运算prin ...
分类:
编程语言 时间:
2021-06-25 17:11:14
阅读次数:
0
package com.Leo.array;public class ArrayDemo02 { public static void main(String[] args) { //静态初始化:创建 + 赋值 int[] a = {1,2,3,4,5,6,7,8}; System.out.prin ...
分类:
编程语言 时间:
2021-06-10 18:01:59
阅读次数:
0
题目链接 #题目大意 求n个数的子序列的最大异或和。 #解题思路 求出n个数的线性基并排序,然后将k二进制异或上线性基中对应的代表元素即可。 #代码 const int maxn = 2e5+10; ll arr[maxn]; vector<ll> b; //b中存的每个二进制位的代表元素 void ...
分类:
其他好文 时间:
2021-06-02 13:29:58
阅读次数:
0
题目: http://acm.hdu.edu.cn/showproblem.php?pid=5241 题面: Sample Input 2 0 2 Ouput Case #1: 1 Case #2: 1024 题意: M会使用n种语言,M的九个朋友会的语言都是M的子集,并且给出九个朋友会的语言的关系 ...
分类:
其他好文 时间:
2021-05-24 03:13:28
阅读次数:
0
原题链接 考察:floyd 思路: 很明显的传递闭包,但是我们直接敲板子上去会TLE.神级剪枝在floyd的第三重循环,如果g[i][k] = 0那么第三重循环没必要进行. 1 #include <iostream> 2 #include <cstring> 3 using namespace st ...
分类:
其他好文 时间:
2021-05-23 23:11:48
阅读次数:
0
可以用next()方法依次取值的对象称为迭代器。 生成器是迭代器。 列表不是迭代器,列表是可迭代对象,列表可以通过iter(list)转化为迭代器。 一、生成器 1、定义 x = [1,2,3,4] y = (i for i in x) print(type(y)) for a in y: prin ...
分类:
其他好文 时间:
2021-04-29 11:59:26
阅读次数:
0
原题链接 考察:搜索 思路: 预处理有子弹和城堡的坐标,这部分除了暴力没有更好的办法.因为还有一个时间限制,所以需要三维数组.剩下就是BFS. 剪枝: 1.相同时间的拜访点不必再访问. 2.当离终点的曼哈顿距离>能量 不必再走下去. 注意:城堡处一定要预处理再判断子弹. 1 #include <io ...
分类:
其他好文 时间:
2021-04-22 16:32:51
阅读次数:
0
我对模拟退火的初步理解,还没深入了解过。这里只是用模拟退火求函数极值。 题目:https://vjudge.net/problem/HDU-2899 #include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_std ...
分类:
编程语言 时间:
2021-04-20 15:29:36
阅读次数:
0
题目: 我们提供一个类: class FooBar { public void foo() { for (int i = 0; i < n; i++) { print("foo"); } } public void bar() { for (int i = 0; i < n; i++) { prin ...
分类:
编程语言 时间:
2021-04-19 14:40:03
阅读次数:
0