text
stringlengths
8
6.88M
#pragma once #include <cassert> #include <memory> #include <utility> #include "Geometry/Public/Box.h" #include "Geometry/Public/InsertVisitor.h" #include "Geometry/Public/Node.h" #include "Math/Vec3.h" namespace Geometry { namespace Index { namespace Detail { template <size_t MaxElements> struct DefaultMinElement...
#pragma once #ifndef LINETRACE_H_ #define LINETRACE_H_ #include <opencv2/core.hpp> #define LT_FAILURE 1 #define LT_SUCCESS 0 using namespace cv; class LineTrace { public: struct Line { double m; double c; Line(double m, double c) : m(m), c(c) { } }; struct LineTraceParams { Mat src; Mat dst;...
#include <string> #include <vector> #include <queue> #include <algorithm> using namespace std; int solution(vector<int> priorities, int location) { int answer = 0; queue<int> qq; for(int i = 0; i < priorities.size(); i++){ qq.push(priorities[i]); } while(true){ if(qq.front...
// // Created by yulichao on 2020/11/9. // #include "head.h" #include "master.h" class observer2 : public notifier { public: void notify(int val) override { cout << "From master info is " << val << endl; } }; class observer1 : public notifier { public: observer1() = default; void notify(int val) override{ wh...
#include <iostream.h> #include <math.h> const double PI = 3.14159; class Point { double x,y; // 默认为私有成员 public: Point(double xx, double yy) { x = xx; y = yy; } void display() { cout<<"("<<x<<","<<y<<")"<<endl; } friend double distance(Point &a, Point &b); // 声明友元函数 friend cla...
const int DIST_SEN_PIN = A0; void setup() { pinMode(DIST_SEN_PIN, INPUT); Serial.begin(9600); } void loop() { int sen_value = analogRead(DIST_SEN_PIN); Serial.println(sen_value); delay(1000); }
/** * @file covariance.h * @brief Recovery of marginal covariance matrix. * @author Michael Kaess * @author Nicholas Carlevaris-Bianco * @version $Id: covariance.h 8578 2013-07-01 00:28:49Z kaess $ * * Copyright (C) 2009-2013 Massachusetts Institute of Technology. * Michael Kaess, Hordur Johannsson, David Rosen...
/*********************************************************************** created: Tue Feb 17 2009 author: Paul D Turner, Henri I Hyyryläinen *************************************************************************/ /*************************************************************************** * Copyrig...
#include "HelperFunctions.h" #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) // The windows header defines a max macro that conflicts with numeric_limits::max, so it must be disabled #define NOMINMAX #include <windows.h> #endif #include <iostream> #include <cstdlib> #include <string> #include <cctype> #in...
class Solution { public: vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k) { auto cmp = [](vector<int> &a, vector<int> &b){ return a[0] + a[1] < b[0] +b[1]; // maxHeap }; priority_queue<vector<int>, vector<vector<int>>, decltype(cmp)> q(cmp); ...
// void HeapSort(ElemType A[],int len) { BuildMaxHeap(A,len); for(i=len;i>1;i--) { swap(A[i],A[1]); AdjustDown(A,1,i-1); } }
//MouseMove.cpp #include "MouseMove.h" #include "Form.h" #include "MemoForm.h" #include "Pageform.h" MouseMove::MouseMove(Form *form) :MouseAction(static_cast<MemoForm*>(form)){ } MouseMove::MouseMove(const MouseMove& source) :MouseAction(source){ } MouseMove::~MouseMove() { } MouseMove& MouseMove::operator=(c...
#include <iostream> #include <string> #include <map> #include <fstream> using namespace std; string a; map<string, int> mp; bool isAlf(int index) { if(a[index] >= 'a' && a[index] <= 'z') return true; if(a[index] >= 'A' && a[index] <= 'Z') { a[index] = 'a' + (a[index] - 'A'); return true; } if(a[index] >= '...
#include "stdafx.h" #include <sstream> #include <string> #include <iostream> #include "Mesh.h" using namespace std; Mesh::Mesh() { maxFaceOrder = 0; minVertexValence = 1e+10; maxVertexValence = 0; } VertexNode::VertexNode(string source) { string temp(""); int i = 0; for (int j = 0; j<source.length(); j+...
#include <iostream> #include<cmath> using namespace std; int main() { // your code goes here int tc; cin>>tc; while(tc--) { string str; cin>>str; unsigned int sum=0; for(int i=0,j=str.length()-1;i<j;i++,j--) { sum+=abs(str[i]-str[j]); } cout<<sum<<endl; } return 0; }
/* * SPDX-FileCopyrightText: 2008 Till Harbaum <till@harbaum.org> * * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once #include "map_hl.h" #include "map_state.h" #include "osm.h" #include "osm_objects.h" #include "pos.h" #include "track.h" #include <string> #include <memory> #include <unordered_map> #i...
#include <bits/stdc++.h> #define ll long long #define MOD 1000000007; #define INF 1e18 using namespace std; int main() { ll n; cin >> n; vector<array<ll, 3>> arr(n); for(ll i = 0; i < n; i++){ ll a, b, p; cin >> a >> b >> p; arr[i][0] = a; arr[i][1] = b; arr[i][2] = p; } ll ans = 0; for(ll i = 0; i < n; ...
#include "arete.h" #include "sommet.h" #include <iostream> #include <iomanip> #include <sstream> #include <math.h> #include "conf.h" Arete::Arete(int id, Sommet* s1, Sommet* s2) : m_id(id), m_sommet1(s1), m_sommet2(s2), m_marque(false) /*,m_poidsCoords(sqrt(pow(s1->getCoord().getX()-s2->getCoord().getX(),2)+(pow(...
// // Copyright (c) 2003--2009 // Toon Knapen, Karl Meerbergen, Kresimir Fresl, // Thomas Klimpel and Rutger ter Borg // // 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) // // THIS FILE IS AUTOMATICALLY GENERATED ...
#pragma once namespace EngineLayer { namespace HistogramAnalysis { class OkBin { public: double MassShift = 0; double Sigma = 0; int P = 0; OkBin(double massShift, double sigma, int p); }; } }
#include <bits/stdc++.h> #include "../crio/cpp/io/FastIO.hpp" #include "../crio/cpp/io/ReadMatrix.hpp" #include "../crio/cpp/io/PrintMatrix.hpp" using namespace std; class TwoSum { public: // Implement your solution by completing the below function vector<int> twoSum(vector<int>& nums, int target) { v...
#include <FastLED.h> #include <SPI.h> #include <Ethernet.h> #define L_LED_PIN 7 #define R_LED_PIN 8 #define NUM_LEDS 16 CRGB leftleds[NUM_LEDS]; CRGB rightleds[NUM_LEDS]; EthernetClient client; byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte ip[] = { 132, 181, 60, 147 }; byte server[] = { 64, 233...
#include <cstdio> #include <iostream> using namespace std; typedef long long ll; const int MAXN = 1005, MAXH = 20005, MOD = 998244353; // dp[i][j]表示以i为结尾、公差为j的方案数 int n, h[MAXN], maxh = 0, dp[MAXN][MAXH * 2] = { 0 }, ans = 0; // #define DEBUG int main() { #ifdef DEBUG freopen("d:\\.in", "r", stdin); freopen("...
#include<iostream> #include<algorithm> using namespace std; int main() { long int amt,n; cin>>amt; cin>>n; long int coin[n+1]; long int arr[amt][n+1]; coin[0]=0; for(long int i=1;i<=n;i++) cin>>coin[i]; sort(coin,coin+n+1); for(long int i=0;i<amt;i++) arr[i][0]=0; for(long int i=0;i<amt;i++...
#ifndef SCENEGRAPH_H #define SCENEGRAPH_H #ifdef __APPLE__ #define GLFW_INCLUDE_GLCOREARB #include <OpenGL/gl3.h> #else #include <GL/glew.h> #endif #include <GLFW/glfw3.h> #include <glm/gtc/type_ptr.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/glm.hpp> #include <vector> #include <string> #include <iost...
#include <iostream> using namespace std; #ifndef _COMPLEX0_ #define _COMPLEX0_ class complex { private: double real; double imaginary; public: complex(double r, double i); complex(); friend complex operator~(const complex &c); complex operator+(const complex &c) const; complex operator-(const complex &...
#include<bits/stdc++.h> using namespace std; bool isPalindrome(string s,int i,int j) { while(i<j) { if(s[i]!=s[j]) { return false; } i++; j--; } return true; } int solve(string s,int i,int j) { if(i==j) { return 0; } if(i+1==j) { if(s[i]==s[j]) { return 0; } return 1; } if(isP...
#include <iostream> #include <cmath> using namespace std; class Point { public: Point(int xx,int yy) { X=xx; Y=yy; } // 构造函数 Point(Point &p); int GetX(void) { return X; } // 取X坐标 int GetY(void) { return Y; } // 取Y坐标 private: int X,Y; //点的坐标 }; Point::Point(Point &p) { ...
#include "stdafx.h" #include "base/nextai_time.h" #include "spdlog/sinks/stdout_color_sinks.h" #include "spdlog/sinks/basic_file_sink.h" #define SPDLOG_PATTERN "[%H:%M:%S][%^%L%$][%t]%v" namespace NextAI { Logger::Logger(const char* logName, const char* fileName) { m_logger = NULL; auto console_s...
#include "MissionImpossible/MissionImpossible.hpp" using namespace MissionImpossible; template <typename T> T my_function(const AD_Underlying_Type_t<T> scalar_constant, const T x) { return scalar_constant * x * x; } int main() { AD<AD<double>> x = 2, y; y = my_function(10, x); auto dy = Jacobian_row(y); ...
#include "testApp.h" //-------------------------------------------------------------- void testApp::setup() { ofSetLogLevel(OF_LOG_VERBOSE); // enable depth->video image calibration kinect.setRegistration(true); kinect.init(); //kinect.init(true); // shows infrared instead of RGB video image //kinect.init(fal...
/* * Copyright 2016-2017 Flatiron Institute, Simons Foundation * * 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 ...
#include<iostream> using namespace std; int main(){ int no; int binary[20] = {0}; int temp; cout<<"Enter a decimal Number : "; cin>>no; int i = 0; while(no>0){ temp = no%2; no=no/2; binary[i] = temp; i++; } cout<<"Binary number : "; int n = 20; while(binary[n] != 1){ n--; ...
/***************************************************************************** GIF construction tools ****************************************************************************/ #include "stdafx.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include "gif_lib.h" #define MAX(x, y) (((x) > (y)) ?...
#include<iostream> using namespace std; int main() { int n; cin>>n; int a[1000]; for(int i=0;i<n;i++) { cin>>a[i]; } //Bubble sort for(int itr=0;itr<=n-2;itr++) { for(int i=0;i<=n-2-itr;i++) { if(a[i+1]<a[i]) { swap(a[i+1],a[i]); } } } for(int i=0;i<n;i++) { cout<<a[i...
#include<iostream> using namespace std; void selection_sort(int arr[], int size){ // Variable to store the index of minimum value in a list int minimum_index; for(int i=0; i<size-1; i++){ // Assuing i to be minimum index initially minimum_index=i; // Finding minimum index in the sub list for(int ...
/* * Copyright (c) 2015 Isode Limited. * All rights reserved. * See the LICENSE file for more information. */ #include "WebSocket.h" #include <memory> #include <string> #include "Cookies.h" namespace librestpp { WebSocket::WebSocket() { } void WebSocket::handleMessage(const std::string& message) { std::share...
#include <iostream> #include <string> using namespace std; int main() { wstring s; wcin >> s; wcout << s << endl; return 0; }
#include<bits/stdc++.h> using namespace std; bool valid(vector<int>&positions, int row, int col){ for(int i = 0; i < row; i ++){ if(positions[i] == col) return false; if(abs(row - i) == abs(col - positions[i])) return false; } return true; } void solve(vector<string>&board, int &ans, int cur...
#include <utils/utils_io.h> namespace lab3 { namespace utils_io { void print_newline(const std::string &s) { std::cout << "\r" << s << std::endl; } void clearScreen() { system("clear"); } void wait_for_enter() { lab3::utils_io::print_newline("\nPress Enter to continue..."); getchar(); } } }
// // PartyVideoDJ - YouTube crossfading app // Copyright (C) 2008-2017 Michael Fink // /// \file WebPageWindowEx.hpp Extended web page window // #pragma once #pragma once #include <vector> #include "WebPageWindow.hpp" template <typename T, typename TIDocHostUIHandlerDispatchImpl> class WebPageWindowEx : public WebP...
// =========================================== // // Checks how many events have hits NH // Checks total number of events per file NE // SRC_RATIO = NH/NE // version 1.0 // 20/10/2014 // // Author: G. A. Valdiviesso // // =========================================== void CalcRatio( TString inFile="") { // if (inFil...
#pragma once //HTTP服务器类 #include <winsock2.h> #pragma comment(lib, "Ws2_32.lib") #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <ws2tcpip.h> #include <thread> #include <filesystem> #include "HttpRequest.h" class HttpServer { private: const u_short DEFAULTPORT = 8090; //默认端口 u_short port; ...
//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2006-2010 MStar Semiconductor, Inc. // All rights reserved. // // Unless otherwise stipulated in writing, any and all information contained // herein regardless in any format shall remain the sole proprietary of ...
#include <gtest/gtest.h> #include <string> #include <sstream> #include "kattistime.h" #include "calendar.h" #include "gregorian.h" using ::testing::TestWithParam; using ::testing::Values; using std::get; using lab2::Calendar; using lab2::Gregorian; using std::string; typedef lab2::Calendar<Gregorian>::RecurringEvent ...
#include<iostream> #include<algorithm> #include<string.h> using namespace std; int main() { string s; long long int t,i,count = 0,l; cin>>t; while(t--) { cin>>s; l = s.length(); sort(s.begin(),s.end()); for(i = 0;i < l;++i) { //cout<<s[i]<<endl; ...
#include "EntityManager.h" Entity& EntityManager::getEntity(std::string name) { return entities[name]; } void EntityManager::addEntity(std::string name, Entity entity) { entities[name] = entity; } std::vector<Position> EntityManager::blockedPositions() { std::vector<Position> obsVec; for (EntityMapIter iter = e...
// Copyright (c) Facebook, Inc. and its affiliates. // All rights reserved. // // Copyright 2019 Google LLC // // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. // // Auto-generated file. Do not edit! // Specification: test/f32-dwconv.y...
/*! * Modifications Copyright 2017-2018 H2O.ai, Inc. */ #ifndef MATRIX_MATRIX_H_ #define MATRIX_MATRIX_H_ #include <memory> namespace h2o4gpu { template <typename T> class Matrix { protected: const size_t _m, _n, _mvalid; void *_info, *_infoy, *_vinfo, *_vinfoy, *_weightinfo; bool _done_init, _done_alloc,...
#include<iostream> #include<vector> #include<utility> #define INFTY 10101010101010101 using namespace std; typedef long long nat; typedef pair<int, int> pii; typedef pair<nat, int> pni; typedef pair<nat, pair<int, int> > pnii; class FloydWarshall{ // 負閉路をもたない有向グラフの最短路を求めるアルゴリズム public: vector<pnii> ...
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { int temp = 0; struct ListNode *templist1 = l1, *templist2 = l2; if(...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { string a; cin>>a; stack<char> s; for(int i=0; i<a.length(); i++) { if(a[i]==')') { cout<<s.top(); s.pop(); s.pop(); } else if(a[i]>='a' && a[i]<='z') cout<<a[i]; else s.push(a[i]); } cou...
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. Redistribution and use in source and binary forms...
#include <math.h> #define CDS 0 //A0ピンとCdSを接続する #define LED 9 //9ピンとLEDと接続する #define DUTY_MAX 255 //duty比の最大値 #define DUTY_MIN 1 //duty比の最小値 #define MAXVALUE 953.0 //A0に入力されるアナログ値の最大値 #define MINVALUE 172.0 //A0に入力されるアナログ値の最小値 //この値以上になったらLEDを光らせる #define BRIGHT_LIMIT (float)(MAXVALUE - MINVALUE) * 0.75 + (float)MINVA...
#ifndef FLOW_GRAPH_AGGREGATENODE_HPP #define FLOW_GRAPH_AGGREGATENODE_HPP #include <memory> #include "graph/unary_node.hpp" namespace flow { class AggregateNode; using AggregateNodePtr = std::shared_ptr<AggregateNode>; enum class AggregateType { SUM, MIN, MAX, }; class AggregateNode : public UnaryNode { pu...
#include <iostream> #include <vector> using namespace std; class Solution { public: int firstMissingPositive(vector<int>& nums) { for (int i = 0; i < nums.size(); i++) { while (nums[i] > 0 && nums[i] <= nums.size() && nums[nums[i] - 1] != nums[i]) { swap(nums[i], nums[nums[i] - 1]); } } for (...
#include<bits/stdc++.h> using namespace std; //Time complexity // Enque(insertion) O(1) // Deque(deletion) O(1) // Front(Get front) O(1) // Rear(Get Rear) O(1) struct Queue { int capacity; int size; int rear; int front; int* arr; }; typedef struct Queue Queue; Queue*...
#include "pch.h" #include "Object3D.h" Object3D::Object3D() { m_material = NULL; } Object3D::Object3D(Material * material) { m_material = material; } Object3D::~Object3D() { }
// // Compiler/AST/Class.h // // Brian T. Kelley <brian@briantkelley.com> // Copyright (c) 2007, 2008, 2011, 2012, 2014 Brian T. Kelley // // Chris Leahy <leahycm@gmail.com> // Copyright (c) 2007 Chris Leahy // // This software is licensed as described in the file LICENSE, which you should have received as part of this...
#define BLYNK_PRINT Serial #include <WiFi.h> #include <WiFiClient.h> #include <BlynkSimpleEsp32.h> #include <OneWire.h> #include <DallasTemperature.h> #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include <Adafruit_NeoPixel.h> volatile byte state = LOW; char auth[] = ""...
# include <iostream> // Entrada e saída de dados # include <cstring> // memset using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // Deixar a entrada e saída mais rápidas // variáveis int t, n, v, a, v1, v2; bool adj_mat[55][55]; cin >> t; // Recebe a...
#ifndef BASE_H #define BASE_H #include <vector> #include <fstream> #include <sstream> #include "Address.h" #include "People.h" #include "Restaurant.h" #include <fstream> using namespace std; class Base { private: string district; Address address; string admin_name; //esta aldrabado, preciso pensar em melhor al...
#ifndef STRSTRWORKER_H #define STRSTRWORKER_H #include "hashtable.h" class StrStrWorker { public: StrStrWorker(); QString getFromFile(QString fileName); QString createHashTable(QString input); QString deleteElem(QString input); void saveStrToFile(QString output, QString fileName); pri...
#include <iostream> #include<vector> #include <algorithm> #include <string> using namespace std; /* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } }; */ /* dummy是构造的节点,p代表上一个保留的节点 cur代表当前需要删除节点所具有的值 这个代码写的不是很优雅 2018.8.23 */ class Solution { public: ...
// (c) 2005-2006 Marc-Antoine Ruel // // "Magical" code that helps to easily remap any key #pragma once #include "Term.h" // Those key are grabbed a key up only. inline bool IsDeadKey(int VKey) { switch (VKey) { case VK_SNAPSHOT: // This one because only WM_KEYUP is sent, not WM_KEYDOWN... :( becaus...
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. Redistribution and use in source and binary forms...
#include <iostream> /*Author: Tomas*/ using namespace std; class MarketSummary { public: double open, high, low, mkt_cap, pe_ratio; string symbol; }; const int ERROR = 1; const int SUCCESS = 0; int main() { MarketSummary market_summary; market_summary.open = 1204.09; market_summary.high = 1208.45; market_summa...
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ ListNode* Solution::reverseBetween(ListNode* A, int B, int C) { ListNode* st=NULL, *en=NULL, *temp=NULL; ListNode* ans=A; int count=1; ListNode* ...
/* ***************************************************************************** * ___ _ _ _ _ * / _ \ __ _| |_| |__(_) |_ ___ * | (_) / _` | / / '_ \ | _(_-< * \___/\__,_|_\_\_.__/_|\__/__/ * Copyright ...
#include <iostream> using namespace std; int& g2(void) { static int a = 10; a++; printf("a:%d \n", a); return a; } int main(void) { g2() = 100; //函数返回值是一个引用,当左值。 g2(); system("pause"); return 0; } /* a:11 a:101 */ #if 0 #include <iostream> using namespace std;...
/********************************************************** * License: The MIT License * https://www.github.com/doc97/TxtAdv/blob/master/LICENSE **********************************************************/ #pragma once #include <bitset> #include <string> #include <vector> namespace txt { /* Enum: Emphasis * Bit mas...
///////////////////////////////////////////////////////////////////////////// // Name: src/osx/button_osx.cpp // Purpose: wxButton // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 // RCS-ID: $Id: button.cpp 54845 2008-07-30 14:52:41Z SC $ // Copyright: (c) Stefan Csomor // Lice...
//delacracion de librerias #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #include <Ultrasonic.h> //Declaremos los pines CE y el CSN //float Kp=16,Ki=4.99,Kd=7.5; //kp correcion proporcional del error k1 contador de errores acumulaTICO KD corrigen oscilacion float Kp=27,Ki=0.000000,Kd=2.5; //float Kp=33...
#include <Arduino.h> // Get user input while letting the menu take care of display updates etc. bool getInput(int &inputValue, HardwareSerial serialInterface) { bool gotSome = false; // Process input - waiting for the terminator (enter key) if (serialInterface.available() > 0) { while (serialInterface.availa...
// practice1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include "pch.h" #include <iostream> #include <Windows.h> #include <process.h> #include <time.h> using namespace std; #define N 10 #define producer_size 3 #define consumer_size 2 HANDLE producer_thread[producer_size]; HANDLE consumer_thread[consumer_size]; //线程ID ...
// // Created by WiktorW on 3/10/2018. // #include "Polybius.h" std::string PolybiusCrypt(std::string message) { std::string result; int tmp; for(char& i : message) { //A-E if((i>=65) &&(i<=69)) { tmp = i - 54; result.append(std::to_string(tmp)); ...
#pragma once #include <string> #include <memory> #include "platform.h" class CppStrategy { // use std::unique_ptr to store handle in order to make CppStrategy move-only static void close_fn(void *handle); std::unique_ptr<void, decltype(&close_fn)> handle = {nullptr, close_fn}; using OnEvent = void (...
//Use same bit of code for different data types #include <iostream> using namespace std; /* template <class T> void output(const T &n){ cout << n<< endl; } */ //using template function //swap using template template <class T> void mySwap(T &a,T &b){ T temp = a; a =b; b =temp; } //using template cla...
/** * Author: rodrigo * 2015 */ #pragma once #include <string> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/nonfree/features2d.hpp> #include <opencv2/nonfree/nonfree.hpp> using namespace std; using namespace cv; class Codebo...
#include <algorithm> #include <array> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <vector> #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 = 1e...
#include "AnimatedSprite.h" #include <fstream> #include <vector> #include <string> #include <iostream> // Загружает файл в строку. // NOTE: функция не сможет корректно обработать Unicode-пути на Windows static std::string loadFileToUtf8String(const std::string& filepath) { std::ifstream input(filepath); if (!...
#include"stdio.h" #include"stdlib.h" #include"string.h" #define MAXSIZE 100 typedef struct linknode { char data; struct linknode *next; }node; node *strcreate(node *s) { char ch; node *p,*r; s=NULL;r=NULL; while((ch=getchar())!='\n') { p=(node*)malloc(sizeof(node)); ...
/** https://www.hackerrank.com/challenges/dijkstrashortreach **/ #include<bits/stdc++.h> using namespace std; # define INF 0x3f3f3f3f typedef pair<int, int> ii; int main(){ int t; cin >> t; for(int a0 = 0; a0 < t; a0++){ int n; int m; cin >> n >> m; vector<ii> g[n]; //nod...
// // GA-SDK-CPP // Copyright 2015 GameAnalytics. All rights reserved. // #include <gtest/gtest.h> #include <gmock/gmock.h> #include <string> #include <vector> #include <GAUtilities.h> #include <random> // test helpers #include "helpers/GATestHelpers.h" TEST(GAUtilities, testHmacWithKey) { ASSERT_STREQ(gameanal...
#include "cpu_info.h" #ifdef _MSC_VER #include <intrin.h> #endif #include <vector> #include <array> #include <cstring> #include <bitset> using std::array; using std::vector; using std::string; using std::bitset; // This code mostly bases on https://docs.microsoft.com/en-us/cpp/intrinsics/cpuid-cpuidex?view=vs-2017 /...
#ifndef SensitiveDetector_add_hh_ #define SensitiveDetector_add_hh_ #include "G4VSensitiveDetector.hh" #include "G4Step.hh" #include "G4RunManager.hh" #include "G4SystemOfUnits.hh" #include <string.h> #include <iostream> #include <iomanip> #include <sstream> #include <time.h> #include <stdio.h> using namespace std; ...
#include <iostream> using namespace std; #include "opencv2/opencv.hpp" using namespace cv; #include <opencv2\core\cuda.hpp> #include <opencv2\cuda\cudaimgproc.hpp> using namespace cuda; #define GPU int main() { int n = 10000; #ifdef GPU int num_devices = getCudaEnabledDeviceCount(); cout << "可使用的设备个数为:" << num...
/** * Class SoundController * @author Patricio Ferreira <3dimentionar@gmail.com> * Copyright (c) 2017 nahuelio. All rights reserved. **/ #include "headers/SoundController.h" using namespace game_controller; /** Constructors **/ SoundController::SoundController() {}; /** Members **/ SoundController *SoundContro...
#include "collision\Singularity.Collision.h" using namespace Singularity; using namespace Singularity::Components; namespace Singularity { namespace Collision { struct CollisionInfo { Collider* Actor; Singularity::Transformation Transform; Singularity::Components::GameObject...
// // Copyright Jason Rice 2016 // 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 NBDL_DEF_BUILDER_MAKE_MESSAGE_API_HPP #define NBDL_DEF_BUILDER_MAKE_MESSAGE_API_HPP #include <nbdl/concept/UpstreamMessa...
#include "Hashtable.h" #include <cstdlib> #include <iostream> #include <cassert> using namespace std; Hashtable::Hashtable(int size) { //constructor int prime = nextPrime( size ); _size = size; if (prime != size) { cout << "Warning: size = " << size << " is not a prime number." << endl; /* uncomment these...
// // Copyright (c) 2003--2009 // Toon Knapen, Karl Meerbergen, Kresimir Fresl, // Thomas Klimpel and Rutger ter Borg // // 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) // // THIS FILE IS AUTOMATICALLY GENERATED ...
#ifndef VAL_H #define VAL_H #define WELLCOME "wellcome to the os-sensor" #define PATH "./databases" #define FIFO_PATH "./fifo" #define FIFO_WRITE 0666 <<<<<<< HEAD #define LEN 1000 #define TIME 20000 ======= #define LEN 100 >>>>>>> parent of 6e6512b... error is fucked and project id completedgit add --all #define S...
#include "subsystems/Pivot.h" #include "commands/pivot/AjusterPivot.h" Pivot::Pivot() : PIDSubsystem("Pivot", 0.015, 0.0, 0.0) { m_vitessePrecedente = 0.0; // Ratio pour convertir les ticks de l'encodeur en degrés m_encodeur.SetPosition(0.0); m_encodeur.SetPositionConversionFactor(m_angleParTick); // Affic...
#ifdef FASTCG_OPENGL #include <FastCG/Graphics/OpenGL/OpenGLUtils.h> #include <FastCG/Graphics/OpenGL/OpenGLGraphicsContext.h> #include <FastCG/Graphics/OpenGL/OpenGLGraphicsSystem.h> #include <FastCG/Graphics/OpenGL/OpenGLExceptions.h> #include <FastCG/Core/Exception.h> #include <vector> #include <cassert> #include ...
#include "reduction_space_a.h" #include "gtest/gtest.h" using namespace std; class ReductionSpaceSum : public AReductionSpaceBase<ReductionSpaceSum, float>{ public: const int kMyLocalCount = 5; int *my_local = nullptr; ReductionSpaceSum() : AReductionSpaceBase(1, 1) { my_local = new int[kMyLoca...
#include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <sys/errno.h> #include <unistd.h> #include <stdlib.h> #include <string.h> extern "C" off_t fd_get_file_size(int fd) { struct stat statInfo; fstat(fd, &statInfo); return statInfo.st_size; } #if 0 // test to be certain that LW understan...
#ifndef QGRAPHICSSCENESIZED_H #define QGRAPHICSSCENESIZED_H #include <QGraphicsView> #include <QGraphicsScene> class QGraphicsSceneSized : public QGraphicsScene { public: // constructor QGraphicsSceneSized(QGraphicsView *parent); }; #endif // QGRAPHICSSCENESIZED_H
class Solution { public: int maxProfit(vector<int>& prices) { int n = prices.size(); if(n <= 1) return 0; int result = 0; int min_num = prices[0]; for(int i = 1; i < n; i++) { if(prices[i] < min_num) { min_num = prices[i]; ...
#include <cstddef> #include<iostream> #include <boost/numeric/ublas/vector.hpp> #include<boost/numeric/ublas/io.hpp> #include <boost/numeric/ublas/vector_expression.hpp> #include<boost/shared_ptr.hpp> using namespace boost::numeric::ublas; using namespace boost; /*В данном hpp файле реализован класс массивов Array с...