text
stringlengths
8
6.88M
#include <iostream> #include <ctime> #include <cstdlib> #define randomInt(a,b) (rand()%(b-a+1)+a) using namespace std; int main() { int i, j; // 设置种子 srand((unsigned)time(NULL)); /* 生成 10 个随机数 */ for (i = 0; i < 10; i++) { // 生成实际的随机数 j = rand(); cout << "随机数: " << j...
// // Created by wqy on 19-12-11. // #include "Action.h" using namespace esc; /*Action::Action() { }*/ string Action::to_string() const { return ""; }
#pragma once #include <Arcane/Graphics/Renderer/Renderpass/RenderPass.h> #include <Arcane/Platform/OpenGL/Framebuffer/Framebuffer.h> #include <Arcane/Util/Timer.h> namespace Arcane { class Shader; class Scene3D; class ICamera; class PostProcessPass : public RenderPass { public: PostProcessPass(Scene3D *scene)...
#include <fstream> namespace { template <typename T> std::unique_ptr<T[]> Read(const std::string &rFileName, size_t &rFileSize) { if (rFileName.empty()) { rFileSize = 0; return nullptr; } std::ifstream fileStream(rFileName, std::ios_base::in | std::ios_base::binary); if (!fileStream.is_open()) { ...
#include <cstdlib> #include <vector> #include <iostream> #include <iterator> using namespace std; vector<int> mergesort(vector<int> &unsorted) { vector<int> firsthalf; vector<int> secondhalf; for(int iter = 0; iter < unsorted.size(); ++iter) { if(iter < unsorted.size()/2) { firsthalf.push_back(unsor...
#ifndef SPHERE #define SPHERE #include <bits/stdc++.h> #include <GL/glut.h> #include <windows.h> #include "1605002_Object.hpp" #include "1605002_Vector3D.hpp" #include "1605002_Constants.hpp" #include "1605002_Utils.hpp" using namespace std; Vector3D spherePoints[SPHERE_STACKS + 10][SPHERE_SLICES + 10]; class Sphe...
#pragma once //===----------------------------------------------------------------------===// // This file is based on the original Cuckoo filter implementation, // that can be found on GitHub: https://github.com/efficient/cuckoofilter // Usable under the terms in the Apache License, Version 2.0. //===----------------...
//loads sounds structures into specified container /* void Loader::loadSounds(SoundContainer& container) { container.reserve(Counters::sounds); container.push_back(new Sound(0, "No_new Sound")); container.push_back(new Sound(1, "FireBlast")); container.push_back(new Sound(1, "FireballMove")); cont...
#ifndef SRC_PT_PTUNARYOP_H #define SRC_PT_PTUNARYOP_H /// @file src/pt/PtUnaryOp.h /// @brief PtUnaryOp のヘッダファイル /// @author Yusuke Matsunaga (松永 裕介) /// /// Copyright (C) 2005-2011 Yusuke Matsunaga /// All rights reserved. #include "PtNode.h" BEGIN_NAMESPACE_YM_BB ///////////////////////////////////////////////...
#ifndef __RESOURCE_CONVERTER__ #define __RESOURCE_CONVERTER__ #include "Common.h" #include "FileUtils.h" class ResourceConverter { public: static bool Generate( StrVec* resource_names ); private: static File* Convert( const string& name, File& file ); static File* ConvertImage( const string&...
#ifndef SUPERHERO_H #define SUPERHERO_H #include <string> #include <iostream> #include <fstream> using namespace std; class Superhero { private: string name; int age; char superpower; public: Superhero(); Superhero(string name, int age, char superpower); friend istream& operator >>(istream& in...
/* Author: Nayeemul Islam Swad Idea: - https://codeforces.com/blog/entry/70720 */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int uint; typedef pair<int, int> pii; #define x first #define y second #ifdef LOCAL #include "debug.h" #endif const int N = int(1e5) + 10; int...
// // Created by Peter Chen on 5/29/16. // #ifndef CUBEWORLD_AVATARCOMPONENTAI_H #define CUBEWORLD_AVATARCOMPONENTAI_H class AvatarComponentAI { }; #endif //CUBEWORLD_AVATARCOMPONENTAI_H
#include<eosiolib/eosio.hpp> #include<eosiolib/print.hpp> using namespace eosio; using namespace std; using std::string; class invent : public eosio::contract { public: using contract::contract; ///@abi table admin i64 struct admin { account_name id; string name; uint64_t amount; uint64_t primary_key()...
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ int Solution::solve(ListNode* A, int B) { int len=0; ListNode* head=A; while(A) { len++; A=A->next; } if((len/2)+1-B...
%{Cpp:LicenseTemplate}\ #ifndef %{GUARD} #define %{GUARD} #include <Cutelyst/Application> using namespace Cutelyst; class %{ProjectName} : public Application { Q_OBJECT CUTELYST_APPLICATION(IID "%{ProjectName}") public: Q_INVOKABLE explicit %{ProjectName}(QObject *parent = nullptr); ~%{ProjectName}()...
#ifndef GBMSOLVER_H #define GBMSOLVER_H /// @file GbmSolver.h /// @brief GbmSolver のヘッダファイル /// @author Yusuke Matsunaga (松永 裕介) /// /// Copyright (C) 2013 Yusuke Matsunaga /// All rights reserved. #include "YmTools.h" #include "YmLogic/TvFunc.h" BEGIN_NAMESPACE_YM class RcfNetwork; ////////////////////////////...
#include <SoftwareSerial.h> #include <string.h> #include "Motor.h" #include "Driver.h" #include "Sensor.h" #include "Schedule.h" #include "Logic.h" #include "Map.h" //motor pins #define RMOTA 23 #define RMOTB 22 #define LMOTA 21 #define LMOTB 20 //sensors #define LSENSOR 17 #define RSENSOR 16 #define LDSENSOR 5 #...
#ifndef _HS_SFM_PROJECTIVE_MLE_CERES_OPTIMIZOR_HPP_ #define _HS_SFM_PROJECTIVE_MLE_CERES_OPTIMIZOR_HPP_ #include <ceres/problem.h> #include <ceres/ceres.h> #include <ceres/rotation.h> #include "hs_sfm/projective/mle/intrinsic_constrained_vector_function.hpp" #include "hs_sfm/projective/mle/intrinsic_constrained_y_co...
// // Copyright (C) 2018 Ruslan Manaev (manavrion@yandex.com) // This file is part of the Modern Expert System // #include "pch.h"
#include <iostream> using namespace std; class Singleton { public : static Singleton * GetInstance() // 静态成员函数构造一个实例 { // Lock(); // 多线程时(Boost库支持Lock操作) if (m_Instance == NULL) { m_Instance = new Singleton(); // ① } // UnLock();// static Singlet...
#include"undirGraphProc.hh" DepthFirstSearch::DepthFirstSearch(Graph& G, int s){ this->marked=new bool[G.V()]; for(int i=0; i<G.V(); i++){ marked[i]=false; } dfs(G,s); } DepthFirstSearch::~DepthFirstSearch(void){ delete[] marked; } void DepthFirstSearch::dfs(Graph& G, int v){ marked[v]=true; count++...
/************************************************************* * > File Name : P4568.cpp * > Author : Tony * > Created Time : 2019/10/17 16:17:46 * > Algorithm : 分层图最短路 **************************************************************/ #include <bits/stdc++.h> using namespace std; inl...
#pragma once #include "Characters.h" /** Summary: According to to variable function encrypt and decrypt. If "to" is true that means right shifting. Otherwise ıt is left shifting. */ class Kaydirma : public Characters { public: void Encryption(char* mesaj, int key, bool to); void Decryption(char* mesaj, int ...
// // C++ Implementation: keyboard_dialog // // Description: // // // Author: Juan Linietsky <reduz@gmail.com>, (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include "bundles/window_box.h" #include "containers/center_container.h" #include "containers/box_container.h" #include "key...
#include <iostream> #include <map> #include <iomanip> using namespace std; struct node { char s; int next; bool flag; node(char s, int n, bool f) : s(s), next(n), flag(f) {} node() {} }; map<int, node> m; int a, b, c; int d, e; char cc; int main() { // freopen("a.txt", "r", stdin); scanf("%d%d%d", &a, &b, &c)...
#include "menuWrapper.h" #include <vector> MenuWrapper::MenuWrapper(int levels, int difficulty, int width_, int height_, int fps_) : width(width_), height(height_), fps(fps_) { for (int i = 0; i < levels; i++) { std::vector<int> t; for (int j = 0; j < difficulty; j++) t.push_back(0); ...
#ifndef FUNCTION_H #define FUNCTION_H #include <QList> #include <QMap> #include <QString> #include <QDebug> class Function { public: Function(QString name, QMap<QString, QString> parameters); QString getUrl(); ~Function(); private: QMap<QString, QString> _parameters; QString _name; }; #endif //...
#include <pybind11/pybind11.h> #include <pybind11/iostream.h> #include <pybind11/functional.h> #include <pybind11/eigen.h> #include <memory> #include <rmf_fleet_adapter/agv/Adapter.hpp> #include <rmf_utils/clone_ptr.hpp> namespace py = pybind11; namespace agv = rmf_fleet_adapter::agv; void bind_tests(py::module &m) ...
#ifndef EX2_4_GAME_H #define EX2_4_GAME_H #include <iostream> #include "util.h" template<typename F, typename P1, typename P2> struct game { F field; P1 player1; P2 player2; int current; public: game(P1 p1, P2 p2) : player1(p1), player2(p2) { current = 1; } void play() { ...
unsigned long bur_heap_size = 0xFFFF; /***** Header files *****/ #ifdef _DEFAULT_INCLUDES #include <AsDefault.h> #endif #include <bur/plctypes.h> #include <fileIO.h> #include <asZip.h> #include <arProject.h> #include <string> //Variables UINT status = 0; USINT step = 0; char LocalDevName[] = "FLAS...
/* * BulkMem.hpp * * Created on: Aug 7, 2018 * Author: yyhu */ #ifndef INCLUDE_BULKMEM_BULKMEM_HPP_ #define INCLUDE_BULKMEM_BULKMEM_HPP_ #include <iostream> #include <string> #include <sstream> #include "SLFException/SLFException.hpp" namespace slf { typedef unsigned long i_t; class MemSize { public: ...
#include "BulletCollision/CollisionShapes/btMultiSphereShape.h" #include "BulletDynamics/Dynamics/btRigidBody.h" #include "BulletCollision/CollisionDispatch/btCollisionWorld.h" #include "LinearMath/btDefaultMotionState.h" #include "DynamicCharacterController.h" DynamicCharacterController::DynamicCharacterController(bt...
#pragma once #ifndef SPOTIFYAPI_H #define SPOTIFYAPI_H #include <string> #include <QJsonDocument> #include <QDebug> #include "IHTTPDispatcher.h" #include "IHTTPRequest.h" class SpotifyAPI { private: IHTTPDispatcher* dispatcher; IHTTPRequest* http_request; std::string encoded_authorization; //base64 client id and ...
#ifndef INC_MULTNode_hpp__ #define INC_MULTNode_hpp__ #include "BinaryOperatorAST.hpp" /** A simple node to represent MULT operation */ class MULTNode : public BinaryOperatorAST { public: MULTNode(ANTLR_USE_NAMESPACE(antlr)RefToken tok) { } /** Compute value of subtree; this is heterogeneous part :) */ int value...
#pragma once class SubscribeOperation { public: SubscribeOperation(char variable, int rank) : variable(variable), rank(rank) {}; ~SubscribeOperation(); private: char variable; int rank; };
#pragma once #include <vector> #include "Entity.h" #include "Physics.h" #include "GraphicsComponent.h" #include "InputComponent.h" #include "InputMapping.h" #include "RessourceManager.h" #include "Timer.h" #include "Sprites.h" class EntityGenerator { private: Timer* _timer = nullptr; int _dispWidth = 0; int _di...
#pragma once #include <landstalker-lib/patches/game_patch.hpp> /** * In the original game, you need to save Tibor to make teleport trees usable. * This patch removes this requirement. */ class PatchRemoveTiborRequirement : public GamePatch { public: void alter_rom(md::ROM& rom) override { // Remove...
/******************************************************************************* * Cristian Alexandrescu * * 2163013577ba2bc237f22b3f4d006856 * * 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ...
#pragma once #include "VSmartPointer.h" #include "VMemory.h" ////////////////////////////////////////////////////////////////////////// class VSmartMemBlock : public VSmartBase { public: //create a new object with specified parameters //the main purpose of this class is to allocate all necessary data in one allocat...
#include "..\inc.h" /** * Definition for an interval. * struct Interval { * int start; * int end; * Interval() : start(0), end(0) {} * Interval(int s, int e) : start(s), end(e) {} * }; */ class Solution { public: vector<Interval> insert(vector<Interval> &intervals, Interval newInterval) { ...
#ifndef FINTERPOL_H #define FINTERPOL_H #include <map> #include <limits> class finterpol { std::map<double, double> cache; public: finterpol() { } void addValue(double x, double y) { cache[x] = y; } double operator()(double fi) const { std::map<double, double>::co...
#pragma once #include "camera.h" #include "Box.h" class World { public: World(); ~World(); Camera *GetCamera() { return _camera; } Box *GetBox() { return _box; } private: void _InitWorld(); void _DeInitWorld(); Camera *_camera; Box *_box; };
/* _____ * /\ _ \ __ * \ \ \_\ \ __ __ __ /\_\ * \ \ __ \ /'_ `\ /\ \/\ \\/\ \ * \ \ \/\ \ /\ \_\ \\ \ \_\ \\ \ \ * \ \_\ \_\\ \____ \\ \____/ \ \_\ * \/_/\/_/ \/____\ \\/___/ \/_/ * /\____/ * ...
#pragma once #include <stdio.h> #include "Figura.h" #include <map> class Ploca { private: std::map<int, Figura*> polje; public: Ploca(); virtual ~Ploca(); void zauzmiPolje(Figura* figura,int trenutnoPolje); Figura* provjeraPolja(int trenutnoPolje); };
#pragma once /// Includes /// #include <GL/glew.h> #include <glm/glm.hpp> #include <glm/mat4x4.hpp> #include <glm/mat4x3.hpp> #include <glm/vec4.hpp> #include <glm/vec3.hpp> #include <glm/vec2.hpp> #include <openvr.h> #include <map> #include <exception> #include <string> #include <vector> /// Re-definitions /// type...
/* * @lc app=leetcode.cn id=85 lang=cpp * * [85] 最大矩形 */ #include <vector> #include <stack> // @lc code=start class Solution { public: int maximalRectangle(vector<vector<char>>& matrix) { if (matrix.size() == 0 || matrix[0].size() == 0) return 0; // 判断行列是否均为0 int H = matrix.size(), W...
#include "mainwindow.h" #include "setupdialog.h" #include "initialdialog.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); InitialDialog id; if (id.exec() == 0) { exit(0); } SetupDialog d; if (d.exec() == 0) { exit(0); } ...
// IsCryptSolution // Given [word1, word2, word3], check word1+word2=word3, containing no numbers with leading zeroes // For crypt = ["SEND", "MORE", "MONEY"] and // solution = [['O', '0'], // ['M', '1'], // ['Y', '2'], // ['E', '5'], // ['N', '6'], // ['D', ...
// // JsonData.cpp // SMFrameWork // // Created by SteveMac on 2018. 5. 21.. // #include "JsonData.h" const char * CheckVersionInfoString::APP_ID = "APP_ID"; const char * CheckVersionInfoString::ResultMessage = "ResultMessage"; const char * CheckVersionInfoString::VER_NUM = "VER_NUM"; const char * CheckVersionInfo...
//~ author : Sumit Prajapati #include <bits/stdc++.h> using namespace std; #define ull unsigned long long #define ll long long #define int long long #define pii pair<int, int> #define pll pair<ll, ll> #define pb ...
#include <iostream> #include <stdio.h> #include <cstring> #include <cstdlib> #include <vector> #include <cstring> #include <set> using namespace std; int lcp(const string& a, const string& b) { int lim = min(a.size(), b.size()); for (int i = 0; i < lim; ++i) if (a[i] != b[i]) return i; return lim;...
#pragma once #include <tudocomp/Compressor.hpp> #include <tudocomp/decompressors/WrapDecompressor.hpp> namespace tdc { class NoopCompressor: public CompressorAndDecompressor { public: inline static Meta meta() { Meta m(Compressor::type_desc(), "noop", "Simply forwards the unmodified input to ...
#ifndef __THREAD_H #define __THREAD_H /* ***************************************************************************** * ___ _ _ _ _ * / _ \ __ _| |_| |__(_) |_ ___ * | (_) / _` | / / '_ \ | _(_-< * \___/\__,_|_\_\_.__/_|\__/__...
//Semestre 2019-2 //RCSE //************************************************************// #include "texture.h" #include "figuras.h" #include "Camera.h" #include <windows.h> #include <mmsystem.h> #include "cmodel/CModel.h" #if (_MSC_VER >= 1900) # pragma comment( lib, "legacy_stdio_definitions.lib" ) #e...
#ifndef PN532_NFC_READER_CPP #define PN532_NFC_READER_CPP #include "Pn532nfcReader.h" static const byte comparisonByteVector[] = {'P','N','R','D'}; String comparisonString = "PNRD"; Pn532NfcReader::Pn532NfcReader(NfcAdapter* adapter):Reader(){ nfcAdapter = adapter; } void Pn532NfcReader::initiali...
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Author: Junyi Sun (sunjunyi01@baidu.com) // Description: memtable built on leveldb #ifndef STORAGE_LEVELDB_DB_MEMTABLE_ON_LEVELDB_H_ #define STORAGE...
#include <stdio.h> #include <stdlib.h> int main(){ int **p; p = (int **) calloc(2,sizeof(int)); printf("Linha: %d \n", p); for (int i = 0; i < 2; i++){ p[i] = (int *) calloc(2, sizeof(int)); printf("COluna: %d\n" ,p[i]); } printf("\n"); for(int i = 0; i < 2; i++){ for (int j = 0; j < 2; j++){ ...
// // prototype.h // design_pattern // // Created by jack on 14-7-13. // Copyright (c) 2014年 jack. All rights reserved. // #ifndef design_pattern_prototype_h #define design_pattern_prototype_h using namespace std; /** * 简历我们可能只需要修改一下名字就好了 */ class ResumeProto { public: ResumeProto(){} virtual ~ResumeP...
/************************************************************************* > File Name : SecCertificateRequest.cpp > Author : YangShuai > Created Time: 2016年08月12日 星期五 14时49分10秒 > Description : ************************************************************************/ #include<time.h> #include"Primit...
#include "Serial.h" void PrintfSerial::begin(unsigned long value) { printf("[?] Serial.begin(%lu)\n", value); } size_t PrintfSerial::print(const char value[]) { printf("[W] Serial.print(\"%s\")\n", value); return 0; } size_t PrintfSerial::print(int value) { printf("[W] Serial.print(%d)\n", value); return 0; } ...
#include "ClasslessLogger.hpp" #include <chrono> #include <ctime> #include <iostream> void fileLog(const char * logData, const char * logSpace) { FILE* logFile; logFile = fopen("Logger_default.txt", "a"); if (!logFile) { std::cout << "logFile open failed!" << std::endl; exit(1); } ...
#ifndef DECK_H #define DECK_H #include "data_structures.h" class Deck { public: // Initializes deck in order and full Deck(); // Refills deck and shuffles it void shuffle(); // draws num_cards cards std::deque<card_t> draw(int num_cards); // draws one card card_t draw(); privat...
/* File Name: SimpleQueue.h Author: Geun-Hyung Kim Description: 정수형 배열로 구성된 Queue 클래스 기능 구형 프로그램 Date: 2021. 3. 24 Version: 0.1.0 */ #include <iostream> #include "SimpleQueue.h" bool Queue::full() { return rear == length-1; } bool Queue::empty() { return rear == front; } void Queue::enQu...
#ifndef SET_GRAPH_HPP #define SET_GRAPH_HPP #include <unordered_set> #include <list> #include "IGraph.hpp" class SetGraph : IGraph { public: SetGraph(unsigned int verticesNumber); explicit SetGraph(const IGraph &copy); void AddEdge(int from, int to); int VerticesCount() const; std::vector<int...
/* Turn on Turns an LED on */ #define LED 8 //LED connected to pin 8 // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED as an output. pinMode(LED, OUTPUT); } // the loop function runs over and over again forever void loop(...
// by thaiph99 #include <bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for(int i = a; i <= (int)(b); i++) #define FORR(i, a, b) for (int i = a; i >= (int)(b); i--) #define iosb ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const int nax=15*1e4+9; ll n, par[nax], rak[nax], u, v...
#include<bits/stdc++.h> using namespace std; int main(){ float base,area,height; cin>>base>>area; height=2*area/base; int res=ceil(height); cout<<res; }
#include <iostream> #include <vector> #include <queue> #include <future> #include <assert.h> #include <cstdlib> #include "separate.h" #include "private_queue.h" #include "processor.h" std::vector <processor*> g_processors; int max_iters = 20000; class producer { public: separate <std::queue <int> > *m_queue; pr...
#include <iostream> using namespace std; const int size=5; void fill_array(int [],int); void extreme_index(int [],int,int &,int&); int main(){ int myarray[size],sindex,lindex; fill_array(myarray,size); extreme_index(myarray,size,sindex,lindex); cout << "Largest Element Index: " << lindex << endl; cout <<...
#ifndef _INC__RPG2K__STRUCTURE_HPP #define _INC__RPG2K__STRUCTURE_HPP #include "Define.hpp" #include "Map.hpp" #include <iomanip> #include <iostream> #include <sstream> #include <stdexcept> #include <string> #include <vector> #include <climits> #include <cstring> namespace rpg2kLib { static uint const STREAM_BUFF...
#include <bits/stdc++.h> using namespace std; const int MAX_INT = std::numeric_limits<int>::max(); const int MIN_INT = std::numeric_limits<int>::min(); const int INF = 1000000000; const int NEG_INF = -1000000000; #define max(a,b)(a>b?a:b) #define min(a,b)(a<b?a:b) #define MEM(arr,val)memset(arr,val, sizeof arr) #defi...
#include "Package.h" int GetSize(char* Arr) { int s=0; while (Arr[s] != '\0') { s++; } s++; return s; } Package::Package(char* Rnam, char* RAdd, char* RCit, char* RNum, char* Snam, char* SAdd, char* SCit, char* SNum, float Cos, float Wei) { int s = GetSize(Rnam); Rname = new char[s]; for (...
// This file is part of kfilter. // kfilter is a C++ variable-dimension extended kalman filter library. // // Copyright (C) 2004 Vincent Zalzal, Sylvain Marleau // Copyright (C) 2001, 2004 Richard Gourdeau // Copyright (C) 2004 GRPR and DGE's Automation sector // École Polytechn...
// Copyright (c) 2020 gladcow // Copyright (c) 2009-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto.h" #include <openssl/sha.h> #include <openssl/ripemd.h> #include <openssl/ec.h...
/**************************************** * * INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE * Copyright (C) 2019 Victor Tran * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundati...
#pragma once #include <SFML/Graphics.hpp> #include <string> #include "Animation.h" class Object : public Animation { public: Object(); Object(sf::RenderWindow* window); ~Object(); sf::Vector2f get_pos() const { return pos_; } void set_pos(const int&x, const int& y) { pos_ = sf::Vector2f(x, y); } protected: ...
// heap sort // _ ____ __ _ _ __ // (_/_(_(_(_)(__ / (_(_/_(_(_(_/__(/_/ (_ // /( .-/ .-/ // (_) (_/ (_/ #include "../_library_sort_.h" // Độ phức tạp: // Best: O(nlogn) | Avarage: O(nlogn) | Worst: O(nlogn) | Memory: O(1) | Unstable ...
// p244 // 차근차근 // 제곱합 // 범위 내 제곱 계산 알아두기 #include <iostream> #include <stdio.h> using namespace std; const int INF = 987654321; int n; // pSum : 합 / pSqSum : 제곱합 int A[101], pSum[101], pSqSum[101]; int cache[101][11]; void precalc(){ sort(A, A+n); pSum[0] = A[0]; pSqSum[0] = A[0]*A[0]; for(int i=1; i<n; i++...
// Copyright 2020 JD.com, Inc. Galileo Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
#include <iostream> #include <string> #include <cmath> using namespace std; const double eps = 1e-14; struct Point { double x, y; }; class Shape { public: Shape(const string &name); //default copy constructor //default assign operator virtual ~Shape(){} virtual double getSquare()const=0; ...
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <string> #define MYVALUE 100 class Person { public: const int age; // 변수형태의 공간을 갖고있는 상수다. -> 강제적으로 바꿀 수 없다. Person(int n) : age(n) { } }; int main() { const char* str; char* myStr = new char[100]; strcpy(myStr, "Hello World!"); str = myStr; prin...
#include "StdAfx.h" #include "QuoteUdpAgent.h" #include <boost/algorithm/string.hpp> #include <boost/lexical_cast.hpp> CQuoteUdpAgent::CQuoteUdpAgent(CQuoteAgentCallback* pCallback) : CQuoteAgentBase(pCallback) { } CQuoteUdpAgent::~CQuoteUdpAgent() { } int GetQuoteBroadcastPort(const string& frontAd...
/* 1614. 영식이의 손가락 수가 쭉 나열되는 것은 규칙이 있는지 살펴보자. 범위를 잘 파악하자 int -> long */ #include <iostream> #include <vector> #include <cstring> #include <algorithm> #include <queue> using namespace std; typedef long long ll; ll N, M; ll Answer; int main() { cin >> N >> M; Answer = N - 1; if(M > 0) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long int; int const N = 2e5 + 10; vector< int > x; int dp[3][N]; int n,k; int DP(int pos, int l){ if(pos >= n) return 0; int &ret = dp[l][pos] ; if(ret != -1) return ret; ret = DP(pos+1,l); if(l>0){ int _pos = upper_bound(x.begi...
#ifndef QADDDIALOG_H #define QADDDIALOG_H #include <QWidget> #include <QFormLayout> #include <QLineEdit> #include <QComboBox> #include <QPushButton> #include <iostream> using std::cout; using std::endl; class QAddDialog : public QWidget { Q_OBJECT private: std::string name; std::string sname; std::str...
#include <bits/stdc++.h> #define ll long long using namespace std; typedef tuple<ll, ll, ll> tp; typedef pair<ll, ll> pr; const ll MOD = 1000000007; const ll INF = 1e18; template <typename T> void print(const T &t) { std::copy(t.cbegin(), t.cend(), std::ostream_iterator<typename T::value_type>(std::co...
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "XSpace.h" #include "XCapsuleSpace.generated.h" /** * */ UCLASS() class XPROJECT_API AXCapsuleSpace : public AXSpace { GENERATED_BODY() public: AXCapsuleSpace(); /...
// FindkthMaxValueByHeap.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include "pch.h" #include <iostream> #include <queue> using namespace std; class Solution{ public: int findKthLargest(vector<int> &nums, int k) { priority_queue<int, vector<int>, greater<int>> Q; for (int i = 0; i < nums.size(); i++) { if (Q.si...
#include "Arduino.h" elapsedMicros time_data; void setup() { // initialize serial comms Serial.begin(115200); } elapsedMicros wait = 0; int unsigned wait_time = 300; void loop() { // read A0 if(wait >= wait_time){ wait = 0; int val1 = analogRead(6); //int temp_time = time_data; //time_data ...
#include <math.h> #include <stdio.h> #include "common.h" #include "smd3d.h" /*************************************** * Global Variables ***************************************/ static LPDEVICEDESC lpDeviceDesc = NULL; //The RenderDevice Object RenderDevice renderDevice; extern int ParkPlaying; //Of the video ...
#include<iostream> #include<string> using namespace std; // string的查找和替换 //字符串比较 //单个字符的存取 //查找 void test01() { string str1 = "abcdedefg"; //find()函数 int pos = str1.find("de");//查找函数,存在返回位置下标,不存在返回-1 if(pos == -1) { cout<<"未找到"<<endl; } else{ cout<<pos<<endl; } //r...
#include "plot/root_draw.h" #include "base/std_ext/memory.h" #include "base/std_ext/string.h" #include "base/Logger.h" #include "TH1D.h" #include "TH2D.h" #include "TObject.h" #include "TNamed.h" #include "TCanvas.h" #include "TROOT.h" #include "THStack.h" #include "TVirtualPad.h" #include <iostream> #include <sstrea...
/* 2014年4月11日21:03:12 二维数组整体向右缩进是 Tab键,向左缩进shift+Tab 怎样输出二维数组 *printf哪里%d加空格,输出页面也有空格 */ # include <stdio.h> int main(void) { int a[3][4] = { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12} }; int i, j; for(i=0; i<3; ++i) { for(j=0;j<4;++j) printf(" %d", a[i][j]); printf...
/* Name: Mohit Kishorbhai Sheladiya Student ID: 117979203 Student Email: mksheladiya@myseneca.ca Date: 21/02/05 */ #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <iomanip> #include <cstring> #include "Food.h" using namespace std; namespace sdds { void Item::setName(const char* name...
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int edges; cin>>edges; int adj[n][n]; int arr[n]; for(int i=0;i<n;i++) { arr[i]=0; for(int j=0;j<n;j++) { adj[i][j]=0; } } for(int i=0;i<edges;i+...
/////////////////////////////////////////////////////////////////// //Copyright 2019-2020 Perekupenko Stanislav. All Rights Reserved.// //@Author Perekupenko Stanislav (stanislavperekupenko@gmail.com) // /////////////////////////////////////////////////////////////////// #include "CPPW_Details.h" #include "Components/S...
#pragma once #include "Vertex2D.h" #include "Vertex3D_NoTex2.h" #define _USE_MATH_DEFINES #include <math.h> class Vertex3Ds { public: Vertex3Ds(); Vertex3Ds(const float _x, const float _y, const float _z); void Set(const float a, const float b, const float c); void SetZero(); Vertex3Ds operator+(const Vertex3...
// $Id: Identifier.h,v 1.9 2013/02/09 19:00:33 david Exp $ -*- c++ -*- #ifndef __CDK8_NODE_EXPRESSION_IDENTIFIER_H__ #define __CDK8_NODE_EXPRESSION_IDENTIFIER_H__ #include <cdk/nodes/expressions/Simple.h> #include <string> #include "SemanticProcessor.h" namespace cdk { namespace node { namespace expression { ...
#include<stdio.h> #include<stdlib.h> #include<string> #define NO_OF_CHAR 256 int *getCharCount(char *); char *removeDirtyString(char *,char *); int main(){ char mask_str[]="mask"; char str[]="geeksforgeeks"; printf("%s",removeDirtyString(str,mask_str)); getchar(); return 0; } char *removeDirtyString(char *str...