ICode9

精准搜索请尝试: 精确搜索
  • CF1398F Controversial Rounds 题解2022-04-21 22:31:52

    Post time: 2021-10-29 18:22:46 题面 贡献一个官方题解做法的详细解释。 首先注意到一个贪心的思路,从前往后如果能够使某一段长度 \(=x\) 就一定会使其 \(= x\) 或 \(\geq x\)。 考虑设一个函数 \(f(pos,x)=npos\) 表示当限制长度为 \(x\) 时,从 \(pos\) 这个位置开始往后,第一个

  • MFC获取当前程序路径2022-01-22 16:59:03

    文章目录 1、获取当前进程的目录2、获取当前运行程序的目录 1、获取当前进程的目录 可以获取exe的路径,但是当用文件对话框成功打开一个文件后,该目录就被修改为被打开的文件所在目录。 CString GetWorkDir(){ char pFileName[MAX_PATH]={0}; int nPos=GetCurrentDirecto

  • c++处理字符串string.find()与string::npos2021-12-04 13:58:50

    在c++中,字符串类型string后面加上.find()的作用 演示 #include<iostream> #include<cmath> #include<algorithm> #include<cstdio> #include<cstring> #include<vector> using namespace std; int main() { int i; string str1 = "qwertyuuoe

  • Codeforces Round #754 (Div. 2) C. Dominant Character2021-11-24 19:02:24

    题目:Problem - C - Codeforces 如代码,一共有七种情况,注意不要漏掉  "accabba"  , "abbacca"  两种情况; 使用find()函数可简化代码,使用方法如下 代码: #include <iostream> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin

  • vc++实现http下载的通用类2021-04-25 17:57:00

       vc++实现http下载的通用类      // DownloadHttp.cpp: implementation of the CDownloadHttp class.////////////////////////////////////////////////////////////////////////#include "stdafx.h"#include "downtest.h"#include "DownloadHttp.h&q

  • MFC对话框水平和垂直滚动条功能2020-12-24 15:04:12

    转载来自:https://blog.csdn.net/zhangchunbo135246/article/details/25234369 1.Resource View - Dialog - 主程序对话框 - 右键 - 属性 - Horizontal Scroll - true 和VerticalScroll - true;2.Message - WM_HSCROLL :OnHScroll回车,跳到.cpp文件添加代码,同理WM_HSCROLL;3.添加代码

  • 滚动条二2020-09-08 21:31:38

    //此程序不知道什么问题横滚动条没有实现#include<windows.h> #include"framework.h" LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static TCHAR szAppNam

  • CF1257D Yet Another Monster Killing Problem 题解与代码2019-12-07 22:56:31

    很蠢地在div2的D题卡住做不出来,这次的D题算是比较简单的,看了题解之后学会了一种新姿势---后缀修改数组,贪心新姿势!! 本题题意: 有n个怪物,每个怪物的power是ai 有 m个勇士,power是pi ,忍耐度是si 当勇士比当前怪物power小或忍耐度为0时结束一天,不然就继续。求最小天数。 题解:本题求最小

  • C++ string.replace的使用2019-08-12 12:53:35

    //下面是一个检查一个字符串中是否有'.'的函数,该函数将找到的'.'转化为'_'。inline void checkName(string& name){std::string::size_type startpos = 0;while (startpos!= std::string::npos){ startpos = name.find('.'); //找到'.'的位置 if(

  • C++中,string::nops的用法以及和string.find()的区别2019-07-07 09:56:26

    1 ////find函数返回类型 size_type 2 string s("1a2b3c4d5e6f7g8h9i1a2b3c4d5e6f7g8ha9i"); 3 string flag; 4 string::size_type position; 5 6 //find 函数 返回jk 在s 中的下标位置 7 position = s.find("jk"); 8 if (position != s.npos) //如果没找到,返回一个特别的标志

  • MFC 获取当前工作路径和可执行文件路径2019-06-02 08:51:27

    1. 获取Debug或Release所在的路径 可执行文件路径 CString GetModuleDir()  {   HMODULE module = GetModuleHandle(0);   char pFileName[MAX_PATH];   GetModuleFileName(module, pFileName, MAX_PATH);     CString csFullPath(pFileName);   int nPos = csFull

  • c++中的npos用法2019-05-06 17:48:38

    npos在 c++中表示一个常数,表示不存在的位置,类型一般是std::container_type::size_type。 其值一般为-1.

  • 新代码, 通过空格分割要高亮的内容, 你把你图片里的顿号改成空格就行了2019-04-15 08:51:32

    procedure TForm1.Button1Click(Sender: TObject); procedure _HighLightText(AStr: string); var nPos, nStrLength, nAllLength: Integer; begin nPos := 0; nAllLength := RichEdit2.GetTextLen; nStrLength := Length(AStr); nPos := RichEdit

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

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

ICode9版权所有