text
stringlengths
8
6.88M
#pragma once #include <string> using std::string; class OriginPoint { private: string targetID; int posixtime; double longitude; double latitude; double speed; double angle; public: OriginPoint(int trackID, string targetID, char*posixtime, char* centerlongitude, char* cenlatitude, char* speed, char* angle); v...
#include<iostream> using std::cin; using std::cout; using std::endl; float GetValueBetween(float min,float max) { float temp,accept; cout<<"Enter a value between"<<min<<","<<max; cin>>temp; accept=1.0; while(accept>0.0) { if(temp>=min) if(temp<=max) accept=0.0; if(accept>0.0) { cou...
#include<fstream.h> #include<graphics.h> #include<string.h> #include<iostream.h> #include<conio.h> #include<dos.h> #include<iomanip.h> #include<process.h> void dev() { clrscr(); for(int x=50;x>=20;x--) { textcolor(WHITE+LIGHTGRAY); delay(160); gotoxy(x,12); cputs(" P R O J E C T ...
#include <iostream> #include <iomanip> using namespace std; int afterLanding(int sq, int CC[16], int CH[16], int& CC_idx, int& CH_idx) { if (sq == 30) return 10; if (sq == 2 || sq == 16 || sq == 33) { int card = CC[CC_idx]; CC_idx = (CC_idx+1)%16; return (card == -1 ? sq : card); }...
#include<iostream> #include<cstdio> using namespace std; //在[nBegin,nEnd)区间中是否有字符与下标为pEnd的字符相等 bool IsSwap(char* pBegin , char* pEnd) { char *p; for(p = pBegin ; p < pEnd ; p++) { if(*p == *pEnd) return false; } return true; } void Permutation(char* pSt...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** */ #ifndef CORS_REQUEST_H #define CORS_REQUEST_H #ifdef CORS_SUPPORT ...
// // particles.hpp // w03_h01 // // Created by Kris Li on 9/22/16. // // #pragma once #include "ofMain.h" class Particle{ public: void draw(); void setup(); void explosion(); void update(); void restart(); ofPoint pos; ofPoint vel; ofColor color; float...
#include <sgfx/image.hpp> #include <sgfx/io_helper.hpp> #include <algorithm> #include <fstream> #include <numeric> #include <stdexcept> #include <string> #include <cstdint> using namespace sgfx; canvas sgfx::load_ppm(const std::string& path) { std::ifstream in{path}; in.exceptions(std::ios_base::failbit | s...
/* * function: the unit test file of queueTemplate.h, test the class Queue * * author: feng * time: 2013/9/11 */ #include "queueTemplate.h" // unit test function void test1(); void test2(); void test3(); int main(void) { test1(); cout<<endl<<endl; test2(); cout<<endl<<endl; return 0; } // test the con...
#include <bits/stdc++.h> #include <unistd.h> // for sleep() using namespace std; struct Process { int pid; // Process ID int bt; // Burst Time int art; // Arrival Time }; void findTurnAroundTime(vector<Process> &proc,int n,vector<int> &wt, vector<int> &tat) { for (int i = 0; i < n; i++) tat[i] = proc[i].bt + wt[i...
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*- * * Copyright (C) 1995-2009 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/desk...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #ifndef TVMANAGER_H #define TVMANAGER_H #ifdef HAS_ATVEF_SUPPOR...
// // Created by cirkul on 23.11.2020. // #ifndef UNTITLED3_PLAYGROUND_H #define UNTITLED3_PLAYGROUND_H #include <map> #include <vector> const int MAX_COUNT = 4; class Creature; class Animal; class Plant; class Playground { public: Playground (int rows, int cols); class Cell { public: Cell();...
// Compile using following commands: // g++ prob2.cpp // ./a.out // ADD ANSWER TO THIS FILE #pragma once class SNode { public: int data; SNode *next; }; class IntegerLinkedList { private: SNode *head; int countEvenRecurse (SNode *ptr) { return 2; // COMPLETE THIS FOR PROBLEM 3 ...
#include "Buffer.h" #include "OpenGLDebug.h" Buffer::Buffer(GLenum type, unsigned int dataSize, GLvoid * data, GLenum memoryType) { _type = type; glGenBuffers(1, &_id); glCheckError(); glBindBuffer(_type, _id); glCheckError(); glBufferData(_type, dataSize, data, memoryType); glCheckError(); glBindBuffer(_type, 0)...
/** ****************************************************************************** * Copyright (c) 2019 - ~, SCUT-RobotLab Development Team * @file W25Qx.h * @author Anthracene * @brief Code for driver of SPI flash chip W25Qx *********************************************************************...
#include "cactus.h" #include "cactusspawner.h" #include "timerlist.h" CactusSpawner::CactusSpawner(QGraphicsScene * scene, Scoreboard * scoreboard) { this->scoreboard = scoreboard; this->scene = scene; QTimer *timer = new QTimer(); allTimers->addToList(timer); QObject::connect(timer, SIGNAL(timeout...
#include <iostream> int binarySearch(int* array, int number, int leftEnd, int rightEnd) { if (rightEnd >= leftEnd) { int middle = leftEnd + (rightEnd - leftEnd) / 2; if (number == array[middle]) { return middle; } else if (number > array[middle]) { ...
// I2C master ESP32 #include <Wire.h> #define I2C_ADDR 4 //#define SPEED 1000000 // fast mode #define SPEED 3200000 // mode hw_timer_t * timer = NULL; #define BUFSIZE 8 volatile byte dbuf[2][BUFSIZE]; volatile uint8_t playing = 0, filling = 1, bidx = 0; void IRAM_ATTR onTimer() { dacWrite(25, dbuf[playing][bi...
#include "item/broken_line.h" #include <QPainter> #include <QStyleOptionGraphicsItem> std::unique_ptr<broken_line> broken_line::make(nlohmann::json data, QPointF pos, item *parent) { auto ret = unique_ptr<broken_line> (new broken_line(std::move(data), pos, parent)); if (ret == nullptr or !ret->init()) { ...
/* * SDL.cpp * * Created on: 16 aug. 2017 * Author: xxgranfj */ #include <iostream> #include <SDL2/SDL.h> #include <iostream> #include <vector> using namespace std; #define window_width 400 #define window_height 400 #define fps 60 /* * Running WinMain(); because of SDL. This is not really necessary but i...
#include <iostream> #include <string> #include <vector> using namespace std; bool IsPalindrom(string s) { int n = s.size(); for (int i = 0; i < (n / 2); ++i) { if (s[i] != s[n - i - 1]) { return false; } } return true; } vector<string> PalindromFilter(vector<string> words, int minLength) { vector<str...
// Copyright (c) 2020 ETH Zurich // Copyright (c) 2019 Thomas Heller // // SPDX-License-Identifier: BSL-1.0 // 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) #pragma once #include <pika/config.hpp> #include <pi...
// VisibleRect.h // 星月倾心贡献~~~~ // 可视窗口区域 // 将窗口分为9部分,类似与一个“米”字。 #ifndef __VISIBLERECT_H__ #define __VISIBLERECT_H__ #include "cocos2d.h" class VisibleRect { public: // 以下全是静态方法,调用方式:例如:VisibleRect::center() static cocos2d::Rect getVisibleRect(); // 获得可视窗口大小 static cocos2d::Point left(); ...
#ifndef COMPLEX_H #define COMPLEX_H class Complex { private: int re; int im; public: Complex(int _re, int _im); const int getRe(){return re;} const int getIm(){return im;} void setRe(int _re){re = _re;} void setIm(int _im){im = _im;} int test(); }; #endif // COMPLEX_H
#include "cantcoap.h" #include <string> #include <cstring> #include <cstdlib> struct Options { CoapPDU::Code code; const char * hostname; const char * path; const char * data; bool confirmable; }; class CoapRequest : public CoapPDU { public: CoapRequest(const Options & opt) : CoapPDU()...
/* * HeartbeatServiceClient.cc * * Created on: Nov 18, 2017 * Author: cis505 */ #include "WriteServiceClient.h" WriteCommandResponse WriteServiceClient::WriteCommand(string user, string uid, string content, WriteType wtype, FileType ftype, vector<string> replicas, int seqNum) { ClientContext context; W...
// Recursive program to reverse words in a string // For eg: CAT IS RUNNING -> RUNNING IS CAT #include <iostream> #include<string> using namespace std; string reverse(string s1,string s2,int l,int r) { if(r < s1.length()) { if(s1[r] != ' ') { r++; return reverse(s1,s2,...
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // Примеры использования управляющих символов // V 1.0 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #include <iostream> #include <unistd.h> using namespace std; int main() { cout << "Управляющие символы" << endl; cout << "Новая строка: " << "first line\n Secon...
#include "userInputEvent.h" userInputEvent::userInputEvent(char key){ this->key = key; } userInputEvent::userInputEvent(GameObject a, GameObject b) { this->a = a; this->b = b; } char userInputEvent::getKeyPress() { return key; } GameObject userInputEvent::getObjA() { return a; } GameObject ...
// Make composition of TankBody and TankTurret objects in Tank class
/* * Stopping Times * Copyright (C) Leonardo Marchetti 2011 <leonardomarchetti@gmail.com> */ template <typename FP> StoppingTimes<FP>::~StoppingTimes() { delete sde_; } template <typename FP> StoppingTimes<FP>::StoppingTimes(boost::function<FP(FP)> mu, boost::function<FP(FP)> sigma, boost::function<...
// Taken from the Boost.Bind library // // bind_rv_sp_test.cpp - smart pointer returned by value from an inner bind // // Copyright (c) 2005 Peter Dimov // Copyright (c) 2013 Agustin Berge // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See // accompanying file...
/**************************************************************************** ** Meta object code from reading C++ file 'optionssauvepoints.h' ** ** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.6) ** ** WARNING! All changes made in this file will be lost! **************************************************...
// OpenVDB_Softimage // VDB_Utils.h // utilties use to help logging VDB related data #ifndef VDB_UTILS_H #define VDB_UTILS_H #include <iostream> #include <sstream> #include <string> #include <iterator> #include <vector> #include <openvdb/openvdb.h> std::string bkgdValueAsString (const openvdb::GridBase::Co...
#pragma once #include "ai.hpp" #include "pathfind.hpp" #include "components/movable.hpp" #include <vector> #include <cassert> namespace ai { struct PathAI : AIScript { PathAI(point d, AI::timer_t rate = 5) : walkrate(rate), dest(d), desc("Walking") { } inline virtual AI::timer_t start(AI* ai) {...
#include <algorithm> #include <cassert> #include <vector> #include "bsgs.h" #include "dbg.h" #include "perm.h" namespace cgtl { void BSGS::base_change(std::vector<unsigned> prefix) { DBG(DEBUG) << "Appending prefix " << prefix << " to base " << _base; Perm conj(degree()); Perm conj_inv(degree()); for (auto...
#pragma once #include <string> #include <vector> // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 // WW US K ODP ZR INT SW OGD A ŻYW SW OGD A ŻYW S WT SZ MAG PO PP class Character_profession { public: //std::string stats_profession[16] = {" "," "," "," "," "," "," "," "," "," "," "," ",...
/*#include "M2VPost.h" u32 waitInput(u32 wait){ u32 input = 0; while(input != wait){ hidScanInput(); input = hidKeysDown(); } return input; } void keyboardInput(char * buffer, unsigned int bufferSize, char hint[64]){ SwkbdState swkbd; SwkbdButton button = SWKBD_BUTTON_NONE; swkbdInit(&swkbd, SWKBD_TYPE_NOR...
#include "MyApp.hpp" int main() { cdt::MyApp *app = new cdt::MyApp(); return app->start(); }
#include "f3lib/io/DefineReader.h" #include <fstream> #include <iostream> #include <regex> bool f3::io::readDefines(const std::string& filepath, f3::types::DefineMap& defineMap) { std::ifstream ifs(filepath.c_str()); std::regex regex("\\s*\\#define\\s+([\\w|.|-]+)\\s+(\\d+).*"); bool success = false;...
// 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 Software Foundation, with special ...
/************************************************************************************** * File Name : Particle.hpp * Project Name : Keyboard Warriors * Primary Author : JeongHak Kim * Secondary Author : * Copyright Information : * "All content 2019 DigiPen (USA) Corporation, all rights reser...
#ifndef SCOPE_GUARD_H_MYIDENTIFY_1985 #define SCOPE_GUARD_H_MYIDENTIFY_1985 #include <boost/function.hpp> #include <boost/utility.hpp> namespace threadpool { class scope_guard:private boost::noncopyable { private: boost::function0<void> const m_function; bool m_isdisable; public: ...
#pragma once #include "Game.hpp" #include "Texture.hpp" #include "Object.hpp" #include "textLoader.hpp" #include "welcomeScreen.hpp" #include "Entity.hpp" #include "botAI.hpp" Entity player; // botAI *b = new botAI[10]; vector<botAI *> b; Game::Game() { isRunning = true; rectTile.x = 0; rectTile.y = 0; ...
#include <windows.h> #include <math.h> namespace Unit { typedef int Time; typedef double PreciseTime; // typedef int Distance; // typedef double PreciseDistance; } using namespace Unit; Time const UNIT_SECOND = 60; Time _time = 0; struct Point { int x, y; Point (int x_c, int y_c): x{x_c}, y{y_c} {} Point() ...
// RsaToolbox includes #include "General.h" #include "VnaSyncGenerator.h" #include "VnaChannel.h" #include "Vna.h" using namespace RsaToolbox; // Qt includes #include <QString> VnaSyncGenerator::VnaSyncGenerator(QObject *parent) : QObject(parent) { placeholder.reset(new Vna()); _vna = placehol...
/******************************************* 所需函数的实现 ********************************************/ #include"tool.h" Person::Person() { _edirection = UP; _rPos = p_rPos = { 7,2 }; } void Person::direction(char a[][11]) { switch (_edirection) { case UP: if (a[_rPos.x][_rPos.y + 1] == '1') { if (a[_rPos.x - 1]...
#include <iostream> #include<iomanip> #include<cmath> using namespace std; int main() { double a,b,c,s,area; cout<<"تلبً"; cin>>a>>b>>c; if (a+b>c||a+c>b||b+c>a) { s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); cout<<"mianji"<<setprecision(2)<<fixed<<area<<endl;} else ...
#pragma once #include "editState.h" #include "interface/labGraphicsWindow.h" #include <map> #include <string> namespace lab { class Mode { bool _suspended = false; public: virtual ~Mode() {} virtual const char * name() const = 0; virtual void update(lab::GraphicsRootWindow&) {} virtual void activat...
// Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs // Copyright (c) 2018-2023 Conceal Network & Conceal Devs // // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php....
#pragma once #include <cmath> #include "../spacetime/linear_form.hpp" #include "../time/basis.hpp" namespace applications { using spacetime::CreateQuadratureTensorLinearForm; using spacetime::CreateZeroEvalLinearForm; using spacetime::NoOpLinearForm; using spacetime::SumTensorLinearForm; // Solution u = (1 + t^2) x...
#include "hardware.h" #include "util.h" #include <string> #include <cstdlib> #include <fstream> #include <unistd.h> #include <linux/kernel.h> #include <sys/sysinfo.h> namespace libzinlidac { // throws a `SysconfError` both if the implementation does not impose a limit, and in case of an error unsigned long get_virtua...
#include<iostream> #include<cstdio> #include<map> #include<set> #include<vector> #include<stack> #include<queue> #include<string> #include<cstring> #include<sstream> #include<algorithm> #include<cmath> using namespace std; const int N = 50010; int n,q; int tim; int num[N],siz[N],top[N],son[N]; int ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2000-2009 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** ** Yngve Pettersen ** */ #ifndef _ARG_SPLIT_H_ #define _ARG_SPLI...
#include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <ctime> #include <memory.h> #include <cmath> #include <string> #include <cstring> #include <queue> #include <vector> #include <set> #include <deque> #include <map> #include <functional> #include <numeric> #include <ss...
#include "pch.h" #include "Sequence.h" namespace Hourglass { void Sequence::AddBehavior( IBehavior* behavior ) { m_ChildBehaviors[m_NumChildren++] = behavior; } bool Sequence::IsRunningChild() const { return m_RunningChildID != s_kNoRunningChild; } void Sequence::DestroyDerived() { for (unsigned int...
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. /*============================================================================= OpenGLVertexDeclaration.cpp: OpenGL vertex declaration RHI implementation. =============================================================================*/ #include "OpenGLRHI.h...
/* * Kimura * * Copyright (c) 2009-2010 Chris Barber <chris@cb1inc.com> * All rights reserved. * * Use and distribution licensed under the BSD license. See the * COPYING file in the root project directory for full text. */ #ifndef __KIMURA_LIB_KERNEL_KERNEL_H__ #define __KIMURA_LIB_KERNEL_KERNEL_H__ #include ...
#include "../core/input/Input.h" Input::Input(GLFWwindow *window) : m_window(window) {} bool Input::isKeyPressed(int32_t keycode) { auto state = glfwGetKey(m_window, keycode); return state == GLFW_PRESS || state == GLFW_REPEAT; } glm::vec2 Input::getMousePosition() { double x, y; glfwGetCursorPos(m_w...
//两种思路做完之后都不过,然后百度一下,看看别人的做法 //这下可高兴了 K-SUM 原来是一类问题 还挺难 //而且关于这类问题也就这两种方法 hash和排序 其中去重也是很重要的一部分 //今天从早上9点起床开始做到下午5点多 努力没白费啊 //当然不足之处就是 直接电脑上开敲了 然后一些错误浪费了很多时间 //过段时间回过头来把这个解决掉. //很快又想到,不用hash了,用quicksort+binary_search //这次就在原来基础上改 很快 but //在同样的地方时间超时了 //311 / 313 test cases passed class Use_for_qu...
////////////////////////////////////////////////////////////////////////// // // pgAdmin 4 - PostgreSQL Tools // // Copyright (C) 2013 - 2017, The pgAdmin Development Team // This software is released under the PostgreSQL Licence // // WebViewWindow.cpp - Implementation of the custom web view widget // ////////////////...
// // GameController.h // Puissance 4 // // Created by Glorian on 16/04/2016. // Copyright (c) 2016 Glorian . All rights reserved. // #ifndef __Puissance_4__GameController__ #define __Puissance_4__GameController__ #include <stdio.h> #include <string.h> #include "Tableau.h" #include "MenuViews.h" #include "Player...
//wkingforACM #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define FOR(a, b, c) for(int a = b; a <= c; ++a) #define pb push_back #define double long double const int MOD = 1e9 + 7; const int oo = 1e9; const int N = 1e5 + 10; typedef pair<double, int> ii; sign...
#include <iostream> #include <cstring> using namespace std; int main() { string a; cin >> a; for (int i = 1; i <= a.size(); ++i) { if (a.size() % i == 0) { int k = 1; for (int j = i; j < a.size(); ++j) { if (a[j] != a[j % i]) ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2004-2007 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** ** Tord Akerbęk */ /** * @file ploader.h * Object administrati...
// // Utility.hpp // GA // // Created by Tom den Ottelander on 19/11/2019. // Copyright © 2019 Tom den Ottelander. All rights reserved. // #ifndef Utility_hpp #define Utility_hpp #include <stdio.h> #include <vector> #include <chrono> #include <string> #include <nlohmann/json.hpp> #include <iostream> #include <fst...
#include <iostream> #include <cstdio> #include <vector> using namespace std; int main(){ vector<double>v; int count = 0; for(int i = 0;i < 6; i++){ double x; cin >> x; v.push_back(x); } for(int i = 0; i < 6; i++){ if(v[i] > 0){ count++; } } cout << count <<" valores positivos"<< "\n"; return 0; }
#pragma once #include "MiddleCls.h" #include "MiddleClsTwo.h" // class FinalCls extends MiddleCls implements optionable // class Monster extends Character implements NonPlayer, Playable // interface class FinalCls : public MiddleCls , MiddleClsTwo { void result() { MiddleCls::function(); MiddleClsTwo::function()...
#pragma once #include "Shape.hpp" class Triangle : public Shape { protected: float Alen; //length of side A (bottom) float Blen; // length of side B (left) float Angle; //angle (degrees) between side A and B float Depth; //length along z axis public: Triangle(); Triangle(float x1, float y1, float z1, flo...
#include<iostream> #include<stdio.h> #include<bits/stdc++.h> #include<algorithm> #include<cmath> #include<string> #include<cstring> #include<vector> #include<map> #include<queue> #include<set> #include<list> #include<unordered_map> #include<unordered_set> #define ll long long #define MAX 100000003 using namespace std; ...
#ifndef OBJECT_H #define OBJECT_H #include <QGraphicsObject> #include <QPropertyAnimation> class Object : public QGraphicsObject { Q_OBJECT protected: double mass; QPropertyAnimation* posAnimation {nullptr}; QPropertyAnimation* rotationAnimation {nullptr}; QImage image; public: Object(); ...
/* * akmodel.cc * * Created on: Feb 11, 2015 * Author: robmrk */ #define POLICY_ITERATION 1 #define AMOEBA 1 #define SIMULATED_ANNEALING 0 #define POLICY_CONVERGENCE 0 #include "BaseHeader.h" #include "utilityFunctions.h" #include "matrixIO.h" #include "matrix.h" #include "amoeba.h" #include "WorldEconomy....
#include "Ball.h" #ifdef __APPLE__ #include <GLUT/glut.h> #else #include <GL/glut.h> #endif #include <math.h> #include <stdlib.h> Ball::Ball() { radius = 0.5; location = Point(0,0,0); direction = Vector(1,0,0); _rotation = 0; _color = Point(rand() * 100 % 50 / 100.0 + 0.5, rand() * 100 % ...
/* =========================================================================== Copyright (C) 2017 waYne (CAM) =========================================================================== */ #pragma once #ifndef ELYSIUM_CORE_NET_SOCKETS_TCPCLIENT #define ELYSIUM_CORE_NET_SOCKETS_TCPCLIENT #ifndef ELYSIUM_...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*- * * Copyright (C) 1995-2010 Opera Software ASA. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. */ #include "core/pch.h" #include "modul...
#ifdef DEBUG #define _GLIBCXX_DEBUG #endif #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <ctime> #include <memory.h> #include <cmath> #include <string> #include <cstring> #include <queue> #include <vector> #include <set> #include <deque> #include <map> #include <functional> #inc...
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* removeNthFr...
#include"Tortoise.hpp" #include <iostream> using namespace std; Tortoise::Tortoise() //: length(10) { // create new pointers. dynmaically allocating //position = 0; //mark = 'H'; //name = "Hare"; //pattern = new int[length]; //dynamically allocated 10-ints int defaultPattern[] = {3, 3, 3, 3, 3, -6, -6, 1, 1, 1}...
// Created on: 1993-03-10 // Created by: JCV // Copyright (c) 1993-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 GNU Lesser Gen...
/* Basic MQTT example with Authentication - connects to an MQTT server, providing username and password - publishes "hello world" to the topic "outTopic" - subscribes to the topic "inTopic" */ #include <SPI.h> #include <WiFi.h> #include <PubSubClient.h> #include <QiaqiaMqttGateway.h> // input WiFi SSID an...
// Created on: 1993-11-10 // Created by: Jean Yves LEBEY // Copyright (c) 1993-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 GN...
#include <iostream> #include <vector> using namespace std; // 10分41秒 class Solution { public: int firstMissingPositive(vector<int>& nums) { for(auto it = nums.begin(); it != nums.end(); ){ if(*it < 1){ nums.erase(it); }else{ it++; } ...
// VRHostControllerUIDlg.h : header file // #pragma once #include "afxwin.h" #include <thread> #include "afxdialogex.h" #include "VRHostController.h" #include "Util.h" #include "afxcmn.h" #define WM_MYMESSAGE (WM_USER + 100) // CVRHostControllerUIDlg dialog class CVRHostControllerUIDlg : public CDialogEx { // C...
#include<iostream> using namespace std; int math(int); int math(int a) { int n; while(n!=1) { n++; if (n%2!=0) { n = 3*n+1; } else n=n/2; } return n; } int main() { int i, j, n, m,max=0; cout << "\n Enter Start and End of set"; cin >> i >> j; for(n=i;n<=j;n++) { ...
#include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> #include <windows.h> #include <time.h> struct MonAn { char Name[25]; long long Price; }; struct LuaChon { int ChonMon; int SoLuong; }; void Gioithieu() { printf("\t======================================================================...
#include<bits/stdc++.h> using namespace std; typedef long long ll; int a[1000005]; main() { ll n; while(cin>>n) { ll i, ans = 0; for(i=0; i<n; i++) cin>>a[i]; sort(a,a+n); for(i=0; i<n; i++) ans = ans + (a[n-1]-a[i]); cout<<ans<<endl; } ...
#pragma once #include <string> #include "Personnage.hh" class Politique:public Personnage{ /* Attributs */ protected: /* Methodes */ public: Politique(); Politique(Parti val); std:: string method() const ; ~Politique(); };
#include <iostream> #include <vector> bool used[32001]; std::vector<int> pre[32001]; void Print(int idx) { if(used[idx]) { return ; } for(auto x : pre[idx]) { Print(x); } used[idx] = 1; std::cout << idx << ' '; } int main() { std::cin.sync_with_stdio(false); std:...
/**************************************************************************** * * * Author : lukasz.iwaszkiewicz@gmail.com * * ~~~~~~~~ * * Lice...
#include <memory> #include <map> #include <algorithm> #include <vector> #include "muduo/base/Thread.h" #include "muduo/base/BlockingQueue.h" #include "muduo/base/Timestamp.h" using std::placeholders::_1; class Bench { public: Bench(int numThreads) : queue_(), latch_(numThreads), threads_() { threads_.reserve(n...
#include <iostream> using namespace std; void multiply(int *a, int &n, int no) { // array 1 4 6 0 0 0 0 with number 6 int carry = 0; // iterating all over the array of size n! for ( int i=0; i<n ; i++ ) { int mul = a[i]*no + carry; a[i] = mul%10; ...
#include "DX11VertexBuffer.h" #include "DX11Utils.h" #include "DX11InputLayout.h" #include "DX11DatatypeHelper.h" #include "Renderable.h" #include "DX11RenderSystem.h" namespace HW{ DX11VertexBuffer::DX11VertexBuffer() : m_uVertexCount(0), m_uPerVertexSize(0){ m_pVertexBuffer = NULL; m_pContext = NULL; m_pInput...
/* -*-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...
#include<bits/stdc++.h> #define rep(i,n) for (int i =0; i <(n); i++) using namespace std; using ll = long long; int main(){ int N; cin >> N; vector<int>A(N); rep(i,N)cin >> A[i]; int cnt = 0; rep(i,N){ if(A[i] != i+1)cnt++; } if(cnt <= 2)cout << "YE...
// Problem No.1 => 1. Sort an array of 0’s 1’s 2’s without using extra space or sorting algorithm #include<iostream> using namespace std; void sort012(int a[], int arr_size){ int lo = 0; int hi = arr_size - 1; int mid = 0; while(mid <= hi){ switch(a[mid]){ // If the element is 0 ...
#ifndef INPUT_BUFFER_H #define INPUT_BUFFER_H #include <iostream> using std::istream; #include <string> using std::string; class InputBuffer { public: void read(istream&); const string& getBuffer() const; private: string buffer; }; #endif
// RsaToolbox includes #include "VnaSet.h" #include "Vna.h" using namespace RsaToolbox; // Qt includes // #include <Qt> VnaSet::VnaSet(QObject *parent) : QObject(parent) { placeholder.reset(new Vna()); _vna = placeholder.data(); } VnaSet::VnaSet(const VnaSet &other) : QObject(other.parent()) { ...
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- // // Copyright (C) 2003-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 WINDOWS_AUTOHANDLE_H #define WINDOWS_AUTOHANDLE_H nam...
#include<stdio.h> int main(){ printf("Hello Woorld"); \ }