ICode9

精准搜索请尝试: 精确搜索
  • CF985E Pencils and Boxes2021-10-17 12:03:49

    Lisa 尺取法搞一波 然后前缀和优化一波 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; int a[500005]; bool f[500005]; int n,k,d; int sum[500005]; int main(){ // ios::sync_with_std

  • 2015 偶数求和(杭电)2021-10-16 11:31:56

    // // main.c // 杭州电子科技大学 // // Created by yonuyeung on 2021/10/12. // #include<stdio.h> int main() { int n,m,i,j,sum=0,k; while(scanf("%d%d",&n,&m)!=EOF) { k=0; for(i=1;i<=n/m;i++)//先将n个数分成i个组,每组m个 { sum

  • 1144. 连接格点【最小生成树】2021-10-14 16:31:41

    https://www.acwing.com/problem/content/description/1146/ #include<bits/stdc++.h> using namespace std; const int N=1e6+10; int p[N],n,m; int x,y,xx,yy; struct node{int a,b,c;}; bool cmp(node a,node b) {return a.c<b.c;} vector<node>ve; int f

  • 「BZOJ2131」免费的馅饼 (DP+树状数组) 总算做出来了2021-10-11 20:34:03

    由于未知不稳定因素,在某些评测机上可能有锅,欢迎指正: #include<bits/stdc++.h> using namespace std; const int maxn=100010; struct data{ int t,p,v; int fir,sec; void push(){ scanf("%d%d%d",&t,&p,&v); t<<=1; } int count(){ fir=t+p; sec=t

  • CF446B DZY Loves Modification2021-10-10 22:06:39

    https://www.luogu.com.cn/problem/CF446B 行列分开考虑(用优先队列)搞出最大的前 n n n个 然后枚举选 k k

  • p17892021-10-10 17:32:02

    插火把 注意: 1、这个题目,我的解法是开一个数组初始化为0,有位置的地方和放光的地方我设置为1,当全部输入完后,统计n * n区域内有多少个0就可以了. 2、按常规方法开数组,例如我们开一个a[100][100],从(0,0)开始。这样的话我们就要考虑是否会出界问题。但是我们开一个a[200][200]从a[5

  • P3371 【模板】单源最短路径(弱化版)2021-10-07 22:02:48

    题目背景 本题测试数据为随机数据,在考试中可能会出现构造数据让SPFA不通过,如有需要请移步 P4779。 题目描述 如题,给出一个有向图,请输出从某一点出发到所有点的最短路径长度。 输入格式 第一行包含三个整数 n,m,sn,m,s,分别表示点的个数、有向边的个数、出发点的编号。 接下来

  • 【10.6 牛客提高(二)】 【结论题】 串串串2021-10-07 15:34:41

    【10.6 牛客提高(二)】 【结论题】 串串串 题目 解题思路 先举个栗子 10110 10011 可以先统计1的个数,发现都是奇数,那么加起来则为偶数 如果有1的数位相同,那么会同时消掉偶数个1,那么最后不一样的数位奇偶性为0 最后总结一下发现就是,如果1的个数和是偶,那么答案是0,否则为1 代

  • 08-06 性能测试--测试报告与数据2021-10-05 16:32:44

    性能测试报告模板: 链接: https://pan.baidu.com/s/1iQju8u0MditHDkTQogItxQ 提取码: 2gu6 前端性能分析 使用 Chrome 浏览器 结果查看: 图中各种颜色代表的含义: 蓝色 Loading:加载黄色 Scripting:脚本紫色 Rendering:渲染绿色 Painting:绘制浅灰 Other:其他 若需要通过 Jmeter 进

  • 带权并查集 poj1984 Navigation Nightmare2021-10-05 11:32:49

    思路是记录相对于父节点的偏移量 分别维护x和y即可 #第一个坑在读入既有数字又有字符的时候,要写成: scanf("%d%d%d %c"),否则老锅。 #第二个坑是实现operation和查询的时候,处理p1和p2没写好,造成溢出了。   锅着,仍然re,待填ing。   #include <iostream> #include <math.h> #include

  • acm算法之dfs2021-10-04 00:00:40

    //dfs优化深度搜索,此处给出给出模板,解决的是:1-9 9个数凑一个等式,其中每个数由3个数字组成 //注意到有两个回溯,有归还,传参为step就好 #include<stdio.h> int book[10]; int a[10]; void dfs(int step) { int i; if(step==10) { if((a[1]*100+a[2]*10+a[3]+a[4]*100+a[5]*1

  • CF18 B. Platforms2021-10-02 19:02:18

    Problem - 18B - Codeforces   题意: 有n个长为l的木板,第i个木板的起始位置在(i-1)*m 你的初始位置为0,每次跳跃距离为d 每次的落点在木板上才可以继续跳,问在哪个位置掉下去   记录到达一个木板的位置 设现在的位置为now,所在木板的右端点为r 那么(r-now)/d就是在这个木板还能跳跃

  • [CSP-S2020] 动物园2021-10-02 11:33:20

    CSP-2020动物园 #include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int N = 1000005; typedef unsigned long long ll; int n, m, c, K; bool vis[64]; ll a[N]; int main() { scanf("%d%d%d%d", &n,

  • noi1.2.252021-10-01 21:33:00

    #include <stdio.h> #include <stdlib.h> int main() { int x = 199; int y = 677 +6*7 +6; for(int i = x;i<=y;i++){ if(i%7i/81&&i/7%7i/9%9&&i/49==i%9){ x=i; printf("%d\n",x); } } printf("%d%d%d\n",x/49,x/7%7

  • “输入5个数字从大到小排列顺序”2021-09-30 00:02:20

    代码有点长,不能截图只能复制 # include <stdio.h>         int main () {     int a,b,c,d,f;     scanf("%d%d%d%d",&a,&b,&c,&d);     if(b>a)     { f=a;     a=b;     b=f;              }     if(c>a)     {     f=a;     a=

  • 控制公司YTU2021-09-26 15:59:19

    #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 102; int n,vis[N][N],a[N][N]; //a[i][j]<=50的才需要dfs //如果a[i][j]大于50了,i一定控制j公司。 //不大于50,才有可能控制该公司。 void dfs(int x,int y) { if(vis[x

  • 嗯,这个虫吃苹果的题有意思2021-09-24 23:33:04

    #include<stdio.h> #include<math.h> int main() {     int n,x,y,m;     scanf("%d%d%d",&n,&x,&y);          m=ceil(n-y/x-1);//还有种写法是不用“-1”就是ceil函数用在虫吃的苹果个数上     printf("%d",m);     return 0;  }  题:已知有n个苹果,一条虫

  • 普及图论模板2021-09-24 22:29:52

    Dijkstra算法 可以求起点 S 到其他点的最短路径,时间复杂度为 O(n2) 例: 找 1 到 n 的最短路径,如果不存在输出 −1 #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int INF = 5e6; const int N = 510; int n, m; int g[N][N]; in

  • MySQL生成一个唯一ID2021-09-23 15:03:34

    毫秒时间戳ID SELECT SUBSTR(date_format(NOW(3), '%Y%m%d%H%i%s%f'), 1, 17) as uniqueid SUBSTR(str, pos, len) 函数的参数 pos 的坐标从 1 开始; %Y 四位数字表示的年份;而 %y 两位数字表示的年份; %m 两位数字表示的月份(01, 02, ..., 12); %d 两位数字表示月中的天数(00, 01,...,

  • 2021ICPC网络赛第一场2021-09-22 19:33:26

    A题 思路 均可代码 #include <bits/stdc++.h> #define lson rt<<1,l,mid #define rson rt<<1|1,mid+1,r using namespace std; typedef long long ll; const int maxn=1e5+5; const int INF=0x3f3f3f3f; int k,n,h,m=1,mn[maxn<<2],prf[maxn],he[maxn]; void

  • PAT 划拳2021-09-21 10:01:03

    划拳 #include <stdio.h> int main() { int jhan,jhua,yhan,yhua,N,cntj = 0,cnty = 0; scanf("%d",&N); int i; for(i = 0;i<N;i++) { scanf("%d%d%d%d",&jhan,&jhua,&yhan,&yhua); if(jhan+yhan == jhua &&a

  • 一维差分2021-09-20 18:02:25

    类似于数学中的求导和积分,差分可以看成前缀和的逆运算。 差分数组: 首先给定一个原数组a:a[1], a[2], a[3], a[n]; 然后我们构造一个数组b : b[1] ,b[2] , b[3], b[i]; 使得 a[i] = b[1] + b[2 ]+ b[3] +, + b[i] 也就是说,**a数组是b数组的前缀和数组,反过来我们把b数组叫做a数组

  • 最短路算法总结2021-09-20 10:34:25

    最短路算法总结 一、目录 1.Floyd(n^3) n:点数 2.dijikstra( n^2 -> mlogn) n:点数 m:边数 (不理解复杂度) 3.bellman-ford(nm) n: 点数 m:边数 4.spfa(Km) K:约为2的常数 m:边数 5.Johnson (nmlogm) (不理解复杂度) 二、实现的代码 1.floyd 全源最短路(可以解决负权边,但不能解决负权

  • C-按八进制输出数2021-09-18 23:04:25

    题目描述 编写一个程序,输入0至32767之间的一个整数,并按八进制(基数为8)显示出来: 1953 In octal, your number is: 03641 输入 输入0至32767之间的一个整数。 输出 输出以"In octal, your number is: “开头的5位数,即使不需要这么多位数也要如此。注意”:"后留一个空格。 样例

  • csp认证2020-09-1称检测点查询2021-09-18 21:03:59

    100分代码 #include<bits/stdc++.h> #include<string> #include<stdio.h> #include<stdlib.h> #include<math.h> int a[1001][3]; //int f[1001]; struct node { int k;//序号 double f;//距离 }p[1001]; int main() { int n; int X, Y; scanf

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

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

ICode9版权所有