ICode9

精准搜索请尝试: 精确搜索
  • LOJ6275口胡2022-07-02 15:36:40

    为什么 \(n\) 只有 \(3\) 啊( 设 \(f[S][n][k]\) 是前 \(n\) 行,最后一行黑子的状态是 \(S\) 时,有 \(k\) 个连通块的方案数。 设 \(f(S1,S2)\) 表示当上一行状态为 \(S1\) 这一行状态为 \(S2\) 时增加(减少)的连通块数量。 \(S1,S2\) 需要使用最小表示法,不过无所谓。 那么显然有 \(f[B

  • 567.字符串中的排列2022-07-02 15:00:42

    滑动窗口 567.字符串中的排列 给你两个字符串 s1 和 s2 ,写一个函数来判断 s2 是否包含 s1 的排列。如果是,返回 true ;否则,返回 false 。 换句话说,s1 的排列之一是 s2 的 子串 。 示例 1: 输入:s1 = "ab" s2 = "eidbaooo"输出:true解释:s2 包含 s1 的排列之一 ("ba").示例 2: 输入:s1=

  • 【题解】P2150 [NOI2015] 寿司晚宴2022-07-01 20:34:30

    题意 P2150 [NOI2015] 寿司晚宴 对于 \(2\) 到 \(n\) 共 \(n - 1\) 个自然数,考虑从中选取一些数并将其分成两部分,使得从两部分中各取任意一个数 \(x, y\) 都满足 \(x, y\) 互质。求选数并分数的方案总数,结果对给定常数 \(p\) 取模。 对于 \(30\%\) 的数据,\(2 \leq n \leq 30\) 对

  • 埃及分数2022-06-30 20:03:56

    link 搜索中迭代加深的技巧。迭代加深是解决一类答案深度不大、但搜索树可能很深(甚至无限深)、用广搜还不是很好解决的问题。方法是枚举答案的深度,通过限制搜索树深度的方法达到解决问题的目的。 比如这道题。分解得到的分数数量可能非常多,但答案的数量不会太大,就可以通过迭代加深

  • 字符串的常量池和字符串的比较相关方法2022-06-30 10:02:38

    public static void main(String[] args) { String s = "abc"; String s1 = "abc"; char[] arr = {'a','b','c'}; String s2 = new String(arr); System.out.println(s==s1);

  • day12022-06-25 17:03:52

    1.剑指 Offer 09. 用两个栈实现队列 1 class CQueue { 2 public: 3 stack<int> s1,s2; 4 CQueue() { 5 6 } 7 8 void copy(stack<int>& a,stack<int>& b){ 9 while(a.size()){ 10 int tmp = a.to

  • Java 入门24 设计模式 单例2022-06-25 00:34:12

       饿汉单例模式 SingleInstance package com.ITheima._static_codeblock; public class SingleInstance { /** * 1 把无参构造器私有藏起来 */ private SingleInstance(){ } /** * 2 定义一个公开的静态的成员变量存储一个类的对象

  • set集合2022-06-23 22:06:34

    定义:set集合是可变的无序序列,可添加、移除数据,没有索引,不能使用索引和切片集合的特性:1.集合中的对象具有唯一性 (去重)2.无序1、创建set集合 1 #set1={} #方法1 2 # print(type(set1)) 3 # 4 # set2=set() #方法2 5 # 6 # str1='hello' 7 # set3=set(str1) #字符串直接转set集

  • 一些C/C++中易错的地方2022-06-21 19:01:33

    使用 printf 打印出 %: printf("%%"); 用一个 set 初始化另一个 set: //set<int>s1 已经初始化或含有元素 set<int>s2(s1); 向一个 set 中添加另一个 set 所有的元素: //set<int>s1,s2 已经初始化或含有元素 s2.insert(s1.begin(), s1.end());

  • set集合2022-06-20 18:05:29

    # s2={'周杰伦','周润发','周星星'}# ret = s2.remove('周星星')# s2.clear()# print(s2)# 修改# s2={'周杰伦','周润发','周星星'}# s2.remove('周杰伦')# s2.add('德玛')# 查询# s2={'周杰伦','周润

  • java 判断回文数2022-06-20 09:03:18

    package com.oop; public class Demo1 { public static void main(String[] args) { int x = 12321; String s1 = String.valueOf(x); String s2 = new StringBuffer(s1).reverse().toString(); if(s1.equals(s2)) { System.out.println("Yes"); }el

  • api_Date2022-06-19 18:31:44

    //、判断是否是闰年,要求用系统自带方法 LocalDate S3=LocalDate.now(); System.out.println(S3.isLeapYear()); 获取当前日期的字符串表示形式  date->String SimpleDateFormat sdf=new SimpleDateFormat("yyyy年-MM月-dd日"); Date d=new Date(); S

  • POJ3342 Party at Hali-Bula(树形DP)2022-06-18 10:05:52

    dp[u][0]表示不选u时在以u为根的子树中最大人数,dp[u][1]则是选了u后的最大人数; f[u][0]表示不选u时的唯一性,f[u][1]是选了u后的唯一性,值为1代表唯一,0代表不唯一。 当不选u时,u的子节点v可选可不选,dp[u][0]+=max(dp[v][0],dp[v][1]),再根据所选判断f[u][0]; 当选u时,u的子节点都不可选

  • Java和Scala中关于==的区别2022-06-17 14:01:41

    Java和Scala中关于==的区别 Java: ==比较两个变量本身的值,即两个对象在内存中的首地址; equals比较字符串中所包含的内容是否相同。 public static void main(String[] args) {​   String s1 = "abc";   String s2 = new String("abc");​   System.out.println(s1 == s2)

  • left join 和 group by 一起使用2022-06-16 13:34:11

    --1 s 连接 s2 ,如果s表要写group by 就得用括号,因为s left join s2 是一张表只能有一个group by ,所以括号抱起来 SELECT s.coun1,s2.coun2 FROM (SELECT ssex,count() coun1 FROM student group by ssex)s LEFT JOIN (select ssex,count() coun2 from student where sname='赵雷'

  • api 中的所有类2022-06-14 23:01:57

    String类 Int   引用类Integer float   引用类Float   double引用类Double boolean    引用类Boolean char    引用类Charcter // byte     引用类Byte// short    引用类 Short// long    引用类 Long   // java.lang 基础语言包(不需要导包)

  • 实验62022-06-14 07:03:33

    task 1.1 #include <stdio.h> #define N 4 int main() { int x[N] = {1, 9, 8, 4}; int i; int *p; // 方式1:通过数组名和下标遍历输出数组元素 for(i=0; i<N; ++i) printf("%d", x[i]); printf("\n"); // 方式2:通过指针变量遍历输出数组元素 (写法1) for(p=x; p

  • 实验六2022-06-14 01:01:50

    #include <stdio.h> #define N 4 int main() { int x[N]={1,9,8,4}; int i,*p=x; /*数组方式*/ for(i=0;i<N;i++) printf("%d",x[i]); printf("\n"); //指针方式1 for(i=0;i<N;i++) printf(

  • Educational Codeforces Round 130 (Rated for Div. 2) C - awoo's Favorite Problem2022-06-13 23:00:20

    看题解发现是我自己读错题了…… 一开始以为可以这样:"abc"->"bac"->"cab"->"cba" 然后就卡了一个多小时,wa无数发 #include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; typedef long long LL; const int INF = 0X3f3f3f3f,

  • 实验6 指针2022-06-13 21:34:37

    task1_1.c 1 #include<stdio.h> 2 #define N 4 3 4 int main() 5 { 6 int x[N]={1,9,8,4}; 7 int i; 8 int *p; 9 10 p=x; 11 for(i=0;i<N;++i) 12 printf("%d",*(p+i)); 13 printf("\n"); 14

  • 实验62022-06-13 20:35:17

    task1.1 #include <stdio.h> #define N 4 int main() { int x[N] = {1, 9, 8, 4}; int i; int *p; // 方式1:通过数组名和下标遍历输出数组元素 for(i=0; i<N; ++i) printf("%d", x[i]); printf("\n"); // 方式2:通过指针变量遍历输出数组元素 (写法1) for(p=x; p<x+N; ++p) pri

  • StringBuffer、StringBuilder、String2022-06-11 11:35:45

    String是一个字符序列,在Java中,String的对象是不可变的,说明这是一个常量,一旦创建就不可以更改。 Ex class GFG { // Concatenates to String public static void concat1(String s1) { s1 = s1 + "forgeeks"; } // Method 2 // Concatenates to

  • 在B串中查找是否有A串-华为2022-06-10 07:31:32

    思想 在B串中查找A串,把B串中A[0]的位置都放到数组里面,此次从数组为之查找即可,成功返回true,否则返回false 代码 Java代码 import java.util.*; public class F{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); Strin

  • PAT甲级刷题日记(二)2022-06-09 18:31:46

    1020 Tree Traversals Thu Jun 9 18:19 Link 25分 AC代码: #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <string> #include <string.h> #include <vector> #include <queue> usin

  • 第十章练习题2022-06-09 13:32:39

    1.题目:用状态机实现按循环码\(000 \rightarrow 001\rightarrow 011\rightarrow111\rightarrow101\rightarrow100\rightarrow000\)规律工作的六进制计数器 module cnt_6(clk,rst,cnt_out); input clk,rst;//时钟输入,复位信号输入 output [2:0]cnt_out;//计数输出 reg

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

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

ICode9版权所有