ICode9

精准搜索请尝试: 精确搜索
  • CodeForces-1469C Building a Fence2022-08-18 11:04:10

    Building a Fence dp 模拟? 维护好可摆放的区间即可,我用的区间是指当前位置可摆放的东西的下边界 区间下限:\(l_i = max(l_{i+1} - k, h_i)\),表示尽量往下放,以及在地面之上 区间上限:\(r_i = min(r_{i-1} - 1, h_i + k - 1)\),表示尽量往上放,且下边界不超过地面的 \(k - 1\) #include

  • 区间合并 左端点1右端点-1的等待cnt=0的情况2022-08-18 00:30:40

    牛客第一题https://ac.nowcoder.com/acm/contest/33186/A signed main(){ // ios::sync_with_stdio(false); // cin.tie(0),cout.tie(0); int n; cin>>n; for(int i=0;i<n;i++){ int a,b;cin>>a>>b; v.push_back({a-b,1}); v.push_back({a+b,-1});

  • HDLBits答案——Verilog Language2022-08-16 20:00:09

    Verilog Language 1 Basics 1.1 Wire module top_module( input in, output out ); assign out = in; endmodule 1.2 Wire4 module top_module( input a,b,c, output w,x,y,z ); assign w = a; assign x = b; assign y = b; assign z = c

  • opencv中XML文件的读与写2022-08-16 19:32:08

    opencv中XML文件的读与写 OpenCV中有相关的函数对XML文件进行写与读的操作, FileStorage fs("../xml/read.xml", FileStorage::WRITE); FileStorage fs2("../xml/read.xml",FileStorage::READ);   #include<opencv2/opencv.hpp> #include<vector> using namespace st

  • std::string assign2022-08-16 11:00:17

    参考 std::string #include<iostream> #include<string> using namespace std; int main() { string str; string base = "The quick brown fox jumps over a lazy dog."; char c_string[] = "c-string"; char *pCString = "

  • [2002年NOIP提高组] 均分纸牌2022-08-16 08:30:59

    分析:每次移动都需要将其补全或删掉,如果这个正好是平均数,则步骤次数不增加 9 8 17 6 -1 -2 7 -4 0 -3 4 -4 0 0 4 -4 0 0 0 0 #include<bits/stdc++.h>using namespace std;int main(){ int n,s=0,a[200],ans=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; s=s+a[i]; } s=s/n; f

  • Day1笔记2022-08-16 08:00:30

    01.C++概述(了解) c++语言在c语言的基础上添加了面向对象编程和泛型编程的支持。 02.第一个程序helloworld(掌握) #define _CRT_SECURE_NO_WARNINGS #include<iostream> using namespace std;//标准命名空间 int main() { //cout是标准的输出流对象,打印字符串, //endl是刷新缓冲区,

  • [2004年NOIP普及组] FBI树2022-08-15 21:31:14

    [2004年NOIP普及组] FBI树 思路:运用递归。已知“0”和“1”组成的字符串分为三类:全“0”串称为B串,全“1”串称为I串,既含“0”又含“1”的串则称为F串。 写一个后序遍历的函数,然后递归,自己调用自己就好了。每次输出根节点,直至全部输出。 代码如下: #include<bits/stdc++.h> using na

  • C++ 用for/while循环实现字符串逆置输出2022-08-15 00:34:03

    1.for循环实现字符串逆置 #include <iostream> using namespace std; int main() { string str; cout << "请输入一个字符串:" << endl; cin >> str; int j = str.length() - 1; //必须要放在输入字符串之后 for (int i = 0; i < j; i++)

  • Codeforces Round #813 (Div. 2)A-D2022-08-15 00:30:47

    Codeforces Round #813 (Div. 2)A-D 过程 本场A,B快速签到,但C卡了一下,D做法一开始直接把小的变大,然后发现假了,把自己hack了,随后想到了三分寻找最合适的变连续的一串从小到大的数字,但还是假了,只能赛后补提了。 传送门 题目 A 统计前k个数里面有多少个大于k即可 void Solve(){ cin>>

  • AcWing周赛62-64 中比较有意思的小题题解2022-08-14 18:30:43

    AcWing周赛62-64(选讲) 感觉比较思维 4502. 集合操作 https://www.acwing.com/problem/content/4505/ 根据题意,肯定要使得所取的最大值最大,平均值最小。又因为每次放进来的的数字都是递增的,所以最大值必然取的是最新放入的那个 \(x\), 接下来考虑平均值,要使平均值尽可能小的话,就要保

  • C++ while循环的简单易用 输入正确的账号密码2022-08-14 18:00:31

    #include <iostream> using namespace std; int main() { string name; string pwd; while (1) { system("cls"); cout << "请输入账号:"; cin >> name; cout << "请输入密码:"

  • 拷贝构造函数2022-08-14 17:03:48

    c++中的拷贝构造函数调用时机通常有三种情况 1.使用一个已经创建完毕的对象来初始化一个新的对象 2.值传递的方式给函数参数传值 3.以值方式返回局部对象 //情况1 class Person { public: Person(){ std::cout <<"无参数构造函数" << std::endl; mA

  • 第7章 函数——C++的编程模块2022-08-14 14:32:17

    第7章 函数——C++的编程模块 7.8 编程练习题 第1题 #include <iostream> using namespace std; // 编写一个程序,不断要求用户输入两个数,直到其中的一个为0. // 对于两个数程序使用一个函数来计算它们的调和平均数,并将结果返回给main() // 调和平均数 = 2.0 * x* y*(x+y) inli

  • [2011年NOIP提高组] 铺地毯2022-08-14 09:04:07

    试题分析:要求最后覆盖的地毯的编号,所以可以从n向上遍历,找到符合要求的地毯,然后输出 注意:没有地毯时输出-1 #include<bits/stdc++.h>using namespace std;int main(){ int s,ss,n,x[20005],y[20005],i,j,g[20000],k[20000]; cin>>n; for(i=1;i<=n;i++){ cin>>x[i]>>y[i]>>g[i]>>k

  • 一本通 例2.17 分糖果 分析2022-08-13 09:00:33

    用一维数组存储苹果数 循环读入当前苹果数 按规则进行分苹果 最后循环输出 代码: #include<iostream>#include<iomanip>using namespace std;int main(){    int a[7],b;    for(int i=0;i<=7;i++)    a[i]=0;    for(int i=1;i<=5;i++)    cin>>a[i];    for(in

  • [2004年NOIP提高组] 津津的储蓄计划2022-08-13 08:32:04

    将每月得到的与原有的和花费比较,注意最后一月剩下的加起来 #include<bits/stdc++.h>using namespace std;int main(){ int a[15],i,j=0; double ss,s=0; for(i=1;i<=12;i++){ cin>>a[i]; } for(i=1;i<=12;i++){ j=j+300; if(j<a[i]){ cout<<"-"<<i; r

  • [2003年NOIP普及组] 乒乓球2022-08-13 08:31:19

    注意如果一名选手为11(21)分,而另一名选手与其分的差距小于2,则比赛继续进行,直到差距等于2为止 #include<bits/stdc++.h>using namespace std;int i=0,j,w=0,l=0;char a[90000];int main(){ while(1){ i++; cin>>a[i]; if(a[i]=='E'){ i--; break; } } for(j=1;j<=i;j++){ if

  • 1.4 C++的for,new2022-08-12 11:00:56

    for,new等 遍历循环 取别名的方式最好 #include <iostream> using namespace std; int main() { int v[]{ 12,13,14,15 }; for (auto x : v) { cout << x << endl; } cout << "-------------" << endl; for (auto x : { 17,18,19 }) {

  • C++用短除法把十进制转换为二进制输出2022-08-08 21:04:53

    #include <iostream> #include <Windows.h> #include <string> using namespace std; int main() { int n; int ret[32]; int i = 0; cout << "请输入一个正整数:"; cin >> n; if (n < 0) { cout <&

  • 输入行数,用C++打印金字塔型星号2022-08-08 19:33:52

    #include <iostream> #include <windows.h> #include <string> using namespace std; int main() { int row; cout << "请输入行数:"; cin >> row; for (int i = 1; i <= row; i++) { for (int k = 0; k <

  • Floyd(弗洛伊德)2022-08-08 19:33:06

    #include<bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define fi first #define se second #define pb push_back #define pll pair<ll,ll> const ll mod=1e9+7; const ll N=1e4+9; ll a[N][N]; ll n,m; void floyd

  • C++异步async2022-08-08 15:00:08

    #include <iostream> #include <future> int mythread() { std::cout << "mythread " << std::this_thread::get_id() << std::endl; std::chrono::milliseconds second(3000); std::this_thread::sleep_for(second); r

  • 无聊题解第1期2022-08-08 08:00:08

    今天,我要开始整一下无聊题解,小白们,看过来! 先说第一道题: 时间:1000ms 运行时的内存:262144kb 输入格式: 一行,有两个空格隔开的整数 样例输入: 1 2 样例输出: 3 这道题就是一道新手必刷题,那么先让我们来看一下A掉的代码: #include<bits/stdc++.h> using namespace std; int main(){

  • Acm模板-计算几何(寄算几何)2022-08-08 01:03:58

    #include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define eps 1e-8 #define int128 __int128 #define gcd(a,b) __gcd(a,b) #define lcm(a,b) a/gcd(a,b)*b #define lowbit(x) (x&-x) #define all(

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

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

ICode9版权所有