ICode9

精准搜索请尝试: 精确搜索
  • 《个人软件开发流程》--杨瑞杰2021-04-11 14:09:58

    四则运算编程练习 需求分析:根据用户输入,随机生成相应个数的表达式。 核心代码: step1:生成表达式并存入StringBuffer中 1 private static String[] op = { "+", "-", "*", "/" }; 2 /** 3 * 生成算数表达式 4 * 5 * @return 运算表达式(无结果) 6 */

  • LeetCode——264. 丑数 II(Java)2021-04-11 14:08:43

    问题描述 题干: 给你一个整数 n ,请你找出并返回第 n 个 丑数 。 丑数 就是只包含质因数 2、3 或 5 的正整数。 示例1: 输入:n = 10 输出:12 解释:[1, 2, 3, 4, 5, 6, 8, 9, 10, 12] 是由前 10 个丑数组成的序列。 示例2: 输入:n = 1 输出:1 解释:1 通常被视为丑数。 题解分析 输出第n个

  • 【洛谷】P1064 [NOIP2006 提高组] 金明的预算方案2021-04-11 14:07:10

    题目链接 https://www.luogu.com.cn/problem/P1064 解题思路 如果我们直接用动态规划的模板去处理的话,我们很难去处理选择附件时的主件选择; 我的一开始的思路是在输入过程中把主件的值加到附件上,但由于每个主件的附件不唯一且主件可以单独选择,就很难处理; 后来换了一种思路

  • LeetCode 59. 螺旋矩阵 II2021-04-11 14:00:02

    题目: https://leetcode-cn.com/problems/spiral-matrix-ii/   题解: 这道题没有什么算法可言,分析整个过程,模拟即可。 我们用 i 表示横坐标,j 表示纵坐标,模拟上面过程: 1. 填充上行,从左到右,(i, j++)。 2. 填充右列,从上到下,(i++, j)。 3.填充下行,从右到左,(i, j--)。 4.填充左列,从下

  • 丑数2021-04-11 13:59:12

    题目描述: 给你一个整数 n ,请你找出并返回第 n 个 丑数 。 丑数 就是只包含质因数 2、3 和 / 或 5 的正整数。 示例 1: 输入:n = 10 输出:12 解释:[1, 2, 3, 4, 5, 6, 8, 9, 10, 12] 是由前 10 个丑数组成的序列。 示例 2: 输入:n = 1 输出:1 解释:1 通常被视为丑数。 需要考虑到的

  • 请编写一个程序,其功能是:从键盘输入字符串,将字符串中下标位偶数同时ASCII 值为奇数的字符 删除2021-04-11 13:36:25

    1 #include<stdio.h> 2 int main() 3 { 4 char str[100]; 5 int i,j; 6 gets(str); 7 for(i=0,j=0;str[i]!='\0';i++) 8 if((i%2==0)&&(str[i]%2!=0)) //将下标为偶数元素为奇数的换成非法字符 9 str[i]='*'

  • java写一个万年历2021-04-11 13:32:58

    做一个万年历 代码如下(示例): import java.lang.invoke.SwitchPoint; import java.net.StandardSocketOptions; import java.util.Scanner; public class Demo1 { public static void main(String[] args) { System.out.println("==========欢迎使用万年历=========");

  • 邻接矩阵 构造 有向/无向 图/网2021-04-11 13:32:49

    //create graph #include<iostream> #include<iomanip>//打印邻接矩阵时提供setw函数来置表位 #define MAX 20//图的顶点个数最大值,也可以不设置这个,用堆分配 using namespace std; typedef enum{DG,UDG,DN,UDN}GraphKind; typedef struct{ int adj; //InfoType *info

  • 小学生速算器 计应192西—第一组—高振豪2021-04-11 13:32:17

    计应192西—第一组—高振豪 需求分析:随机生成俩个100以内的数字进行加减运算,通过用户在文本框输入答案来判断是否正确,并显示正确率。 具体思想:在Form窗体上用Lab控件显示计算机随机出的题,用一个Txt文本框来输入答案,输入完成之后在文本框中按回车来进行下一题,并把刚做完的题放入Lis

  • Java学习-常用类(正在完善)2021-04-11 13:29:25

    文章目录 Object类Object()getClass()hashCode()equals()clone()toString()notify()notifyAll()wait()wait(long timeoutMillis)wait(long timeoutMillis, int nanos)finalize() 包装类基本数据类型和包装类Integer类 Math类日期时间类Data类SimpleDateFormat类Calendar类

  • 周练3,题解2021-04-11 13:03:28

    非男非女 思路 :输入处理时先把女生标记为-1,那么女生和男生配对和就是0 ,那么利用前缀和就 好找到一个连续的和为0 的长区间了 #include<iostream> using namespace std; const int N = 100010; int n; int s[N]; int main() { int max = 0; cin >> n; for

  • 短作业优先算法_操作系统_c语言实现2021-04-11 13:00:47

    PTA题目 注:在PTA上面提交时务必把scanf_s改成scanf,(编译器用的是vs2019). 主函数 int main() { int n; //进程数量 scanf_s("%d", &n); struct pcb p[100]; input(p,n); sort(p,n); sjf(p, n); output(p,n); return 0; } 核心算法 void sjf(struct p

  • 既约分数2021-04-11 12:59:43

    STL内置函数:__gcd() 用来计算最大公约数 #include <iostream> #include <algorithm > //所需要用到的头文件 using namespace std; int main() { int i,j,k; int num=0; for(i=1;i<=2020;i++) { for(j=1;j<=2020;j++) { if(__

  • 俄罗斯方块2021-04-11 12:57:43

    俄罗斯方块 from CCF-CSP 2016-04-2 Time limit:1s Memory limit:256MB ac代码: #include<bits/stdc++.h> using namespace std; int x[30][30]; int xx[5][5]; int num,now; bool note[30][30]; void init(){ for(int i = 1;i <= 15;++i) for(int j = 1;j

  • 细胞数量2021-04-11 12:34:58

    #include<bits/stdc++.h>using namespace std;int h[10001][3];int n,m,num=0;int dj[101][101];int u[4]={0,1,0,-1};int v[4]={1,0,-1,0};void gs(int p,int q){ int t=0,w=1,x,y; num++;dj[p][q]=0; h[1][1]=p;h[1][2]=q; do { t++; for(int k=0;k<=3;k++) {

  • 技术书籍 — EffectiveMordenCpp 研读2021-04-11 12:34:06

    一、类型推导 PROs: 源码某处的类型修改,可以自动传播其他地方 Cons: 会让代码更复杂(How?) 在模板类型推导时,有引用的实参会被视为无引用,他们的引用会被忽略 template<typename T> void f(T & param); // param 是一个引用 int x = 10; // int const int cx= x; // const in

  • Count 1 in Binary2021-04-11 12:33:54

    Source Count how many 1 in binary representation of a 32-bit integer. Example Given 32, return 1 Given 5, return 2 Given 1023, return 9 Challenge If the integer is n bits with m 1 bits. Can you do it in O(m) time?   题解 题 O1 Check Power of 2 的进阶

  • Let's go home HDU - 18242021-04-11 12:04:39

    原题链接 题解:不要看到多重关系就慌张,其实本质上还是一对一对的关系,所以要提取出来,关键不得不做的信息,然后建图。 代码: #include <iostream> #include <algorithm> #include <cstring> using namespace std; const int N = 2e6 + 9; const int M = 2e6 + 9; int h[N], ne[M], t

  • 关于有向图强连通分量的一点想法2021-04-11 12:03:48

    前言 在 20210410 宏帆机房,gm讲强连通分量和缩点的时候,因为大家对于这个知识点的理解和想法不同,产生了激烈的争吵(诡辩)。 本来就很蒻的zyq在听了各位巨佬的讨论后,更加不知所云,以至于露出了这样的表情 (还被gm看见了就很淦) 于是 zyq 在第二天,又打开了强连通分量的 PPT , 然后把代

  • 实验 3 C语言分支语句、循环语句、函数综合应用编程-12021-04-11 12:03:17

    #include <stdio.h> #include <stdlib.h> #include <time.h> #define N 5 int main() { int x, n; srand(time(0)); for(n=1; n<=N; n++) { x = rand() % 100; printf("%3d", x); } prin

  • 201709-4通信网络2021-04-11 12:02:37

            #include<bits/stdc++.h> //#define test using namespace std; int mapp[1001][1001]; int visited[1001]; int n,m; int nownum; int ava[1001][1001]; int dfs(int a){ if(visited[a]) return 0; ava[nownum][a]=1; ava[a][nownum]=1;//这里改成双向修改就通

  • PAT(甲级)2021年春季考试2021-04-11 12:01:45

    7-1 Arithmetic Progression of Primes (20 分) 时间限制:1000 ms 内存限制:64 MB In mathematics, an arithmetic progression (AP,等差数列) is a sequence of numbers such that the difference between the consecutive terms is constant. In 2004, Terence Tao (陶哲轩) and Be

  • 剑指 Offer 14- II. 剪绳子 II2021-04-11 11:35:14

    剑指 Offer 14- II. 剪绳子 II 给你一根长度为 n 的绳子,请把绳子剪成整数长度的 m 段(m、n都是整数,n>1并且m>1),每段绳子的长度记为 k[0],k[1]...k[m - 1] 。请问 k[0]*k[1]*...*k[m - 1] 可能的最大乘积是多少?例如,当绳子的长度是8时,我们把它剪成长度分别为2、3、3的三段,此时得到的最

  • 八结点(广搜)2021-04-11 11:07:31

    #include<bits/stdc++.h>using namespace std;int ju[9][9]={{0,0,0,0,0,0,0,0,0}, {0,1,0,0,0,1,0,1,1}, {0,0,1,1,1,1,0,1,1}, {0,0,1,1,0,0,1,1,1}, {0,0,1,0,1,1,1,0,1}, {0,1,1,0,1,1,1,0,

  • 矩阵快速幂(推导+模板+例题详解)2021-04-11 11:06:35

    整数快速幂: 分解成二进制形式易得程序 int fastpow(int base,int n,int mod){ int ans=1; while(n){ if(n&1) ans*=base%mod; base*=base; n>>=1; } return ans%mod; } 快速幂复杂度是O(logn),不用快速幂是O(n) 矩阵快速幂: 把整数乘法改成矩阵乘法,原理一样 struc

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

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

ICode9版权所有