text
stringlengths
8
6.88M
#ifndef INCLUDED_NETWORK_MESSAGE_SENDER_SYSTEM_H #define INCLUDED_NETWORK_MESSAGE_SENDER_SYSTEM_H #include "engine/system.h" #include "messsage_holder.h" #include "core/scene.h" #include "core/program_state.h" #include <set> #include "platform/frequency_timer.h" using core::ProgramState; namespace network { class Ac...
#include <iostream> #include <list> #include <deque> #include <algorithm> #include <sequtils.h> #include <countptr.h> using namespace std; ostream& operator<<(ostream& os, const CountedPtr<int>& elem) { os << *elem << ' '; return os; } int main(int argc, char *argv[]) { static int v[]= {3,5,9,1,6,4}; typedef...
#include<iostream> using namespace std; const int N = 2500; int a[N]; int main(){ int n, m; cin >> n; n = (n*n-n)/2; m = 0; a[m++] = 1; for(int k=1;k<=n;++k) for(int i=0, o=0;i<m || o;++i){ o = a[i] * 3 + o; a[i] = o % 10; o /= 10; m =...
#pragma once #include <string> #include <cstdint> #include <vector> #include <glm/glm.hpp> class Shader { // mostly for debug purpose static uint32_t currentId; uint32_t id = 0; public: Shader() = default; ~Shader() { Reset(); } Shader(Shader&& other) noexcept; Shader& operator=(Shader&& other) noexcept; S...
// http://oj.leetcode.com/problems/restore-ip-addresses/ class Solution { void do_restore(string& str, int beg, vector<string>& ret, string tmp, int remaining) { int size = str.size() - beg; if (remaining == 0 && size == 0) { string r = tmp; ret.push_back(r); ...
#pragma once #include<iostream> using namespace std; template<class T> struct CircLinkNode { T data; CircLinkNode<T>* next; }; template<class T> class CircLinkList { public: CircLinkList(); //构造函数 ~CircLinkList(); //析构函数 void Head_Insert(); //头插法创建链表 void Tail_Insert(); //尾插法创建链表 ...
#include <iostream> struct Date { int day; int month; int year; }; bool check(int day,int month) { if(1 > month || 12 < month || 1 > day) { return false; } if((1 == month || 3 == month || 5 == month || 7 == month || 8 == month || 10 == month || 12 == month) && 31 < day) { retur...
/***************************************************************************** Copyright (c) 2008, Hangzhou H3C Technologies Co., Ltd. All rights reserved. ------------------------------------------------------------------------------ list.h Project Code: Comware Leopard Module Na...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2012 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #ifndef SELECTIONPOINT_H #define SELECTIONPOINT_H class HTML_El...
#include "CGetGameSwitch.h" #include "json/json.h" #include "Logger.h" #include "threadres.h" #include "Lib_Ip.h" #include <set> #include "CConfig.h" #include "RedisLogic.h" #include "Helper.h" int CGetGameSwitch::do_request(const Json::Value& root, char *client_ip, HttpResult& out) { //Json::Value ret; //L...
#include <stdio.h> int main(void) { int rate=25; float km; float meter; float total; int bayad=1; printf("enter kM\n"); scanf("%f",&km); meter=km*1000; while(meter>=280) { meter=meter-280; bayad=bayad++; } total=bayad*2+rate-2; printf("the amount due...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 1995-2008 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. It may not be distributed * under any circumstances. */ #include "core/pch.h" #ifdef _MAC_DEBUG #include "platforms/mac/...
#include<cstdio> #include<algorithm> using namespace std; int n,k; int e[11]; struct per { int data; int bian; }w[20100]; bool cmp(per x,per y) { if(x.data==y.data) return x.bian<y.bian; return x.data>y.data; } int main() { scanf("%d%d",&n,&k); for(int i=1;i<=10;i++) scanf("%d",&e[i]); ...
#pragma once #include "Command.h" class MoveCommand : public Command { private: int mX, mY; MoveCommand(); public: MoveCommand(int x, int y); ~MoveCommand(); void enter(); void execute(MovableObject* obj); void exit(); };
/* Author: Manish Kumar Username: manicodebits Created: 11:04:31 11-04-2021 */ #include <bits/stdc++.h> using namespace std; #define int long long #define PI 3.141592653589 #define MOD 1000000007 #define FAST_IO ios_base::sync_with_stdio(false), cin.tie(0) #define deb(x) cout<<"[ "<<#x<<" = "<<x<<"] " ...
// // serial.cpp // serialowabaza // // Created by Julia on 06.11.2018. // Copyright © 2018 Julia. All rights reserved. // #include <stdio.h> #include "serial.h" void serial::prezentujsie(){ ogladadlo::prezentujsie(); std::cout<<"Jest to serial o średniej ocen "<<ocena<<". Czas trwania pojedynczego odcinka...
/* * Copyright (c) 2014-2017 Detlef Vollmann, vollmann engineering gmbh * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ #ifndef CANVAS_HH_SEEN_ #define CANVAS_HH_SEEN_ #include "shape.hh" #include "extgra...
/* Question => Given a square martix A and its numbers of rows (or columns) N, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonals, swithching the row and column indices of the matrix. Suppose in the original matrix 2 is present at (0,1) then in the transposed matrix it...
#pragma once #include <thread> ///////////////////////////////////////////////////////////////////// // MsgClient.h - Starts Client Sender and Receivers // // ver 1.0 // // Lanaguage: C++ Visual Studio 2015 // // Platform: ...
// Created on: 1998-07-28 // Created by: LECLERE Florence // Copyright (c) 1998-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the G...
// Implements #include "ThrottleController.h" // For: std::abs #include <complex> ThrottleController::ThrottleController(double Kp_, double Ki_, double Kd_, bool optimize) : pid{Kp_, Ki_, Kd_}, is_optimized{optimize} { } ThrottleController::~ThrottleController() { } double ThrottleController::update(double cte) {...
#ifndef LEVELMODEL_H #define LEVELMODEL_H #include <SFML\System\Vector2.hpp> //RHYTHMS: Density, RhythmType, Length enum Density { low, // = 0, 3, 4 medium, // = 1, 5, 8 high // = 2, 10, 16 }; enum RhythmType { regular, swing, random }; //ACTIONS: Verb, Direction, Starttime, Stoptime enum Verb { move, brake...
#include "wali/graph/RegExp.hpp" #include "wali/graph/GraphCommon.hpp" #include <math.h> #include <algorithm> #include <iterator> #include <cassert> #include <sstream> #if defined(PPP_DBG) #include "wali/SemElemTensor.hpp" #endif namespace wali { namespace graph { RegExpDag::RegExpDag() { cu...
#include <bits/stdc++.h> using namespace std; #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) #define MAXN 1000000 #define INF 0x3f3f3f3f #define DEVIATION 0.00000005 typedef long long LL; bool table[MAXN+10]; int main(int argc, char const *argv[]) { int num; int x,y,z; while( ~scanf("%d",&num) &&...
#include <iostream> #include <opencv2/opencv.hpp> // include OpenCV header file #include <librealsense2/rs.hpp> // include the librealsense C++ header file using namespace std; using namespace cv; using namespace rs2; int main(int argc, char* argv[]) try { // Contruct a pipeline which abstracts the devi...
#include <catch2/catch.hpp> #include <replay/rle_vector.hpp> using namespace replay; TEST_CASE("can create an empty rle_vector") { REQUIRE(rle_vector<double>().empty() == true); } TEST_CASE("push increases size according to count") { rle_vector<int> rle; rle.push(4, 7); rle.push(8, 11); REQUIRE(r...
#include "iomode.h" #include "iomodeutils.h" #include <fstream> #include "iostream" void setInputMode(Config& config) { Mode readMode = config.getInputMode(); if (readMode == Mode::FILE) freopen("input.txt", "r", stdin); return; } void setOutputMode(Config& config) { Mode writeMode = config.ge...
//This is a header file intended to be used with the G12 data stream. //Purpose: Output if track passes G12 fiducial cuts //Input: Lab Mometum (Pmom), Lab angle theta (Theta), Lab angle phi (Phi), charge of track (q), directory of fiducail parameter .txt file and type of cut (type_of_cut) //type_of_cut: Loose, Tight, N...
// Created on: 2015-06-26 // Created by: Andrey Betenev // Copyright (c) 2015 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as pub...
#include <sstream> #include <iostream> #include <vector> using namespace std; int main() { vector<string> strings; std::string str = "denmark,sweden,india,us;"; if(str.size() > 0) str.resize( str.size() - 1); istringstream f(str); string s; while (getline(f, s, ',')) { cout << s <<...
/* Main driver file to run threading tests.*/ #include "cc/shared/common.h" #include "cc/shared/atomic_int.h" #include "cc/shared/mutex.h" #include "cc/shared/rand_utils.h" #include "cc/shared/thread_pool.h" #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> namespace cc_shared { class Thre...
/* -*-C++-*- */ /* * Copyright 2016 EU Project ASAP 619706. * * 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 required by app...
#ifndef VEHICLE_H #define VEHICLE_H #include <iostream> #include <random> #include <sstream> #include <fstream> #include <math.h> #include <vector> #include <map> #include <string> #include <iterator> using namespace std; enum State { KL, // keep lane LCL, // lane change left LCR, // lane change right PLC...
#include <bits/stdc++.h> using namespace std; #define TESTC "" #define PROBLEM "11879" #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) bool solve(string num ){ if( num.size() < 10 ){ int ans = 0; for(int i = 0 ; i < num.size() ; i++ ) ans = ans*10 + num[i]-'0'; return ans%17 == 0; } char t...
#ifndef WORLDOBJECT_H #define WORLDOBJECT_H #include "SpriteObject.h" #include "ICollideable.h" class WorldObject : public SpriteObject, public ICollideable { public: WorldObject(SpriteInfo& info, sf::Vector2f pos, bool _static = false); ~WorldObject(); void update(); void draw(sf...
#include <stdlib.h> #include <string.h> #include "HallManager.h" #include "ClientHandler.h" #include "Packet.h" using namespace std; static HallManager* instance = NULL; HallManager* HallManager::getInstance() { if(instance==NULL) { instance = new HallManager(); } return instance; } int HallManager::sendToHall...
#include <bits/stdc++.h> using namespace std; string divide(int num, int dem){ if(num == 0) return "0"; if(num % dem == 0) return to_string(num / dem); string result; if(num*dem < 0) result.insert(0,1,'-'); num = abs(num); dem = abs(dem); result.insert(0,to_string(num/dem)); num %= dem; ...
#include <SoftwareSerial.h> #include <Servo.h> Servo myservo; int bluetoothTx = 10; int bluetoothRx = 11; char junk; String inputString=""; int sensorPin1 = A0; // select the input pin for the LDR int sensorValue1 = 0; // variable to store the value coming from the sensor int led1 = 3; SoftwareSerial bluetooth(blue...
#include "RFM95.h" // Singleton instance of the radio driver. Managed by preprocessor directives RH_RF95 radio(); // Class to manage message delivery and receipt, using the driver declared above RHReliableDatagram manager(rf95, SERVER_ADDRESS); RFM95::RFM95() { } void RFM95::initRadio() { Serial.begin(9600); ...
#include <stdio.h> #include <iostream> #include <math.h> #include <algorithm> #include <memory.h> #include <set> #include <map> #include <queue> #include <deque> #include <string> #include <string.h> #include <vector> typedef long long ll; typedef long double ld; typedef unsigned long long ull; const ld PI = acos(-1.)...
/* Petar 'PetarV' Velickovic Algorithm: Segment Intersection */ #include <stdio.h> #include <math.h> #include <string.h> #include <iostream> #include <vector> #include <list> #include <string> #include <algorithm> #include <queue> #include <stack> #include <set> #include <map> #include <complex> using namespace std;...
/** * @file test.cpp * * * @author Fan Kai(fk), Peking University * @date 2008年03月31日 22时42分21秒 CST * */ #include <boost/scoped_ptr.hpp> #include <boost/shared_ptr.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/binary_oarchive.hpp> #include ...
// Created on: 1997-02-12 // Created by: Alexander BRIVIN // Copyright (c) 1997-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the G...
// Created by: Nikolai BUKHALOV // Copyright (c) 2015 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free So...
#include <deque> #include "Token.h" #include "Lexer.h" #ifndef ORDER_H #define ORDER_H class Order { public: std::deque < Token > tokens; enum Type { term, text, declar, loop_start, loop_stop, if_statement, if_stop, print, printValues, revalue, revalueSTR, skip}; Type type; std::string GetTypeST...
#include <algorithm> #include <array> #include <cstring> #include <iomanip> #include <iostream> #include <vector> uint32_t add(uint32_t a, uint32_t b) { return a + b; } void round(std::array<uint32_t, 32>& state) { // 1. add for (uint32_t i = 0; i < 16; i++) { state[16 + i] = add(state[16 + i], state[...
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmListCommand.h" #include <algorithm> #include <cassert> #include <cstddef> #include <cstdio> #include <cstdlib> // required for atoi #include <functional> #incl...
//#include "UIButton.h" //#include "Platy.Game.Core/Postmaster/Message.h" //#include "Platy.Game.Core/Containers/AssetContainer.h" //#include "Platy.Game.Core/Graphics/Colors.h" // // //template <class C> //UIButton<C>::UIButton() //{ // Subscribe(Message::EMessageType::MOUSE_LEFT_PRESSED); // Subscribe(Message::EMessa...
#include "Configure.h" #include "Logger.h" #include "BaseClientHandler.h" #include "Room.h" #include "HallManager.h" #include "GameApp.h" #include "CoinConf.h" #include "AllocSvrConnect.h" #include "game_version.h" typedef SocketServer<BaseClientHandler> GameAcceptor; class GameServerApp : public GameApp { public: v...
//=========================================================================== //! @file shader_manager.cpp //! @brief シェーダー管理 //=========================================================================== namespace { std::unordered_map<std::string, std::unique_ptr<ShaderVs>> shaderVs_; std::unordered_map<std::stri...
#include "Light.hpp" Light::Light(GLenum lightNumber, Color ambient, Color diffuse, Color specular, Vector3 position) { this->lightNumber = lightNumber; this->ambient[0] = ambient.getRed() / 255.0; this->ambient[1] = ambient.getGreen() / 255.0; this->ambient[2] = ambient.getBlue() / 255.0; this->a...
/* ***** BEGIN LICENSE BLOCK ***** * FW4SPL - Copyright (C) IRCAD, 2012-2013. * Distributed under the terms of the GNU Lesser General Public License (LGPL) as * published by the Free Software Foundation. * ****** END LICENSE BLOCK ****** */ #include <boost/foreach.hpp> #include <boost/filesystem.hpp> #include <boo...
#ifndef APPLICATION_CHATITEM_H #define APPLICATION_CHATITEM_H #include <string> #include "BaseObject.h" #include "KeyWords.h" // Chat item for view chat in chat list class ChatItem : public BaseObject { public: ChatItem(); ChatItem(int id, const std::string& chatName); ~ChatItem() override = default; ...
#include <ESP8266WiFi.h> #include <SoftwareSerial.h> #include <Servo.h> SoftwareSerial mySerial(D5,D6); const char* ssid = "your SSID"; const char* password = "password"; const char* host = "api.thingspeak.com"; const char* privateKey = "thingspeak write API"; const String talkBackAPIKey = "talkback API"; const ...
#include "conv_3x3.h" #include "hw_classes.h" struct diff_d_cache { // Capacity: 1 fifo<hw_uint<32> , 1> f; inline hw_uint<32> peek(const int offset) { return f.peek(0 - offset); } inline hw_uint<32> peek_0() { return f.peek(0); } inline void push(const hw_uint<32> value) { #ifdef __VIVADO_SYNTH_...
#include "Ak_Transform.h" Ak_CTransform::Ak_CTransform() : m_posX(0.0f) , m_posY(0.0f) , m_scaleX(1.0f) , m_scaleY(1.0f) , m_rotation(0.0f) , m_isModifyTransform(false) { } Ak_CTransform::~Ak_CTransform() { } void Ak_CTransform::UpdateTransform() { if (!m_isModifyTransform) return; OnModifyTransform(); m_isMo...
//算法:DP/二分查找 //思路:先按一边城市的序号升序排序 //然后找另外一边的最长上升子序列 /* 原因: 按一边城市的序号升序排序后, 理想情况便是另一边也是上升的序列 这样可以保证所有的路径都不相交 但理想很丰满,现实很骨感, 所以要找到最多的不相交的路径 即找到另一边最长上升子序列的长度 */ #include<cstdio> #include<algorithm> using namespace std; struct baka9 { int c1,c2; }a[200010]; int n; int st1[200010]={-10000000};//二分查找 ...
#ifndef __CURSES_TERMINAL_HPP_INCLUDED__ #define __CURSES_TERMINAL_HPP_INCLUDED__ #include "config.hpp" #ifdef CURSES_WIN # include "win/WinTerm.hpp" #endif // include windows implementation #endif // __CURSES_TERMINAL_HPP_INCLUDED__
#include "OpenGL/OpenGLFrameBuffer.h" #include <glad/glad.h> using namespace Rocket; static const uint32_t s_MaxFramebufferSize = 8192; OpenGLFrameBuffer::OpenGLFrameBuffer(const FramebufferSpec& spec) : m_Specification(spec) { Invalidate(); } OpenGLFrameBuffer::~OpenGLFrameBuffer() { if(m_ColorAttachments.size(...
#ifndef VEC_HPP #define VEC_HPP class Vect { private: int* arr; int size; public: Vect (); Vect (int a); Vect (Vect& obj); ~Vect (); Vect(Vect&& object); int getSize(); int getElement(int i); void setElement(int i, int num); void pushBack (int a); void popBack (); ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); const int INF = 2e9; int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } unordered_map<int, int> last; vector<int> prev(n, -INF); ...
#include <Arduino.h> #include <AnalogDisplay.h> #include <NetworkController.h> #define PIN_THERMISTOR 0 #define THERMISTOR_UPDATE_FREQUENZ 1500 #define WIFI_UPDATE_FREQUENZ 10000 //#define WIFI_SSID "Zum Einhornland" //#define WIFI_PW "Butterbreadcoffee23" #define WIFI_SSID "KabelBox-89F4" #define WIFI_PW "3949932754...
// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // // SPDX-License-Identifier: BSD-3-Clause #pragma once // [CLI11:public_includes:set] #include <algorithm> #include <cstdint> #include <functional...
#include<iostream> #include<vector> #include<algorithm> #include<set> #include<map> using namespace std; class Solution { public: bool isSelfCrossing(vector<int>& x){ //基本思想:数学,交叉只有三种可能 for (int i = 3; i < x.size(); ++i){ if(x[i]>=x[i-2]&&x[i-3]>=x[i-1]){ return true; ...
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { int T, N; cin >> T; vector<int> list; vector<int>::iterator iter; for(int i = 0; i < T; i++){ cin >> N; list.push_back(N); } for(iter = list.begin...
#include "scene_flow_constructor.h" int main(int argc, char **argv) { ros::init(argc, argv, "scene_flow_constructor"); scene_flow_constructor::SceneFlowConstructor scene_flow_constructor; ros::spin(); return 0; }
#pragma once namespace qp { class CTypeInQuestionState; typedef std::shared_ptr<CTypeInQuestionState> CTypeInQuestionStatePtr; typedef std::shared_ptr<const CTypeInQuestionState> CConstTypeInQuestionState; class ITypeInQuestionState; typedef std::shared_ptr<ITypeInQuestionState> ITypeInQuestionStatePtr; }
#include "GameScene.h" #include "Constant.h" #include "OverScene.h" #include "AudioEngine.h" #include <time.h> using namespace experimental; Scene* GameScene::createScene() { return GameScene::create(); } bool GameScene::init() { if (!Scene::init()) return false; time_count = 0; isChallange = false; this->m...
#include<bits/stdc++.h> using namespace std; class ComplexNumbers{ private: int real; int imaginary; public: ComplexNumbers(int real,int imaginary){ this -> real = real; this -> imaginary = imaginary; } void plus(ComplexNumbers c2){ int r = this -> real + c2.real; int i = this -> imaginary + c2...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int p; vector<char> v; for (int i = 0; i < s.length(); i++) { p = 0; for (int j = 0; j < v.size(); j++) { if (s[i] == v[j]) { p += 1; ...
/* Task 4 – Students Information Write a program, use a class that has params: Student Name Student Surname Total Average The class should have Print method that for a given object prints all the information Make a vector in main that for a given number ( passed thru user ) saves the objects Again with Static meber a...
#include "stdafx.h" class SoundGenerator; HINSTANCE hInst; HWND hWnd; SoundGenerator*generator; HFONT hFontStatus; #pragma comment(lib, "Winmm.lib")
#ifndef TP_PPROJECT_BASECONNECTION_H #define TP_PPROJECT_BASECONNECTION_H #include <iostream> #include <deque> #include <boost/asio/detail/array.hpp> /* * Base class of connection */ class BaseConnection { public: virtual ~BaseConnection() {} /* * Sending a response to the client */ virtual v...
// testDll.cpp : 定义 DLL 应用程序的导出函数。 // #include "stdafx.h" #include <string> extern "C" { __declspec(dllexport) int my_add(int a, int b); } int my_add(int a,int b) { return a+b; }
/* * This file contains the heading files for the lidar interface * using the Adafruit VL53L0X libary * * Creation date: 2019 06 10 * Author: Pascal Pfeiffer */ #ifndef LIDAR_H #define LIDAR_H #include "Adafruit_VL53L0X.h" // port expander I2C adress #define EXP_ADDRESS 0x20 /* * Port expander pinning: * P0 ...
#include"../include/knn_handwriteDigitsClassifyer.h" int main(int argc, char** argv) { HD_Classify_KNN classifer_knn; //string data = "D:/CODEing/OpenCV_codeSources/knn_handwriteDigitsClassify/data/cv_sample_png/digits.png"; //classifer_knn.loadTrainDataFromImg(data); //classifer_knn.trainAndTestKNN(); string knnd...
// // Created by 钟奇龙 on 2019-05-18. // #include <iostream> #include <vector> using namespace std; int maxABS(vector<int> arr){ int maxValue = INT_MIN; for(int i=0; i<arr.size(); ++i){ maxValue = max(maxValue,arr[i]); } return max(maxValue-arr[0],maxValue-arr[arr.size()-1]); } int main(){ c...
/** * @file AudioDevice.h * @brief Header file for Engine::AudioDevice * * @author Gemuele (Gem) Aludino * @date 09 Dec 2019 */ /** * Copyright © 2019 Gemuele Aludino * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated ...
#include <iostream> #include <cstddef> using namespace std; class Nod{ private: char info; Nod *next; public: Nod *GetNext(){return next;} char GetInfo(){return info;} void setNext(Nod *next1){this->next=next1;} Nod()//constructor neparametrizat { this->info=0; this->next=nul...
#include<vector> #include<algorithm> #include<iostream> using namespace std; class Solution { public: int maxSubArrayLen(vector<int>& nums, int k) { //基本思想:前缀和+哈希表HashMap,HashMap[i]表示前缀和为i时的最小下标处,pre[i]-pre[j-1]==k,pre[j-1]==pre[i]-k //遍历数组nums,计算从第0个元素到当前元素的和sum,用哈希表Map保存出现过的累积和sum的最小下标处; /...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; using ii = pair<ll,ll>; using iii = pair<ll,ii>; #define F first #define S second #define MP make_pair #define PB push_back vector<pair<ll,ll> > v[10002]; // v[i].F->node connnected to i & v[i].S-> distance b/w them... ll dist[1002][1002]; ...
#include <string> class Student { public: Student(std::string name) : student_name{name}, exam_sum{0}, exam_num_grades{0} { } std::string name() { return student_name; } void exam(double grade) { exam_sum += gra...
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*- * * Copyright (C) 1995-2008 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. * * @author Arjan van Leeuwen (arjanl) */ #include "core/pch.h" #include "adjunct/m2/s...
#include "randomzie.h" #include "utilities.h" uint32_t randomize::rangeInt(uint32_t min, uint32_t max) { uint32_t bufVal = 0; getrandom(&bufVal, sizeof(uint32_t), GRND_NONBLOCK); return bufVal % (max - min) + min; } string randomize::cookie(uint32_t min, uint32_t max) { stringstream buffer(""); ui...
#include<iostream> #include<cstdio> #include<map> #include<set> #include<vector> #include<stack> #include<queue> #include<string> #include<cstring> #include<sstream> #include<algorithm> #include<cmath> #define INF 0x3f3f3f3f #define eps 1e-8 #define pi acos(-1.0) using namespace std; typedef long long L...
/* * terrain.h * 02564_Framework * * Created by J. Andreas Bærentzen on 02/02/10. * Copyright 2010 __MyCompanyName__. All rights reserved. * */ #ifndef __TERRAIN_H__ #define __TERRAIN_H__ #include <CGLA/Vec3f.h> #include <GLGraphics/User.h> #include <GLGraphics/ShaderProgram.h> /** This class represents a...
# define size 50000 # include <stdio.h> # include <stdlib.h> # include <time.h> # include <locale.h> #include<iostream> using namespace std; class masiv {int mas1[size],mas[size]; public : void masiv::zapoln(){int i; for (i=0;i<size;i++) { mas1[i]=rand()%100 ; mas[i]=mas1[i]; } return ; } void rewri...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 1995-2012 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. It may not be distributed * under any circumstances. */ #ifndef DESKTOP_DRAG_OBJECT_H #define DESKTOP_DRAG_OBJECT_H #ifd...
#include <iostream> #include "CmdMessenger.h" using namespace std; using namespace serial; class Oi { public: oi(){} void cb(cmd::CmdReceived& m){} }; int main(int argc, char *argv[]) { cmd::CmdMessenger oi; Oi haha; oi.teste(haha, &Oi::cb); return 0; }
//Declaración de constantes const int boton = 2; //Da el nombre “boton” al pin 2 void setup() { //Inicializa la comunicación serial a 9600 bits por segundo Serial.begin(9600); pinMode(boton, INPUT); //Configura el pin "boton" como entrada digital } void loop() { //Almacena la información de la entrada digital en la...
/* * 题目:740. 删除并获得点数 * 链接:https://leetcode-cn.com/problems/delete-and-earn/ * 知识点:动态规划 */ class Solution { private: int rob(vector<int>& nums) { int n = nums.size(); if (n == 1) { return nums[0]; } int first = nums[0], second = max(nums[0], nums[1]); for (int ...
#include <SFML/Graphics.hpp> #include <SFML/Window.hpp> #include <SFML/System.hpp> #include<sstream> #include<fstream> #include<iomanip> #include<time.h> #include <iostream> #include "IA.h" #include "GameDimens.h" #include "Game.h" using namespace std; int main() { Game game(WIDTH, HEIGHT, "Ig...
#include "serverSNFS.h" pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; path server_directory; int main(int argc, char* argv[]){ if(argc != 5){ cout << "Usage is ./serverSNFS -port port# -mount directory" << endl; exit(EXIT_FAILURE); } check_values(argv[1], "-port"); check_port(argv[2], "port#...
#ifndef DOOR_H #define DOOR_H #include <string> #include "UsableObject.h" namespace ld { struct Door : public UsableObject { Door(int x_, int y_, std::string type_, std::string name_, double rotation_) : x(x_), y(y_), type(type_), name(name_), rotation(rotation_), locked(false), ...
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <fstream> #include <boost/lexical_cast.hpp> using namespace std; using namespace boost; struct BankAccount { int balance{0}; int overdraft_limit{-500}; void deposit(int amount) { balance += amount; std::cou...
/* -*- Mode: c++; indent-tabs-mode: nil; c-file-style: "gnu" -*- * * Copyright (C) 1995-2005 Opera Software ASA. All rights reserved. * * This file is part of the Opera web browser. It may not be distributed * under any circumstances. */ #ifndef XPNODESET_H #define XPNODESET_H #include "modules/xpath/src/xpno...
#ifndef STRING_TRIM_HPP #define STRING_TRIM_HPP #include <string> namespace String { static std::string trimStart(std::string source, const std::string &trimChars = " \t\n\r\v\f") { return source.erase(0, source.find_first_not_of(trimChars)); } static std::string trimEnd(std::string source, c...
#ifndef HASH_MAP_HPP #define HASH_MAP_HPP // Pedro Escoboza // A01251531 // TCB1004.500 // 21/11/2020 #include <memory> #include <vector> /** * Implementation a hash table of constant size. * * @param T Type of the entry value * @param K Type of the entry key * @param Size Constant size of the hash table * @p...
// // GCastleEnemy.h // Core // // Created by Max Yoon on 11. 7. 20.. // Copyright 2011년 __MyCompanyName__. All rights reserved. // #ifndef __Core__GCastleEnemy__ #define __Core__GCastleEnemy__ #include "GCastle.h" class GIconGage; class GCastleEnemy : public GCastle { public: static GCastleEne...
#pragma GCC optimize("Ofast") #include <algorithm> #include <bitset> #include <deque> #include <iostream> #include <iterator> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <unordered_map> #include <unordered_set> using namespace std; void abhisheknaiidu()...