text stringlengths 8 6.88M |
|---|
#ifndef PROCESS_H
#define PROCESS_H
#include "Logger.h"
#include "Exceptions.h"
#include <Windows.h>
#include <thread>
#include <mutex>
#include <string>
enum PROCESS_STATUS{ ACTIVE, RESTARTING, SUSPENDED, STOPPED };
const DWORD STOP_VIA_METHOD_CALL = 0x4D5A;
class Process
{
public:
/**
The consructor accepts 2 co... |
class Solution {
public:
vector<int> findOrder(int numCourses, vector<vector<int>>& prerequisites) {
vector<int> degree(numCourses,0);
vector<vector<int>> graph(numCourses);
for(auto prerequisit:prerequisites)
{
degree[prerequisit[0]] += 1;
graph[prerequisit[1... |
/*-----------------------------------------------------------
vars.h -- SwmmToGrms程序中全局常量、宏函数、变量和数据结构。
-------------------------------------------------------------*/
/*--- 头文件 ------------------------------------------------*/
#pragma once
#include<vector>
#include<string>
/*--- 命名空间 -------------... |
#include "PlaylistElementGUI.h"
/*
track->setText("MOUSE RELEASE EVEEEEEENT!");
this->adjustSize();
this->resize(this->sizeHint());
*/
PlaylistElementGUI::PlaylistElementGUI(QWidget* parent) : QWidget(parent) {
cover = new QLabel(parent = this);
track = new QLabel(parent = this);
artist = new QLabel(parent = t... |
#include<bits/stdc++.h>
using namespace std;
float corrCoeff(int X[], int Y[], int N)
{
int sumX = 0, sumY = 0, sumXY = 0, squareSumX = 0, squareSumY = 0;
float corrcoe;
for (int i = 0; i < N; i++)
{
sumX = sumX + X[i];
sumY = sumY + Y[i];
sumXY = sumXY + X[i] * Y[i]; ... |
#pragma once
#include "cocos2d.h"
#include "ui/UIWidget.h"
using namespace cocos2d::ui;
class StartScene : public cocos2d::Layer
{
public:
static cocos2d::Scene* createScene();
virtual bool init();
// my maze button callback
void TouchMyMaze(Ref *pSender, Widget::TouchEventType type);
// friends' maze button ... |
int len = 0;
int tempSet = 20;
int voltRead = 0;
float tempRead = 0.0;
char buff[4] = "000";
char temp[3] = "00";
void setup() {
pinMode(11, OUTPUT); //Lock PWM pin
pinMode(7, OUTPUT); //Relay0 digital pin
pinMode(8, OUTPUT); //Relay1 digital pin
pinMode(A0, INPUT); //Thermistor analog pin
Serial.begin(96... |
int avada_Cedavra()
{
return 0;
}
class MyClass
{
public: MyClass() {}
};
class Badly_named_checks_One_time_error {};
Badly_named_checks_One_time_error z;
typedef a MyClass;
int main()
{
int I = 0;
i, j = 6;
return 0;
... |
#pragma once
#include "Node.h"
#include <iostream>
#include <cstdlib>
using namespace std;
class Queue
{
private:
//member variables
Node *head, *tail;
int capacity;
int size;
public:
//constructor and destructor
Queue(int capacity = 5);
~Queue();
//funcs
int getMin();
void enqueue(int value);
int dequeu... |
#include "food.h"
vector<pair<int, int>> nibbles;
pair<int, int> make_food() {
return make_pair(experimental::randint(1, LINES-2), experimental::randint(1, COLS-2));
}
void paint_food() {
attron(COLOR_PAIR(FOOD_COLOR_PAIR));
for(int i = 0; i < nibbles.size(); i++) {
move(nibbles[i].first, nibbles[i].second);
... |
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <sys/time.h>
#include <time.h>
#include "globals.h"
static struct timeval timezero;
void warning(const char* message, ...)
{
va_list ap;
va_start(ap, message);
fprintf(stderr, "dbztool: ");
vfprintf(stderr, message, ap);
fpr... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Histogram is an object that aggregates statistics, and can summarize them in
// various forms, including ASCII graphical, HTML, and numerically (as... |
#include <bits/stdc++.h>
using namespace std;
int findKey(int arr[], int key, int start, int end)
{
if (start > end)
{
return -1;
}
int mid = (start + end) / 2;
if (key == arr[mid])
{
return mid;
}
if (arr[start] < arr[mid])
{
if (key > arr[start] && key ... |
/* Copyright 2017 Istio 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 required by applicab... |
#include <iostream>
using namespace std;
/**
* Leia uma quantidade indeterminada de duplas de valores inteiros X e Y.
* Escreva para cada dupla uma mensagem que indique de estes valores foram
* digitados em ordem crescente ou decrescente.
* A leitura deve ser encerrada ao ser fornecidos valores iguais para X e ... |
#include "stdafx.h"
#include "scan.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// 将全部点旋转指定的姿态。
//
void CScan::RotatePos(float angle, float mx, float my)
{
if (angle != 0.0)
{
float sina = sin(angle);
float cosa = cos(angle);
CScanPoint *sp = m_pPoin... |
#include <iostream>
using namespace std;
int large_number = 1000;
void printStuff(int, int);
void printStuff(int);
int num = 0;
int main() {
char stay = 'c';
for (int i=0 ; i< 10; i++) {
large_number = large_number + 1;
printStuff(i, large_number);
printStuff(i);
}
cin >> stay;
return 0;
}
void printStu... |
#include <iostream>
using namespace std;
class TrieNode{
public:
char data;
TrieNode **children;
bool isTerminal;
TrieNode(char data){
this->data = data;
children = new TrieNode*[26];
for(int i=0; i<26; i++){
children[i] = NULL;
}
isTerminal = fa... |
#include <vector>
using namespace std;
class Solution {
public:
void setZeroes(vector<vector<int> > &matrix) {
int first = -1;
for(size_t i = 0;i < matrix.size() && first < 0;++i){
for(size_t j = 0;j < matrix[i].size();++j)
if(!matrix[i][j]){
first =... |
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
struct nodo{
int bl;
char name[20];
char sex;
float tamu;
struct nodo *ptrSig, *ptrs;
int error=-1;
}Nodaso, *ptrCab;
struct nodo * crearNodo ( int bl2, float tamu2, char namer[20],char sex2){
... |
/* json.h -*- C++ -*-
Rémi Attab (remi.attab@gmail.com), 12 Apr 2015
FreeBSD-style copyright and disclaimer apply
*/
#pragma once
#include <istream>
#include <ostream>
#include <sstream>
#include "reflect.h"
namespace reflect {
namespace json {
struct Reader;
} // namespace j... |
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
//公众号:一航代码
int main()
{
string a, b;
cin >> a >> b;
int maxlen = 0, index = 0;
vector<vector<int>> c(a.size() + 1, vector<int>(b.size() + 1, 0));
for (int i = 1; i <= (int)a.size(); i+... |
/***************************************************************************
proyecto.h - description
-------------------
begin : vie abr 25 2003
copyright : (C) 2003 by Oscar G. Duarte V.
email : ogduarte@ing.... |
#pragma once
#include "TGrid.h"
#include "CHandler.h"
#include "MessageQueue.h"
#include "CUserInput.h"
#include <fstream>
#include <set>
#include <list>
class CGraphics;
struct SBuilding
{
Vec3d pos;
double w;
double h;
double rotate;
double height;
bool operator<(const SBuilding& s) const
{
int a = *... |
#ifndef UNIFORMGL_H
#define UNIFORMGL_H
#include "Types.h"
#include "math/Vector2.h"
#include "math/Vector3.h"
#include "math/Vector4.h"
#include "math/Matrix3x3.h"
#include "math/Matrix4x4.h"
#include "renderer/Uniform.h"
#include <GL/glew.h>
#include "Log.h"
#include <memory>
namespace revel
{
namespace renderer
{... |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Random.h"
#include "kernel.h"
#include "constants.h"
void print_banner(void);
int main(int argc, char *argv[])
{
/* default to the (small) cache-contained version */
double min_time = RESOLUTION_DEFAULT;
int FFT_size = FFT... |
#ifndef OBJECTFACTORY_H
#define OBJECTFACTORY_H
class Object;
class ObjectFactory{
public:
virtual std::unique_ptr<Object> create() = 0;
};
#endif |
// This file has been generated by Py++.
#include "boost/python.hpp"
#include "generators/include/python_CEGUIOpenGLRenderer.h"
#include "OpenGL3Renderer.pypp.hpp"
#include "OpenGL3Shader.pypp.hpp"
#include "OpenGL3StateChangeWrapper.pypp.hpp"
#include "OpenGLGeometryBufferBase.pypp.hpp"
#include "OpenGLRenderer... |
//タイミングゲージ
#include "GV.h"
#define PI 3.14
static int font;//フォント用
static char *fonttype;//フォントタイプ
static double x = 0, y = 0;
static double z = 0;
static int flag = 0;
static int count = 0;
static char timing_char[64];
static int background;//画像用
int timig_decide(); //タイミング決定
//ゲーム処理ループ
void timing_update()... |
#include<iostream>
#include<stack>
#include <algorithm>
using namespace std;
void swp(int *l,int n)
{
for(int i=0;i<n/2;i++)
swap(l[i],l[n-i-1]);
}
int main()
{
int l[10];
for(int k=0;k<10;k++)
l[k]=k;
for(int k=0;k<10;k++)
printf("%d ",l[k]);
printf("\nµ¹ÖÃ\n");
swp(l,sizeof(l)/sizeof(int));
... |
class Solution {
private:
vector<vector<int>> result;
vector<int> path;
void backtracking(vector<int>& candidates,int target,int sum,int index,vector<bool>& used){
if(sum==target){ // 目标
result.push_back(path);
return;
}
for(int i=index;i<candidates.s... |
#ifndef LIVINGROOM_H
#define LIVINGROOM_H
#include "room.h"
class LivingRoom: public Room
{
public:
LivingRoom(std::string name);
void addComponent(std::string componentName);
void turnOffComponent(std::string componentName);
void turnOffComponents();
void turnOnComponent(std::string componentName)... |
int xPin = A1; //Joystick Pins for inputs
int yPin = A0;
int buttonPin = 0;
int xPosition = 0;
int yPosition = 0;
int buttonState = 0;
int Layer_1 = A2; //A2 //Voltage Layers for the cathode parts. We'll use analog so we can reserve digital ports for grounds
int Layer_2 = A3; //A3
int Layer_3 = ... |
/*
Route Between Nodes: Given a directed graph, design an algorithm to find out whether there is a
route between two nodes
*/
#include <iostream>
#include <vector>
#include "VertexGraph.h"
#include "QueueClass.h"
int main(){
VertexGraph theGraph = VertexGraph();
Vertex v = Vertex(0,0);
theGraph.ad... |
#define CATCH_CONFIG_MAIN
#include <chrono>
#include <fcntl.h>
#include "metis.hpp"
#include "catch.hpp"
MetisContext c;
TEST_CASE( "addressing modes", "[MetisVM]" ) {
uint8_t buf[10000];
uint64_t stack[5];
MetisVM m(buf,10000, stack, 5, NULL, 0);
REQUIRE( BUILD_ADDR(REGB, REGC) == 0x21);
REQUIRE( GET... |
#define _CRT_SECURE_NO_WARNINGS
#include "lexer.h"
#include <iostream>
dynArray tkTable;
int wordCount = 0; // 源代码单词数
int charCount = 0; // 源代码字符数
int lineCount = 0; // 源代码行数
int curLineSize = 0; //当前行字符个数
int identifierCount = 0; //源代码标识符个数
int definatioinCount = 0; //源代码定义符个数
int boundaryCount = 0; //源代码界符个数
int c... |
#include "../src/Agent.cpp"
#include <gtest/gtest.h>
/* Stub methods to convince the Agent to compile and run */
Point2d::Point2d(){}
Vector2d::Vector2d::Vector2d(){}
void Vector2d::setVector(Vector2d*){}
int apply_vector_count = 0;
void Point2d::applyVector(Vector2d&){
apply_vector_count++;
}
const double DISTA... |
#ifndef __WHISKEY_AST_FieldString_HPP
#define __WHISKEY_AST_FieldString_HPP
#include <whiskey/AST/Field.hpp>
namespace whiskey {
class FieldString : public Field {
private:
std::string value;
protected:
std::unique_ptr<Field> onClone() const;
void onPrintAsLiteral(std::ostream &os) const;
bool onCompare(const F... |
#include "GlassMaterial.h"
#include "Texture/ConstantTexture.h"
#include "tinyxml2.h"
#include "Base/PCH.h"
GlassMaterial::GlassMaterial()
:Material()
{
mKr = nullptr;
mKt = nullptr;
mRefracIndex = nullptr;
}
GlassMaterial::GlassMaterial( const Vector3f& R , const Vector3f& T , float ior )
{
mKr = new ConstantTe... |
//$Id: StatisticRejectFilter.hpp 1398 2015-03-16 13:36:00Z tdnguyen $
//------------------------------------------------------------------------------
// StatisticRejectFilter
//------------------------------------------------------------------------------
// GMAT: General Mission Analys... |
#include <fstream>
#include <iostream>
#include <iconv.h>
#include <sstream>
#include "conv.hpp"
#include "resource.hpp"
#include "map.hpp"
namespace Game
{
Font *
Font::Load(const char *name)
{
const char *p = strchr(name, ':');
if (p == NULL) return NULL;
int size = atoi(p + 1);
std::string filename(... |
#ifndef RPOSTGRES_PQCOLUMNDATASOURCE_H
#define RPOSTGRES_PQCOLUMNDATASOURCE_H
#include "DbColumnDataSource.h"
class PqResultSource;
class PqColumnDataSourceFactory;
class PqColumnDataSource : public DbColumnDataSource {
PqResultSource* result_source;
const DATA_TYPE dt;
public:
PqColumnDataSource(PqResultSour... |
/*
* Copyright (c) 2013, Georgia Tech Research Corporation
* All rights reserved.
*
* Author: Michael X. Grey <mxgrey@gatech.edu>
* Date: May 08, 2013
*
* Humanoid Robotics Lab Georgia Institute of Technology
* Director: Mike Stilman http://www.golems.org
*
*
* This file is provided under the follow... |
#include <iostream>
#include <cstdio>
//#include <bits/stdc++.h>
#include <algorithm>
#include <cstring>
#define Inf 0x3f3f3f3f
#define NeInf 0xc0c0c0c0
using namespace std;
int a[1005][15];
bool is_zero(int n){
int i=1;
bool z=1;
for(int j=0;j<n && z;++j) if(a[0][j]!=0) z=0;
if(z) return 1;
while(... |
#include "DXUT.h"
#include "cRedCell.h"
#include "cPlayer.h"
cRedCell::cRedCell(void)
{
}
cRedCell::~cRedCell(void)
{
}
void cRedCell::Init()
{
m_vScale *= 0.5f;
m_fStopTime = 0.0f;
cMonster::Init();
m_vRotation.x = D3DX_PI * 0.5f;
m_vPos.y = 1.26f;
m_pResourceFile = _GETSINGLE( cResourceMgr )->GetResour... |
/*
* The Akafugu Nixie Clock
* (C) 2012-13 Akafugu Corporation
*
* 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
* Foundation; either version 2 of the License, or (at your option) any later
* version.
... |
#include "CurveEntry.h"
CurveEntry::CurveEntry(double value_, double time_) : time(time_), value(value_)
{
}
|
/**
* @file RegionParticleIteratorTest.h
* @author seckler
* @date 03.04.18
*/
#pragma once
#include <gtest/gtest.h>
#include "AutoPasTestBase.h"
#include "autopas/autopasIncludes.h"
#include "testingHelpers/RandomGenerator.h"
class TouchableParticle : public autopas::Particle {
public:
TouchableParticle(std:... |
// This file has been generated by Py++.
#ifndef GUIContextEventArgs_hpp__pyplusplus_wrapper
#define GUIContextEventArgs_hpp__pyplusplus_wrapper
void register_GUIContextEventArgs_class();
#endif//GUIContextEventArgs_hpp__pyplusplus_wrapper
|
/**
* Copyright 2016-2017 MICRORISC s.r.o.
*
* 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 applicable law or... |
#include "salaryservice.h"
SalaryService::SalaryService()
{
//ctor
}
void SalaryService::add_salary(const Salary& salary)
{
cout << salary << endl;
}
|
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using std::cin; using std::cout;
using std::vector; using std::endl;
using std::string; using std::sort;
int main()
{
vector<string> words;
cout << "Enter a list of words: ";
string s;
while ( cin >> s){
words.push... |
#include "ProteinScoringAndFdrResults.h"
#include "../ProteinParsimony/ProteinGroup.h"
#include "ProteinScoringAndFdrEngine.h"
namespace EngineLayer
{
ProteinScoringAndFdrResults::ProteinScoringAndFdrResults(ProteinScoringAndFdrEngine *proteinAnalysisEngine) : MetaMorpheusEngineResults(proteinAnalysisEngine)
... |
/**
* Copyright (C) 2017 Alibaba Group Holding Limited. 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
*
* ... |
#include "pch.h"
void show_error(SQLHANDLE handle, SQLSMALLINT type, RETCODE retcode)
{
SQLSMALLINT rec = 0;
SQLINTEGER error;
WCHAR message[1000];
WCHAR state[SQL_SQLSTATE_SIZE + 1];
if (retcode == SQL_INVALID_HANDLE)
{
fwprintf(stderr, L"Invalid handle!\n");
return;
}
while(SQLGetDiagRec(type, handl... |
#include "animations\Singularity.Animations.h"
namespace Singularity
{
namespace Animations
{
struct Frame
{
DynamicList<Keyframe> Keyframes;
int Index;
};
}
} |
#include "Graph.h"
#include <iostream>
//***********************************
//Bag Definitions
//Initialization for the Bag class, the position, and pointers are set to the start of the adjacency list.
Bag::Bag(){
Head = new LinkedList();
CurrentPos = Head;
Iterator = Head;
position = 0;
Head->Next = 0;
}
//All ... |
#include <iostream>
#include "Application.h"
using namespace std;
static const char alphanum2[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
class Dummy{
public:
int my;
Dummy();
};
Dummy::Dummy() {
my = 10;
}
int main(int argc, char ... |
#include "HitObject.h"
void HitObject::FireHitEvent(Ball* const pball)
{
/* TODO: if (m_obj && m_fe && m_enabled)
{
const float dist_ls = (pball->m_lastEventPos - pball->m_d.m_pos).LengthSquared();
pball->m_lastEventPos = pball->m_d.m_pos;
const float normalDist = (m_ObjType == eHitTarget) ? 0.0f
... |
/************************************************************************************
* *
* 국민대학교 컴퓨터 공학부 20123417 조성룡 *
* 프로그램 명: 매직스퀘어 *
* 설 명: 사각형의 크기를 입력 받아 행, 열, 대각선의 합이 같은 *
* 사각형을 출력 한다. *
* 알 고 리 즘: 1부터 시작해 n까지 수가 사각형에 들어간다. 기준점을 1로 잡고 *
* 위로 한... |
#ifndef CONNEXION_H
#define CONNEXION_H
#include <dbmanager.h>
#include <QString>
#include <QWidget>
namespace Ui
{
class connexion;
}
class connexion : public QWidget
{
Q_OBJECT
public:
explicit connexion(QWidget *parent = 0);
~connexion();
void success_connect()... |
#include <iostream>
#include <string>
using namespace std;
int global_int;
int main()
{
int input_value;
cout << input_value << '\t' << global_int << '\n';
string local_str;
cout << local_str << endl;
// double salary = wage = 9999.99;
return 0;
} |
#include <iostream>
#include <vector>
using namespace std;
float f(float x, float y)
{
return (5 * x * x - 6) * cos(y);
}
void print(vector<float> y)
{
for (int i = 0; i < y.size(); i++)
{
cout << y[i] << " ";
}
cout << "\n\n";
}
vector<float> RungeKutta(vector<float> x, vector<float> y, int n, float h)
{
... |
#ifndef GENPAT_H
#define GENPAT_H
/// @file GenPat.h
/// @brief GenPat のヘッダファイル
/// @author Yusuke Matsunaga (松永 裕介)
///
/// Copyright (C) 2005-2012 Yusuke Matsunaga
/// All rights reserved.
#include "YmTools.h"
#include "GpMgr.h"
#include "GpNode.h"
#include "NpnXform.h"
#include "FuncXform.h"
BEGIN_NAMESPACE_YM... |
#include <cstdio>
#include <algorithm>
/*
* 2018/3/23 1024
* 2018/3/23 2048
* 2018/4/23 100
*/
using namespace std;
const int MAXN = 1000;
typedef struct File {
int yy;
int mm;
int dd;
int date;
int size;
}File;
bool cmp(const File a, const File b);
bool cmp2(const File a, const File b);
int main() {
in... |
#ifndef _SERVICIOEXTENSIONFP_H
#define _SERVICIOEXTENSIONFP_H
#include "servicio.h"
#include "dominio.h"
class cServicioExtensionFP:public cServicio {
public:
//Constructor e iniciador
cServicioExtensionFP(cDominio *dominio);
bool iniciar();
//Agrega las extensiones del FP en el sistema
int agregarExtensi... |
#include <iostream>
#include <time.h>
#include <windows.h>
using namespace std;
int i = 4;
int zero[1];
int stroka, stolb, *returned;
int& maxelement(int(**));
int main()
{
srand(time(0));
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
int** massive = new int* [i];
for (stroka = 0; stroka < i; stroka++)
{
mass... |
#include"SnakeTail.h"
SnakeTail::SnakeTail(int _x, int _y) :SnakeCell(_x, _y) {
assert(_x > 0 && _x < MAX_HEIGHT - 1);
assert(_y > 0 && _y < MAX_WIDTH - 1);
type = 'o';
}
bool SnakeTail::can_pass_through() {
return false;
} |
#include "ListADT.hpp"
ListADT::ListADT(){
_size = 5;
_data = new int[_size];
_end = -1;
}
ListADT::~ListADT(){
delete _data;
_data = nullptr;
}
void ListADT::insert(int element, int position){
if(position > _end+1){
std::cout << "invalid position" << std::endl;
return;
}
//growing the array
if(_end+1... |
#pragma once
#include <cstdint>
#include <boost/mpl/int.hpp>
/** \brief namespace of static unique identifiers used in ASEIA **/
namespace id{
/**\brief sub-namespace of static unique Attribute identifiers **/
namespace attribute{
/**\brief Tag indicating AttrID **/
struct Tag{};
/**\brief Definitio... |
//均值滤波
#include<iostream>
#include<opencv2/opencv.hpp>
cv::Mat meanfilter(cv::Mat img, int n)
{
//建立高斯核模板
//float *guass= new float[n,n];
int height = img.rows;
int width = img.cols;
int channel = img.channels();
int c = 0, c1 = 0, r = 0, r1 = 0;
... |
// Calculates lca(a,b) in a tree in O(log n).
// Running time: O(log n) + pre-computing O(n log n)
const int MAXN=1000005, LOGMAXN=2+log2(MAXN);
vector<int> G[MAXN];
int parent[LOGMAXN][MAXN], depth[MAXN];
// Generates parent[][] and depth[]; call dfs(root)
void dfs(int v, int p=-1) {
depth[v] = (p >= 0 ? depth[p] +... |
#include "messaging/MessageBus.hpp"
using namespace cobalt::messaging;
MessageBus::MessageBus () {}
/*
Registers a subscriber to a specific message
*/
void
MessageBus::addSubscriber (
MessageID p_msgID,
Subscriber p_subscriber
) {
m_subscribers[p_msgID].push_back(p_subscriber);
}
/*
Sends a message to all sub... |
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int sum = 0,max = a[0];
for(int i= 1;i<n;i++ )
{
if(a[i]<max){
for(int j=0;j<i;j++)
{
if(a[i] < a[j])
{
sum++;
}
}
... |
#include <iostream>
using namespace std;
class Animal
{
public:
virtual void say()
{
cout << "Animal say" << endl;
}
};
class Dog : public Animal
{
public:
void say()
{
cout << "Dog say" << endl;
}
};
class Cat : public Animal
{
public:
void say()
{
cout << "Ca... |
class Solution {
public:
vector<int> findSmallestSetOfVertices(int n, vector<vector<int>>& edges) {
// 只要选中入度为0的点就行了
vector<int> result;
set<int> s;
for(auto edge:edges)
{
s.insert(edge[1]);
}
while(n)
{
if(s.find(n-1) == s.end(... |
/*
* Copyright (C) 2007-2015 Frank Mertens.
*
* Use of this source is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#ifndef FLUX_BUNDLE_H
#define FLUX_BUNDLE_H
/** \file Bundle.h
* \brief Lookup files in installation directories
*/
#include <flux/File>
namespace flux {
#de... |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
scanf("%d", &n);
vector<int> a;
vector<int> b;
int res = 0;
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
if (a.empty()) {
a.push_back(x);
b.push_back(1);
... |
//
// Created by Chris Brown on 1/13/17.
//
#include "physicsengine.h"
void PhysicsEngine::update(State s, const std::map<int, inputs>& all_joystick_inputs,
const std::map<int, inputs>& all_last_inputs, SoundThread sounds){
update_explosions(s);
//TODO: refactor Pierce Effects
... |
#ifndef DECHIFFREMENT_H
#define DECHIFFREMENT_H
#include <gmpxx.h>
#include <vector>
/**
* @brief Module Dechiffrement
* @file Dechiffrement.h
*
* Cette classe permet de déchiffrer un message et une clé AES
*
* @version 1.0
* @date 2018/04/10
*/
class Dechiffrement {
private:
mpz_class c1; /** <Donnée membre: c1 la... |
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include <vector>
#include <random>
class Neuron;
typedef std::vector<Neuron> Layer;
struct Connection {
float weight;
float deltaWeight;
};
class Neuron
{
public:
Neuron(unsigned int numOutputs, std::size_t id);
~Neur... |
//
// Created by Sardor on 2019-04-21.
//
#include "cross_walk_detector.h"
bool CrossWalkDetector::hasCrossWalk(Mat image) {
if (image.empty()) {
return false;
}
Mat gray;
image.convertTo(image, -1, 1.3, 10);
Mat hsv = thresh_frame_in_HSV(image, Scalar(0, 0, 235), Scalar(100, 0, 255), fals... |
#include "ProgressEventArgs.h"
#include "stringhelper.h"
namespace EngineLayer
{
ProgressEventArgs::ProgressEventArgs(int newProgress, const std::string &v, std::vector<std::string> &nestedIDs) : MyRecursiveEventArgs(nestedIDs)
{
NewProgress = newProgress;
V = v;
}
bool ProgressEventA... |
#pragma once
#include "Subsystem.h"
#include "Flightdata.h"
#include <Adafruit_INA219.h>
const unsigned long deltaTimeFlightIna = 1000;
const unsigned long deltaTimeTestIna = 10000;
class Ina:Subsystem {
public:
void init(Flightdata &flightdata);
void test(unsigned long currTime);
void flightProcess(unsigned lon... |
// node_b28Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "node_b28.h"
#include "node_b28Dlg.h"
#include <atlconv.h>
#include <shlobj.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CString ConvertGBKToUtf8(CString strGBK )
{
... |
/*
Copyright 2015. Bae Hanbin(bhb0722@nate.com or bhb0722@skku.edu) all rights reserved.
Beta Functions for Global Function
*/
#include "GlobalFunction.h"
void getCentroid(double **sample, int n, double **result, double **sigma, int* K, int ndim)
{
int nCent = *K;
int i, j, k, ihi, niter = 0;
int del;
d... |
/****************************************
*
* 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 <dsnutil/event/broadcast_channel.hpp>
namespace dsn {
namespace event {
/// \brief Interface for broadcast event handlers
///
/// Implement this to have an object register/unregister itself as handler for
/// broadcasted \p Tmessage events during its lifetime.
///
/// \tp... |
#include<iostream>
using namespace std;
int main(){
float sum=0.0,term;
int denom=1,sign=1;
for(int i=0; i<100; i++){
term=4.0/denom;
term=term*sign;
//cout << term << endl;
sum=sum+term;
sign=sign*-1;
denom+=2;
}
cout << "pi value with 100 iterration: " << sum << endl;
sum=0.0,term;
denom=1,sign=1;
... |
// Copyright 2020-2021 Russ 'trdwll' Treadwell <trdwll.com>. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "SteamStructs.h"
#include "UObject/NoExportTypes.h"
#include "SteamIDUtils.generated.h"
/**
* A utility class for SteamID
*/
UCLASS()
class STEAMBRIDGE_API USteamIDUtils : public UObjec... |
/*
** Copyright (c) 2016, Xin YUAN, courses of Zhejiang University
** All rights reserved.
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the 2-Clause BSD License.
**
** Author contact information:
** yxxinyuan@zju.edu.cn
**
*/
/*
This file contains ... |
#ifndef _included_ffread_hpp_
#define _included_ffread_hpp_
#ifndef __cplusplus
#error "ffread.hpp requires C++ compilation"
#endif
/*
Fastfile format:
1. Identifier, num_files
2. Header - contains information about files and offsets
3. Data - concatenated files
1.1 DWORD: RFFL - identifier
1.2 DWO... |
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAX_N = 1000;
const int MAX_m = 1000;
const int MAX_A = 1000;
const int MAX_M = 10000;
int n,m,M;
int a[MAX_N];
int dp[MAX_N + 1][MAX_m + 1];
void read(){
scanf("%d\n%d", &n, &m);
for(int i=0; i<n; i++)
scanf("%d", &a[i]);
scanf("%d\n"... |
#ifndef KKTECQFUNC_H
#define KKTECQFUNC_H
#include <string>
#include <iostream>
#include "wyarray.h"
#include "pdmtrfunc.h"
#include "cglv.h"
using namespace std;
class KKTEcqFunc {
private:
int nusr;
int nmsg;
int ns, nx, nv;
int nm;
double lambda;
double gamma;
double *w, *c;
double *x0, *v0, *s... |
// github.com/andy489
// https://www.hackerrank.com/contests/practice-9-sda/challenges/floyd-city-of-blinding-lights
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
using namespace std;
void dijkstra(vector<unordered_map<int, int>> &adj, int s, int e, vector<vector... |
#include "NetworkService.h"
int NetworkService::sendMessage(SOCKET curSocket, char * message, int messageSize)
{
return send(curSocket, message, messageSize, 0); //0 is for flags
}
int NetworkService::receiveMessage(SOCKET curSocket, char * buffer, int bufSize)
{
return recv(curSocket, buffer, bufSize, 0); //if no ... |
#include<iostream>
using namespace std;
int main()
{
int a=0,b=1,c,n,i;
cout<<"Enter limit:";
cin>>n;
cout<<a<<"\t"<<b<<"\t";
for(i=2;i<n;i++)
{
c=a+b;
cout<<c<<"\t";
a=b;b=c;
}
}
|
#include <bits/stdc++.h>
#define MAX 1000001
#define M 1000000007
#define ll long long
#define ld long double
#define ESP 0.0001
using namespace std;
int sumDivisors[MAX], p[10*MAX];
int precomputation(){
int mx = 0;
for (int i=1;i<MAX;i++){
for (int j=i;j<MAX;j+=i){
sumDivisors[j]+=i;
mx = max(mx, sumDivis... |
#include <iostream>
using namespace std;
template <typename T>
class Stack {
struct stackNode {
T data;
stackNode *next;
};
public:
stackNode *top;
Stack() {
top = NULL;
}
void display() {
stackNode *temp = new stackNode;
temp = top;
cout << "[ ";
while (temp != NULL) {
cout << temp->data <... |
/****************************************************************************
** Meta object code from reading C++ file 'quickmergesort.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.5)
**
** WARNING! All changes made in this file will be lost!
*****************************************************... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.