ICode9

精准搜索请尝试: 精确搜索
  • 异或 应用2022-09-14 05:00:08

    public static void process1(int[] arr) { int eor = 0; for (int ar : arr) { eor ^= ar; } // eor = a ^ b 两个奇数 结果为 1 // eor != 0 // eor 必然有一个位置上是 1 /* 提取罪右侧的 1

  • 异或 两数交换2022-09-14 04:30:08

    public static void process1() { // a, b 指向内存空间位置必须时两块控不同的空间 // 数组中 a, b 不能相等 int a = 17; int b = 23; // a, b 交换值,不需在开阔空间 a = a ^ b; b = a ^ b; a = a ^ b; System.out.println(a); System.

  • 差分2022-09-14 01:33:33

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

  • 湖南大学结对编程之个人项目互评2022-09-14 01:33:16

    本篇博客为对结对编程搭档邹同学的个人项目(中小学数学卷子自动生成程序)的评价。该代码使用语言为Java,与我的个人项目语言一致,本次评价旨在总结反省,共同进步。 此次评价主要基于三个方面: 一、代码结构 mathpaper包: Create类主要用来出题 User类用来对用户类型定义 Begin类包

  • Codeforces Round #820 (Div. 3) F2022-09-14 01:30:24

    F. Kirei and the Linear Function time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Given the string ss of decimal digits (0-9) of length nn. A substring is a sequence of consecutive charact

  • android开发——RecyclerView通用adapter Kotlin版2022-09-14 01:01:40

    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<

  • 一百五十天一千题(DAY 1)2022-09-14 00:33:24

    一百五十天一千题 (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; 用一个东西储

  • mybatis 使用注解开发2022-09-14 00:03:31

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

  • 矩阵游戏2022-09-14 00:00:44

    矩阵游戏 是一道氵题; 正好拿来练矩阵乘法; 题目传送门 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)* ( A^(m-1)); (^表示次方) 同理 每

  • 算法题整理2022-09-14 00:00:23

    1.最长回文子串 class Solution { public: string isPalindrome(string& s, int left, int right) { while (left >= 0 && right <= s.length() - 1 && s[left] == s[right]) { left --; right ++; }

  • 结对编程-队友代码分析2022-09-13 23:34:01

      通过一周的时间,我们完成了个人项目。我的代码是用c++编写的,我的队友罗军杰是用JAVA写的。在看完我的代码和罗军杰的代码后,发现各有优缺点。 项目需求简述: 项目名称:中小学数学卷子自动生成程序 用户:小学、初中和高中数学老师。 功能: 1、命令行输入用户名和密码,两者之间用空格

  • 977. 有序数组的平方2022-09-13 23:32:34

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

  • 结对编程之个人项目代码互评2022-09-13 23:32:17

    结对编程之个人项目代码互评 简介 这篇文章是我的结对编程搭档刘正豪——豪神的个人项目代码的总结评价。 豪神使用Java语言实现中小学数学卷子自动生成程序的预期功能,代码结构清晰,其中的某些函数不乏亮点。 项目需求 针对小学、初中和高中数学老师为主体用户的程序 要完成的功能

  • 「题解」洛谷 P8511 [Ynoi Easy Round 2021] TEST_682022-09-13 23:05:11

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

  • 「题解」洛谷 P8512 [Ynoi Easy Round 2021] TEST_1522022-09-13 23:04:45

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

  • 252022-09-13 23:04:26

    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&quo

  • Codeforces Round #821 (Div. 2)2022-09-13 23:04:12

    题目链接 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-09-13 23:03:45

    题目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 << sumNums(n); }

  • 282022-09-13 23:03:34

    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

  • 272022-09-13 23:03:22

    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]

  • 302022-09-13 23:02:20

    1 #include <iostream> 2 using namespace std; 3 class MyCin 4 { 5 bool value; 6 public: 7 MyCin():value(true){ } 8 operator bool(){return value;} 9 MyCin& operator>>(int& n){ 10 cin >> n; 11 if

  • 292022-09-13 23:01:14

    1 #include <iostream> 2 #include <string> 3 using namespace std; 4 template<class T,class Pred> 5 T* Filter(T* p,T* q,T* s,Pred op){ 6 while(p < q){ 7 if(op(*p)){ 8 *s = *p; 9 ++ s; 10

  • 322022-09-13 23:00:26

    1 #include <iostream> 2 #include <string> 3 #include <cstring> 4 using namespace std; 5 template <class T> 6 class myclass { 7 private: 8 T* p; 9 int size; 10 public: 11 myclass(T* _p,int _size = 0):size(_siz

  • 312022-09-13 23:00:08

    1 #include <iostream> 2 #include <string> 3 4 using namespace std; 5 template <class T> 6 class CMyistream_iterator 7 { 8 private: 9 istream& in; 10 T value; 11 public: 12 CMyistream_iterator(istream& _in):i

  • 2021年中国大学生程序设计大赛(哈尔滨)Gym 1034472022-09-13 22:34:10

    B Magical Subsequence E Power and Modulo I Power and Modulo 二进制,思维,二分 题意 给你一个序列 \(A_n\),你可以进行多次操作; 每次操作可以选择一个任意长度的序列 \(B_m\) ,然后使得\(A_{B_i}-2^{i-1}\)。问你最少多少次操作可以将\(A_n\)序列变为零。 题解 可以发现 将A_n$

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有