text stringlengths 8 6.88M |
|---|
// Solution 1 counting sort
class Solution {
public:
void sortColors(vector<int>& nums) {
int redCnt = 0, whiteCnt = 0, blueCnt = 0;
for (int num : nums) {
switch (num) {
case 0:
redCnt++;
break;
case 1:
... |
//
// Created by chris on 22/08/2017.
//
#ifndef MINECRAFT_CLONE_AGGREGATEBLOCKREGISTER_H
#define MINECRAFT_CLONE_AGGREGATEBLOCKREGISTER_H
#include <Block.h>
#include "Air.h"
#include "Grass.h"
#include "Stone.h"
#include "Dirt.h"
/*
* ID's for all the blocks
*/
namespace BlockID {
extern unsigned Air;
... |
#include "MappingKeyTapListener.hpp"
#include "KeyEvent.hpp"
using namespace Leap;
void MappingKeyTapListener::onKeyTap(const KeyTapGesture& keyTap) {
KeyEvent event(VK_RETURN);
event.trigger();
}
|
#ifndef NOTEPADWINDOW_H
#define NOTEPADWINDOW_H
#include <QMainWindow>
namespace Ui {
class NotepadWindow;
}
class NotepadWindow : public QMainWindow
{
Q_OBJECT
public:
explicit NotepadWindow(QWidget *parent = 0);
~NotepadWindow();
private slots:
void on_quitBtn_clicked();
void on_addBtn_click... |
#include "Game.hpp"
Elysium::Graphics::Game::Game()
{
}
Elysium::Graphics::Game::~Game()
{
Exit();
if (_GameHost != nullptr)
{
delete _GameHost;
_GameHost = nullptr;
}
}
void Elysium::Graphics::Game::Run()
{
// create the gamehost and the graphicsinstance
_GameHost = CreateGameHost();
... |
#include "State.hpp"
#include <algorithm>
#include <climits>
#include <memory>
namespace SVParser {
State::From::From(State* state, Transition* transition)
: state(state)
, transition(transition)
{
}
State::State(int label)
: label(label)
, layer(INT_MAX)
, traversed(false)
{
}
State::~State()
{
... |
#include "HierarchyWindow.h"
#include "imgui.h"
#include "Common.h"
#include <string>
#include "Plugin.h"
#include "ui/ConsoleWindow.h"
using namespace studio;
float value;
NodePtr HierarchyWindow::visualTreeSelectedItem;
void HierarchyWindow::draw()
{
ImGui::Begin(u8"层级", &Datas::ShowHierarchyWindow);
loopDraw(Da... |
#include <iostream>
#include <algorithm>
using namespace std;
int t, n;
long long ans, a[100001], b[100001], acopy[100001], aCount;
int main()
{
cin >> t;
for(int i = 0; i < t; i++)
{
cin >> n;
ans = 0;
aCount = 0;
for(int i = 0; i < n; i++)
cin >> a[i];
... |
#include "SDL.h"
#include "sdl_wrappers.h"
using namespace std;
SDL::SDL()
{
if (SDL_Init(SDL_INIT_EVERYTHING))
{
throw runtime_error(SDL_GetError());
}
}
SDL::~SDL()
{
SDL_Quit();
}
GLContext::GLContext(shared_ptr<SDL_Window> window):
context(nullptr)
{
context = SDL_GL_CreateContext(window.get());... |
#include "../Module.h"
#include "../VolumeControlPlatform.h"
#include <nexus_config.h>
#include <nexus_audio_types.h>
#include <nexus_platform.h>
#include <nexus_simple_audio_decoder.h>
#include <nxclient.h>
namespace WPEFramework {
namespace Plugin {
namespace {
constexpr uint8_t kMinVolume = 0;
constexpr uint8_t ... |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;
#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define r... |
#ifndef AMVK_FILE_MANAGER
#define AMVK_FILE_MANAGER
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <limits.h>
#include <stdio.h>
#include <macro.h>
#include <stdexcept>
#ifdef WINDOWS
#include <direct.h>
#define getCurrentDir _getcwd
#else
#include <unistd.h>
#define getCurrentDir... |
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
//O(n2)
int canCompleteCircuitBruteForce(vector<int> &gas, vector<int> &cost){
vector<int> n;
for(int i=0;i<gas.size();i++){
int temp = gas[i] - cost[i];
n.push_back(temp);
}
int size = n.size();
int res;
if(size== 1){
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2005-2007 Opera Software ASA. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
*/
#ifndef SVG_FONTSIZE_H
#define SVG_FONTSIZE_H
// This values ... |
#pragma once
#include"MovementComponent.h"
#include"ResourceHandler.h"
class AudioComponent
{
private:
std::shared_ptr<DirectX::AudioEngine> m_audioEngine;
std::vector<std::unique_ptr<DirectX::SoundEffectInstance>> m_effect;
MovementComponent* playerMovementComp;
DirectX::AudioListener listener;
DirectX::AudioEmi... |
/*
* This file contains all header informations for the line tracking interface
* using the TCRT5000 and ESP32 analog in
*
* Creation date: 2019 06 10
* Author: Pascal Pfeiffer
*/
#ifndef LINE_TRACKING_H
#define LINE_TRACKING_H
#include "mainUSR.h"
#include <Arduino.h>
#define LT_FL_PIN 36
#define LT_FR_PIN 3... |
#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;
int nhang,ncot;
char s[111][111];
int m,n,bd,x;
int q[111];
bool d[111];
int dau,cuoi;
vector<int> vect;
void input(){
scanf("%d %d",&n,&bd);
memset(s,0,sizeof(s))... |
// BEGIN CUT HERE
// PROBLEM STATEMENT
// Little George has found an old-fashioned balance scale and
// a set of weights in the attic. The scale has two weighing
// pans and it allows you to check if the content of the left
// pan is heavier, lighter, or the same weight as the content
// of the right pan. The box w... |
#ifndef ELECTIONINFO_H
#define ELECTIONINFO_H
#include <vector>
#include <QDate>
#include "SRC/Analyzer/DataTypes/person.h"
namespace EAnalyzer
{
class ElectionInfo
{
public:
ElectionInfo();
enum ElectionType
{
Country,
City
};
ElectionType ty... |
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#define MAX_V (10000001)
#define MAX_N (100001)
using namespace std;
class LuckyRemain... |
#include<bits/stdc++.h>
using namespace std;
#define maxn 105
const double INF=pow(10,300);
typedef struct node{
double x,y;
}node;
node N[maxn];
int vis[maxn];
double dist[maxn][maxn];
int p[maxn];
int num;
double dis(node a,node b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int ... |
#pragma once
#define MYDEBUG 0
#define DEGREE 4
#define MYSIZE 80
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <io.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
const long NULLPOINTER = -1L;
enum state{error, incomplete, success, underflow, notfound, duplicate};
... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <ostream>
#include <folly/Function.h>
#include <folly/Optional.h>
#include <folly/io/async/DelayedDestruct... |
#include <iostream>
#include "Object.h"
void OutOfMemory(){
std::cerr << "Not memory available for allocation";
std::abort();
}
int main()
{
Object::SetCurrentHandler(OutOfMemory);
Object* obj = new Object();
return 0;
} |
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* PresidentialPardonForm.hpp :+: :+: :+: ... |
#include <fstream>
#include <iostream>
#include <string>
int main()
{
std::string input;
//Open file
std::ifstream inFile;
inFile.open("GutenBerg.txt");
while (!inFile.eof())
{
//Get input
inFile >> input;
//Print input
std::cout << input << " ";
}
//Close file
inFile.close();
return 0;
}
|
/*
filename: moitemset.cpp
author: Sherri Harms
last modified: 7/20/01
description: Class moitemset implementations for parallel
episodes. This is the implementation FILE moitemset.cpp for the class moitemset.
Values of this type are sets of moitem pointers,
where an moitem is a composite of
episode, support, a... |
#include "ConfigScreen.h"
void ConfigScreen::start(SDL_Renderer* renderer)
{
font = TTF_OpenFont("font/arial.ttf", 36);
red.r = 255;
red.g = 0;
red.b = 0;
red.a = 255;
selectedSquare.w = 70;
selectedSquare.h = 60;
selectedSquare.y = 190;
selectedSquare.x = 240;
title = new Texture(Util::loadTextureFromT... |
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <fstream>
#include <map>
#include <sstream>
#include <algorithm>
using namespace std;
enum nodeType{_VAR_,_CONST_,_TMP_,_VOID_};
inline bool isDigit(char c){
return c>='0'&&c<='9';
}
struct DAG_node{
string name;
nodeType t... |
/*
* Copyright 2019 LogMeIn
*
* 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 agreed to in w... |
#include <iostream>
#include <numeric>
#include <algorithm>
using namespace std;
int main() {
int N;
cin >> N;
int a[N];
for (int i = 0; i < N; ++i) {
char c;
cin >> c;
a[i] = c - '0';
}
if (all_of(a, a + N, [&](int i) { return i == 0; })) {
cout << "YES" << en... |
#ifndef APPLICATION_BASEOBJECT_H
#define APPLICATION_BASEOBJECT_H
#include <string>
#include <memory>
#include "Parser/Parser.h"
// Abstract chat object
class BaseObject {
public:
BaseObject() : parser(std::make_shared<Parser>()) {};
virtual ~BaseObject() = default;
// Get encode string
virtual std... |
/*
* @lc app=leetcode.cn id=315 lang=cpp
*
* [315] 计算右侧小于当前元素的个数
*/
// @lc code=start
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
vector<int> c;
vector<int> a;
void Init(int length){
c.resize(length, 0);
}
int LowBit(int x){
... |
/*
Copyright 2021 University of Manchester
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 agreed to in writing, ... |
#include <iostream>
#include <fstream>
using namespace std;
struct StudentData
{
int fn;
char name[100];
};
void createStudents ()
{
ifstream inpStud ("students.txt");
ofstream outpStud2 ("studentsOut.txt");
StudentData student;
while (inpStud >> student.fn)
{
inpStud.getline ... |
#include <iostream>
using namespace std;
int main()
{
int number,num = 30;
for(number = 1; number <= num; number++)
{
if(number % 12 ==0)
cout<<number<<endl;
}
return 0;
}
|
#include <iostream>
#include <algorithm>
typedef long long ll;
const ll INF = 1e9;
int main()
{
std::cin.sync_with_stdio(false);
std::cin.tie(NULL);
int V, E;
ll route[401][401];
std::fill(route[0], route[0] + 401 * 401, INF);
std::cin >> V >> E;
for(int i = 0; i < E; i++)
{
in... |
#include "meltCmd.h"
#include "meltNode.h"
#include <maya/MSelectionList.h>
#include <maya/MGlobal.h>
#include <maya/MItSelectionList.h>
#include <maya/MTime.h>
#include <maya/MAnimControl.h>
#include <maya/MPlug.h>
#include <maya/MPlugArray.h>
MStatus MeltCmd::doIt(const MArgList &args)
{
MStatus stat;
MSelection... |
/* ESP8266/32 Audio Spectrum Analyser on an SSD1306/SH1106 Display
* The MIT License (MIT) Copyright (c) 2017 by David Bird.
* The formulation and display of an AUdio Spectrum using an ESp8266 or ESP32 and SSD1306 or SH1106 OLED Display using a Fast Fourier Transform
* Permission is hereby granted, free of charge, t... |
#include <iostream>
int main(){
int x = (2)(2);
std::printf("(2)(2): %d\n",x);
} |
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout... |
// Created on: 2002-07-30
// Created by: Michael SAZONOV
// Copyright (c) 2002-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 General Public License version 2.1 ... |
#pragma once
namespace qp
{
class CQuizSession;
typedef std::shared_ptr<CQuizSession> CQuizSessionPtr;
} |
#include<bits/stdc++.h>
using namespace std;
main()
{
int n;
while(scanf("%d",&n)==1)
{
int i, count=0;
char s[20];
getchar();
for(i=1; i<=n; i++)
{
gets(s);
if(strcmp(s,"X++")==0)
count++;
else if(strcmp(s,"--X")==0... |
#include <initializer_list>
#include <string>
#include <algorithm>
#include <memory>
#include <stdexcept>
#include "allocators.h"
struct Range_error : std::out_of_range {
int index;
Range_error(int i) : std::out_of_range("Range error"), index{ i } {};
};
//template<typename T> struct Vector :public std : vector<T>... |
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, instal... |
/*
Petar 'PetarV' Velickovic
Data Structure: Circular Doubly Linked List (Microchallenge)
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#includ... |
#include <json/json.h>
#include "Player.h"
#include "AllocSvrConnect.h"
#include "Configure.h"
#include "Logger.h"
#include "CoinConf.h"
#include "IProcess.h"
#include "MoneyConnect.h"
#include "TaskRedis.h"
int pase_json(Json::Value& value, const char* key, int def)
{
int v = def;
try{
v = value[key].asInt();
}
... |
//
// Created by carte on 11/7/2019.
//
#include "Stack.h"
Stack::Stack() { //default constructor for Stack
head = nullptr;
}
void Stack::push_head(const Data &stat){ //pushing Nodes onto the stack
Node* node = new Node(stat);
node->next = head;
head = node;
}
bool Stack::pop_head() { ... |
class Solution {
public:
int maxAbsoluteSum(vector<int>& nums) {
// for max sum
int maxx = 0;
int sum = 0;
int n = nums.size();
for(int i=0; i<n; i++) {
sum += nums[i];
if(sum < 0) sum = 0;
maxx = max(sum, maxx);
}
// for min sum
... |
#include "../../../glmock.h"
using namespace glmock;
extern "C" {
#undef glUniform2fv
void CALL_CONV glUniform2fv(GLint location, GLsizei count, const GLfloat* value) {
}
DLL_EXPORT PFNGLUNIFORM2FVPROC __glewUniform2fv = &glUniform2fv;
}
|
/*
* @lc app=leetcode.cn id=18 lang=cpp
*
* [18] 四数之和
*/
// @lc code=start
#include<iostream>
#include<vector>
#include<climits>
#include<algorithm>
using namespace std;
class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
vector<vector<int> > v;
if(nums.size... |
//---------------------------------------------------------
//
// Project: dada
// Module: gl
// File: Shader.h
// Author: Viacheslav Pryshchepa
//
// Description:
//
//---------------------------------------------------------
#ifndef DADA_GL_SHADER_H
#define DADA_GL_SHADER_H
#include "d... |
#include <boost/log/core.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/console.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/sinks/syslog_backend.hpp>
#include <boost/log/keywords/facility.hpp>
#include <boost/log/keywords/use_impl.hpp>
#include <... |
/* -*- 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.
*/
#include "core/pch.h"
#include "ExtensionsPanel.h"
#include "a... |
#include "stdafx.h"
#include "MatchingQuestion.h"
#include "MatchingQuestionState.h"
#include "QuestionReview.h"
using namespace qp;
using namespace std;
using MatchedItems = CMatchingQuestion::MatchedItems;
using StandaloneItems = CMatchingQuestion::StandaloneItems;
using MatchedItemsCollection = CMatchingQuestion::... |
#include "TextGL.h"
#include "Config.h"
#include <iterator>
#include "GL\glew.h"
extern sf::RenderWindow window;
CTextGL::CTextGL()
{
}
void CTextGL::CreateAPI( std::wstring strFont )
{
std::string path( strFont.begin(), strFont.end());
if ( !m_font.loadFromFile(path) )
{
perror( "Error al intentar cargar fuen... |
// **************************************
// File: KDrawable.h
// Copyright: Copyright(C) 2013-2017 Wuhan KOTEI Informatics Co., Ltd. All rights reserved.
// Website: http://www.nuiengine.com
// Description: This code is part of NUI Engine (NUI Graphics Lib)
// Comments:
// Rev: 2
// Creat... |
#include "branchandbound.h"
#include <iostream>
BranchAndBound::BranchAndBound(vector <vector<float>>a, vector <float>b, vector <float>c, vector<string> ing, string P){
SolInteger.resize( a[0].size() , 0);
PL = Simplex(a,b,c,ing,P);
PL.Solve();
for(int i=0 ; i<PL.Solution.size() ; i++)
SolInt... |
/*
* InputManager.hpp
*
* Created on: May 3, 2017
* Author: Patryk
*/
#ifndef _INPUTMANAGER_HPP_
#define _INPUTMANAGER_HPP_
#include <Window.hpp>
#include <vector>
#include <memory>
#include <functional>
namespace core
{
namespace input
{
class IInput
{
public:
virtual ~IInput(){}
virtual v... |
#ifndef PLOT_H
#define PLOT_H
#include <opencv2/core.hpp>
#include "slaveslam/common_include.h"
namespace slaveslam
{
class plotLine
{
public:
typedef std::shared_ptr<plotLine> Ptr;
public:
};
} |
#include <iostream>
#include "Stack.h"
using namespace std;
Stack::Stack(int i){
size = i;
top=0;
data =(int*)calloc(size,sizeof(int));
if(!data){
cout<<"MEMORY ALLOCATION ERROR!"<<endl;
abort();
}
}
void Stack::push(int value){
if(top == size){
size=2*size;
data=(int*)realloc(data,size*sizeof(int));
}
data[top... |
#include "water_frame_buffer.h"
namespace sloth {
WaterFrameBuffer::WaterFrameBuffer()
{
// initialize reflection
m_Reflection = new FrameBuffer(WATER_REFLECTION_WIDTH, WATER_REFLECTION_HEIGHT);
m_Reflection->addColorTextureAttachment(0);
m_Reflection->addDepthRenderBufferAttachment();
// initialize refra... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[4];
a[0]=1;
a[1]=100;
a[2]=39;
a[3]=724;
printf("a[0]=%d, a[1]=%d, a[2]=%d, a[3]=%d\n",a[0],a[1],a[2],a[3]);
}
|
#include <iostream>
#include <math.h>
using namespace std;
void PrimeFactors(int n)
{
while (n%2 == 0)
{
cout<<"2"<<" ";
n = n/2;
}
for (int i = 3; i <= sqrt(n); i = i+2){
while (n%i == 0){
cout<<i<<" ";
n = n/i;
}
}
if (n > 2)
cout<<n;
}
int main()
{
in... |
#include <iostream>
#include <cstdio>
#include <stdlib.h>
using namespace std;
int main()
{
int ** A,n,i;
cout<< "Podaj rozmiar macierzy kwadratowej n x n (max n=7) n = "; cin >> n;
if (n<=0 || n>7)
{
do
{
cout <<"liczba nie z tego przedzialu podaj jeszcze raz: ";
cin ... |
#ifndef DAIRY_H
#define DAIRY_H
#include <iostream>
#include "Category.h"
class Dairy : public Category {
public:
Dairy(const std::string& name="Dairy");
virtual ~Dairy();
};
#endif //DAIRY_H
|
// Sharna Hossain
// CSC 111
// Lab 5 | grades.cpp
#include <iostream>
using namespace std;
int main()
{
int grade1, grade2, grade3;
double average;
cout << "Enter grade 1: ";
cin >> grade1;
cout << "Enter grade 2: ";
cin >> grade2;
cout << "Enter grade 3: ";
cin >> grade3;
avera... |
/*
* Copyright (C) 2013 Tom Wong. All rights reserved.
*/
#ifndef __GT_DOC_TAB_VIEW_H__
#define __GT_DOC_TAB_VIEW_H__
#include "gttabview.h"
class QSplitter;
class QTreeView;
class QUndoStack;
class QVBoxLayout;
GT_BEGIN_NAMESPACE
class GtBookmark;
class GtDocModel;
class GtDocument;
class GtDocView;
class GtTocM... |
#ifndef TERRAIN_H
#define TERRAIN_H
#include <QObject>
#include <QList>
#include <QVector>
#include <QVector3D>
#include <Qt3DCore/QEntity>
#include <Qt3DCore/QScaleTransform>
#include <Qt3DCore/QTranslateTransform>
#include <Qt3DRenderer/QCuboidMesh>
#include <Qt3DRenderer/QPhongMaterial>
class TerrainBlock;
#def... |
#include "main.h"
const int SCREEN_WIDTH = 452;
const int SCREEN_HEIGHT = 465;
int intervalChange = 1, intDots = 240, intSuperDots = 4;
uint64_t intScore = 0;
double degree;
bool enabled_Spook = false, enabled_Debug = false, quit = false;
struct xy
{
int x;
int y;
} coords[255];
struct tile
{
}gTile;
std::... |
#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... |
#include "Wall.h"
/*
Constructor for the walls. It instantiates 3 main walls (top, right and
bottom) and a wall for powerup.
*/
Wall::Wall(unsigned int screenWidth, unsigned int screenHeight,
unsigned int wallWidth, unsigned int bottomPadding, glm::vec3 color)
{
this->left = new CollidableSquare("leftWal... |
#include <iostream>
#include <cstdlib>
#include <signal.h>
#include "serial/serial.h"
using namespace std;
void printUsage();
void parser(int argc, char *argv[]);
void handler(int signum);
uint32_t baudrate = 9600, timeout = 1;
string port("/dev/ttyACM0");
string input("");
bool finish = false;
int main(int argc, c... |
//
// main.cpp
// Total Control
//
// Created by Parker Lawrence on 8/4/15.
// Copyright (c) 2015 Parker Lawrence. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include </usr/include/GL/glew.h>
#include <GLFW/glfw3.h>
GLFWwindow* window;
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transfor... |
#include "MessageStatus.h"
MessageStatus::MessageStatus() : chatId(-1) {}
MessageStatus::MessageStatus(int chatId) : chatId(chatId) {}
std::string MessageStatus::encode() const {
parser->clear();
parser->addValue(chatId, KeyWords::chatId);
return parser->getJson();
}
void MessageStatus::decode(const st... |
#include <string>
#include <iostream>
using namespace std;
int main()
{
int n,k;
cin >> n >> k;
string str;
cin >> str;
int number_guest[26];
bool has_guard[26];
for(int i=0; i<26; ++i)
{
number_guest[i]=0;
has_guard[i]=false;
}
for(unsigned int i=0; i<str.size(); ++i)
{
++number_guest[str[i]-'... |
#include <bits/stdc++.h>
#define FOR(i, s, e) for(int i=s; i<e; i++) //excluding end point
#define loop(i, n) for(int i=0; i<n; i++) //n times
#define loop(n) for(int i=0;i<n;i++) // n times
#define getint(n) scanf("%d", &n)
#define gi(n) scanf("%d",&n) //getint short form
#define pb(a) push_back(a)
... |
#pragma once
#include <string.h>
#include <QWidget>
#include <QFormLayout>
#include <QLabel>
#include <QPushButton>
#include <QString>
#include <QLineEdit>
#include <QMap>
#include <QList>
struct DropDownListEntry
{
QString value;
QString label;
};
struct FormFieldDescriptor
{
QWidget* field;
int ... |
/*
Copyright (c) 2014 Mircea Daniel Ispas
This file is part of "Push Game Engine" released under zlib license
For conditions of distribution and use, see copyright notice in Push.hpp
*/
#include "Core/Log.hpp"
#include "Core/Enum.hpp"
#include "Core/Hash.hpp"
#include "Core/Path.hpp"
#include "Core/TypeID.hpp"
#includ... |
#include "communication.h"
NTSTATUS communication::hooked_device_control(PDEVICE_OBJECT pDevice, PIRP Irp)
{
ULONG ByteIO = 0;
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status = STATUS_UNSUCCESSFUL;
if (!NT_SUCCESS(is_ctl_valid(stack->Parameters.DeviceIoControl.IoControlCode)))
{
o... |
/*
Name: Ա�������¼
Copyright:
Author: Hill bamboo
Date: 2019/8/20 12:51:01
Description: �����������ÿ�����
13 min
*/
#include <bits/stdc++.h>
using namespace std;
long long frac(int n) {
if (n <= 1) return 1;
long long ret = 1;
for (int i = 2; i <= n; ++i) {
ret *= i;
}
return ret;
}
long long comb(int n... |
#include <iostream>
#include <iomanip>
using namespace std;
int m;
int main(){
setprecision(9);
cin >> m;
int ans[m] = {0, };
double l = (double) 1/m;
do{
double input;
cin >> input;
ans[(int)(input / l + 0.0000000001)]++;
}while(getchar() == ' ');
for(int i = 0; i ... |
///// comm.cpp
///// purpose : member function code for TCommPort, serial communictaions API
///// encapsulation
///// copyright: Harold Howe, bcbdev.com 1996-1999.
///// notice : This file provides an object that encapsulates the win32 serial port routines.
///// This file may... |
// tspOptimalPath.cc -- Get the optimal path with Greedy Algorithm.
#include<iostream>
using namespace std;
#define N 5
void tsp(){
int i, j, k, l;
int S[N]; // visited customer
int D[N][N]; // distance between customers
int sum = 0; // calculate optimal path of visited customer
int Dtemp; // temporary defined... |
#pragma once
#include "q_A.h"
class q_prot : protected q_A {
public:
void calc();
void print();
void new_k(int num);
void new_a(elem*value);
void new_b(elem*value);
};
|
#include <iostream>
using namespace std;
int main()
{
int *test;
test = new int;
for (int i=2;i<=13;i++)
{
*test = i;
}
for (int i=1;i<=16;i++)
{
cout << *test;
}
delete [] test;
return 0;
} |
#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... |
#include "../include/TextureManager.h"
#include "../include/Global.h"
namespace gnGame {
TextureMap TextureManager::textureMap{};
void TextureManager::addTexture(const string& _name, const string& _filePath)
{
if (textureMap.find(_name) != textureMap.end()) {
return;
}
// textureMapの中から探して見つからなかった場合追加する... |
#include "MenuWidget.h"
#include "MenuButton.h"
#include <qlayout.h>
MenuWidget::MenuWidget(QStackedWidget* stack): QWidget()
{
this->setMinimumSize(400, 80);
this->setMaximumHeight(80);
this->setStyleSheet("border: 1px solid black");
QHBoxLayout* hlayout = new QHBoxLayout();
hlayout->setSpacing(0);
MenuButton... |
#include "opennwa/Nwa.hpp"
#include "opennwa/construct/complement.hpp"
#include "opennwa/construct/determinize.hpp"
namespace opennwa
{
namespace construct
{
NwaRefPtr complement( Nwa const & source )
{
NwaRefPtr nwa( new Nwa());
complement(*nwa, source);
return nwa;
}
/**... |
#include "opencv2/opencv.hpp"
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <iterator>
#include <string>
#include <vector>
#ifndef QUATERNARYMASK_H
#define QUATERNARYMASK_H
class quaternaryMask
{
public:
quaternaryMask(){}
int blackLMax, whiteLMin, greenHMean, greenHVar, greenSMin;
... |
//
// calcRatio.cpp
// main
//
// Created by Wilfried Kamga on 2017-12-01.
//
#include "common.hpp"
using namespace tp3;
float calcRatio(const cv::Mat& imgBinaireDilate, const cv::Mat& imgBinaire)
{
CV_Assert(!imgBinaire.empty() && imgBinaireDilate.type() == CV_8UC1 && imgBinaireDilate.isContinuous());
CV_... |
// Persistent Dialog
//
// Copyright (C) 2008
// Center for Perceptual Systems
// University of Texas at Austin
//
// Wed Jul 2 09:22:47 CDT 2008
#ifndef PERSISTENT_DIALOG_H
#define PERSISTENT_DIALOG_H
#include <QDebug>
#include <QDialog>
#include <QMoveEvent>
#include <QSettings>
#include <QShowEvent>
namespace fl... |
#include<iostream>
using namespace std ;
int main() {
string cars[5] = {"BMW", "Skoda", "RangeRover", "Lamborghini", "Ford"} ;
cout << cars[0] << endl;
cars[0] = "Ferrai";
cout << cars[0] << endl;
for(int i = 0 ; i<5; i++) {
cout<<cars[i]<<endl;
} ... |
#ifndef ADMIN_H_
#define ADMIN_H_
class Admin : public User
{
;
};
#endif |
/* stupid way, consider all cases
class Solution {
public:
string addBinary(string a, string b) {
int len1 = a.size(), len2 = b.size();
if(len1 > len2) swap(a,b);
stack<char> ans;
int left = 0;
int i = a.size()-1, j = b.size()-1;
for(; i >= 0; --i, --j){
i... |
#ifndef BOOST_ASTRONOMY_COORDINATE_ICRS_HPP
#define BOOST_ASTRONOMY_COORDINATE_ICRS_HPP
#include <string>
#include <boost/astronomy/coordinate/base_equatorial_frame.hpp>
namespace boost
{
namespace astronomy
{
namespace coordinate
{
template <typename RepresentationDegreeOrRadian =... |
/*
************************************************
***Author: SheepTAO
***File description: 顺序查找的基本操作
************************************************
*/
#include <iostream>
using std::cout;
using std::endl;
using std::cin;
using ElemType = int;
typedef struct {
ElemType *data;
size_t tableLen;
}SSTable;
v... |
/*2072*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
vector<string> Table;
int string_in_table(const string &s)
{
for (int i = 0; i < Table.size(); i++)
{
if (s == Table[i])
return i;
}
return -1;
}
int main()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.