网站首页 站内搜索

搜索结果

查询Tags标签: int,共有 27713条记录
  • 27

    1 #include <iostream>2 #include <string>3 using namespace std;4 template <class T>5 T SumArray(6 T *p,T *q){7 T sum = *p;8 while(++ p != q)9 sum += *p; 10 return sum; 11 } 12 int main() { 13 string array[4] = { "Tom…

    2022/9/14 6:19:07 人评论 次浏览
  • 28

    1 #include <iostream>2 #include <string>3 using namespace std;4 template<class T,class Pred>5 void MyForeach(T *p,T *q,Pred op){6 while(p != q){7 op(*p);8 ++ p;9 } 10 } 11 void Print(string s) 12 { 13 cout…

    2022/9/14 6:19:07 人评论 次浏览
  • 递归

    题目1 不用判断不用循环实现1+2+...+n 代码 #include<bits/stdc++.h> using namespace std;int sumNums(int n){int sum = 0;n && (sum = n + sumNums(n-1)); //为0时短路不执行递归,终止条件return sum; } int main(){int n; cin >> n;cout <<…

    2022/9/14 6:19:07 人评论 次浏览
  • Codeforces Round #821 (Div. 2)

    题目链接 Codeforces Round #821 (Div. 2) D.Fake Plastic Trees \(t\) 组数据,每组给定一个 \(n\) 个结点的树, 根为 \(1\) ,给定 \(2,3,\ldots ,n\) 的父结点 \(p_2,p_3,\ldots ,p_n\) 。再给出每个点权值 \(a_i\) 的范围 \([l_i,r_i]\) 。 初始每个点的权值均为 \(0…

    2022/9/14 6:19:06 人评论 次浏览
  • 25

    1 #include <iostream>2 using namespace std;3 class A {4 private:5 int nVal;6 public:7 void Fun()8 { cout << "A::Fun" << endl; };9 virtual void Do() 10 { cout << "A::Do" << e…

    2022/9/14 6:19:05 人评论 次浏览
  • 「题解」洛谷 P8512 [Ynoi Easy Round 2021] TEST_152

    有三个维度,序列维,操作维,询问维。 尝试扫描线,枚举一下扫哪个维能做。 或者考虑序列维上有颜色段均摊的性质。 这样不难想到在操作维上从小到大扫描线,或者说对询问维的 \(r\) 作扫描线,用 set 维护序列维上的连续段。 现在将询问 \((l,r)\) 挂在了 \(r\) 上,扫描…

    2022/9/14 6:19:05 人评论 次浏览
  • 「题解」洛谷 P8511 [Ynoi Easy Round 2021] TEST_68

    简要题意:给定带点权树,对每个点求出其子树补中选出两个数异或得到的最大值。 考虑整个树中的最优解是 \(a_x\oplus a_y\),那么除了 \(x\) 和 \(y\) 到根的链上这些点以外,其他的所有点答案都是 \(a_x\oplus a_y\). 这样只需要考虑如何求出一条到根的链的答案。 考虑…

    2022/9/14 6:19:05 人评论 次浏览
  • 977. 有序数组的平方

    理解 比较数组两端的元素,一定能比较出一个最大的数字 代码 class Solution {public int[] sortedSquares(int[] nums) {int left=0,right = nums.length - 1;int[] resultArr = new int[nums.length];int resIdx = nums.length-1;while (left <= right) {int leftVal…

    2022/9/14 6:19:02 人评论 次浏览
  • 矩阵游戏

    矩阵游戏 是一道氵题; 正好拿来练矩阵乘法; 题目传送门 https://www.luogu.com.cn/problem/P1397 显然老老实实的递推挂了; 那么 很容易想到矩阵加速 如何从F(1,1)转换到F(n,m) 每一列进行m-1次乘a加b的操作A 每一行进行n-1次乘c加d的操作B 可得 F(i,n)=F(i,1…

    2022/9/14 6:18:57 人评论 次浏览
  • mybatis 使用注解开发

    面向接口开发 三个面向区别 面向对象是指,我们考虑问题时,以对象为单位,考虑它的属性和方法; 面向过程是指,我们考虑问题时,以一个具体的流程(事务过程)为单位,考虑它的实现; 接口设计与非接口设计是针对复用技术而言的,与面向对象(过程)不是一个问题,更多的…

    2022/9/14 6:17:51 人评论 次浏览
  • 一百五十天一千题(DAY 1)

    一百五十天一千题 (DAY 1) 目前总题数: 0 目前CF分数: 1325 T1: (ABC 268)C - Chinese Restaurant // 题解 const int N = 1e6 + 10; /*模拟即可但是纯暴力是N^2的 会TLE考虑到要把 A[I] 移动到 p=I-1需要操作 a[i] - p % N 或者 (a[i]-p+1)%N或者 (a[i]-p-1)%N;用…

    2022/9/14 6:16:31 人评论 次浏览
  • android开发——RecyclerView通用adapter Kotlin版

    MyAdapter类 class MyAdapter<E>(val recyclerView:RecyclerView,val listItemId:Int,val dataResource:List<E>,val func: (data: Any?, view: View) -> Unit,var len:Int?=null):RecyclerView.Adapter<MyAdapter<E>.ViewHolder>() {init {…

    2022/9/14 6:16:25 人评论 次浏览
  • Codeforces Round #820 (Div. 3) F

    F. Kirei and the Linear Functiontime limit per test 3 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputGiven the string ss of decimal digits (0-9) of length nn. A substring is a sequence of consecutive characters of …

    2022/9/14 6:16:24 人评论 次浏览
  • 差分

    目录一、一维差分1.一维差分的定义2.一维差分的操作3.一维差分相关的例题二、二维差分1.二维差分的重要操作2.二维差分例题 一、一维差分 1.一维差分的定义 给定一个数组A它的差分数组B的定义为:$$B[i] = A[i] - A[i - 1](2 <= i <= n)$$ 2.一维差分的操作 一维差分…

    2022/9/14 6:16:20 人评论 次浏览
  • SQL 627 Swap Salary

    Table: Salary +-------------+----------+ | Column Name | Type | +-------------+----------+ | id | int | | name | varchar | | sex | ENUM | | salary | int | +-------------+----------+id is the primary key …

    2022/9/14 2:18:23 人评论 次浏览
扫一扫关注最新编程教程