text
stringlengths
8
6.88M
// Copyright (C) 2017 Elviss Strazdins // This file is part of the Ouzel engine. #include "GUISample.h" #include "MainMenu.h" using namespace std; using namespace ouzel; GUISample::GUISample(): backButton(new gui::Button("button.png", "button_selected.png", "button_down.png", "", "Back", "arial.fnt", Color::BLAC...
#pragma once #include <memory> #include <vector> #include "entity.h" #include "util.h" using std::shared_ptr; using std::vector; namespace lab3 { class Actor; class CarriedItem; class Game; class Tile; class PhysicalEntity : public Entity { protected: WorldCoord position; public: Phy...
// Datastructures.cc #include "datastructures.hh" #include <random> #include <cmath> #include <algorithm> #include <iostream> #include <queue> #include <string> #include <vector> #include <utility> #include <limits> #include <unordered_map> #include <memory> #include <set> #include <unordered_set> #include <map> #i...
#ifndef INCLUDE_VAR_H #define INCLUDE_VAR_H /// @file include/Var.h /// @brief Var のヘッダファイル /// @author Yusuke Matsunaga (松永 裕介) /// /// Copyright (C) 2005-2011 Yusuke Matsunaga /// All rights reserved. #include "bb_nsdef.h" BEGIN_NAMESPACE_YM_BB //////////////////////////////////////////////////////////////////...
#pragma once #include<string> #include<iomanip> #include<iostream> using namespace std; class AktivesVO { public: AktivesVO(); AktivesVO(string namestr); virtual ~AktivesVO(); void virtual vostreamAusgabe(ostream& out); virtual void vAbfertigung() = 0; void vInitialization(); string returnName(); bool opera...
/* Problem : Input 2 integer A and B, then printout A+B Condition : Input is consist of several testcases. each testcase is one line, and A and B is input(0<A,B<10). two zeros input means the end of testcase. Example -Input 1 1 2 3 3 4 9 8 5 2 0 0 -Output 2 5 7 17 7 */ #include<iostream> using namespace std; int mai...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "Windows.Management.Policies.2.h" WINRT_EXPORT namespace winrt { namespace Windows::Management::Policies { struct NamedPolicy { NamedPolicy() = delete; static Windows::Manag...
#ifndef WIZSEARCHINDEXER_H #define WIZSEARCHINDEXER_H #include <QTimer> #include <QMap> #include "wizClucene.h" #include "wizDatabaseManager.h" class CWizSearchIndexer : public QObject , public IWizCluceneSearch { Q_OBJECT public: explicit CWizSearchIndexer(CWizDatabaseManager& dbMgr, QObje...
class Solution { public: static int romanCharToNum(char s) { switch (s) { case 'M': return 1000; case 'D': return 500; case 'C': return 100; case 'L': return 50; case ...
/* 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> #include<math.h> using namespace std; class Complex { double real; double imaginary; public: Complex() { real = 0; imaginary = 0; } Complex(double r) { real = r; imaginary = 0; } Complex(double r, double i) { real = r; imaginary = i; } Complex(Complex &c) { real = c.real;...
/* =============================================================================== FILE: floatcompressornew.cpp CONTENTS: see corresponding header file PROGRAMMERS: martin isenburg@cs.unc.edu COPYRIGHT: Copyright (C) 2000 Martin Isenburg (isenburg@cs.unc.edu) ...
#ifndef simple_factory_h #define simple_factory_h // Copyright (c) 2009 Roger Pate. See LICENSE for details. #include <map> #include <memory> #include <stdexcept> #include <string> namespace kniht { template<class KeyT, class RTypeT, class CreatorT=RTypeT (*)()> struct BasicFactory { typedef KeyT Key; typedef ...
#ifndef __Enemy_H__ #define __Enemy_H__ #include "cocos2d.h" USING_NS_CC; //! 创建敌人的工厂方法 class Enemy :public CCNode { public: Enemy(); ~Enemy(); static Enemy *create(); void bindEnemySprite(CCSprite *sp, int life); CCSprite *getSprite(); int getLife(); void loseLife(); CCRect ...
#pragma once #include "MonoBehavior.h" #include <SFML/Graphics.hpp> #include <vector> class Player; class Ball; class GameManager : public MonoBehavior { private : static GameManager* instance; GameManager(); //GameRelated sf::Sprite backGroundSprite; sf::Texture backGroundTexture; std::vector<Ball*> balls; ...
#include "../Include/Trianglef.h" #include "../Include/settingList.h" Trianglef::Trianglef() { requiredClicks = 1; } bool Trianglef::isGrabbed(int x, int y) { float centerX = (startPosX + endPosX) / 2; float centerY = (startPosY + endPosY) / 2; int length = endPosX > startPosX ? endPosX - startPosX : startPosX ...
#include <iostream> #include <set> #include <vector> using namespace std; int main() { int n,B,SG,SB,LSG,LSB,aux; multiset<int> LSGs; multiset<int> LSBs; vector<int> battle; multiset<int>::iterator it_SG; multiset<int>::iterator it_SB; cin>>n; while(n>0){ cin>>B>>...
// Copyright (c) 2012-2013, the Scal Project Authors. All rights reserved. // Please see the AUTHORS file for details. Use of this source code is governed // by a BSD license that can be found in the LICENSE file. // Implementing the k-stack from: // // T. A. Henzinger, C. M. Kirsch, H. Payer, and A. Sokolova. Quant...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once WINRT_EXPORT namespace winrt { namespace ABI::Windows::Gaming::Input { struct ArcadeStickReading; struct FlightStickReading; struct GamepadReading; struct GamepadVibration; struct RacingWhee...
//@@author A0112218W #include "Command_Import.h" ImportCommand::ImportCommand(std::string filePath) : Command(CommandTokens::PrimaryCommandType::Import) { if (filePath.empty()) { throw COMMAND_CREATION_EXCEPTION(MESSAGE_IMPORT_INVALID_FILEPATH); } _filePath = filePath; } UIFeedback ImportCommand::execute(RunTim...
#ifndef __SHELTER_H #define __SHELTER_H #include<vector> #include<string> #include "animal.h" class Shelter{ public: Shelter(std::string name); Shelter(); std::string name(); void add_animal(Animal& animal); int num_animals(); Animal& animal(int index); private: std::string _name; std::vector<Animal*> _availa...
/*********************************************************************** created: 21/2/2004 author: Paul D Turner purpose: Defines abstract base class for WindowFactory objects *************************************************************************/ /********************************************...
#pragma once #include "data/node.h" #include "data/datafactory.h" #include "data/syntaxer.h" #include "data/stage.h" #include "data/object_id.h" #include "data/Collector.h" ////////////////////////////////////////////////////////////////////////// #include "channel_sheme.h" namespace nodes { struct grader_result...
#include "particula_fantasma_bonus_salud.h" using namespace App_Juego_ObjetoJuego; Particula_fantasma_bonus_salud::Particula_fantasma_bonus_salud(float x, float y, float tv, float ve) :Particula_fantasma(x, y, tv, ve) { } unsigned short int Particula_fantasma_bonus_salud::obtener_profundidad_ordenacion()const { r...
#include "mainwindow.h" #include "hielist.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->output->setWordWrap(true); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_start_clicked() { st...
#pragma once #include "DrawingObject.h" #include "DrawingText.h" #include "DrawingRect.h" #include "Logic.h" #include "LogicEvent.h" using namespace std; class DrawingMenuItem :public DrawingObject { public: DrawingMenuItem(void); DrawingMenuItem(std::string name); ~DrawingMenuItem(void); virtual void Draw( sf::R...
/**---------------------------------------------------------------------------- * injector_x64.cpp *----------------------------------------------------------------------------- * *----------------------------------------------------------------------------- * All rights reserved by ERAM (teseonic@gmail.com) *---------...
/******************************************************************************* * Cristian Alexandrescu * * 2163013577ba2bc237f22b3f4d006856 * * 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ...
#include "rps.h" int main( ) { initializeRandomNumbers( ); bool play = true; int WIN = 0; int LOSE = 0; int TIES = 0; while (play) { int computer = getRandomPlayerChoice( ); int player = getUserPlayerChoice(std::cin, std::cout); if ( player != 0 ) { int win = determineWinner(player, computer); if ...
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { int t; cin>>t; while(t--){ ll row,col,first_element; cin>>row>>col; if(row==col) cout<<(row*row)-(row-1)<<"\n"; else if(row>col) { if(row%2==0) { firs...
// Copyright 2013 ESRI // // All rights reserved under the copyright laws of the United States // and applicable international laws, treaties, and conventions. // // You may freely redistribute and use this sample code, with or // without modification, provided you include the original copyright // notice and ...
/* * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de> * SPDX-License-Identifier: BSD-3-Clause */ #ifndef CUTELYSTVALIDATORTIME_H #define CUTELYSTVALIDATORTIME_H #include "validatorrule.h" #include <Cutelyst/cutelyst_global.h> namespace Cutelyst { class ValidatorTimePrivate; /*! * ...
#include <iostream> #include <cmath> long long factorial(int a) { long long f; if (a == 1 || a == 0) { f = 1; } else { f = a * factorial(a - 1); } return f; } long long binomial (int n, int r) { long long C=1; if (r==0 || n==r) return C; els...
#include "CodeViewer.h" #include <iostream> CodeViewer::CodeViewer() { } CodeViewer::~CodeViewer() { } void CodeViewer::LoadFromStream(POLE::Stream* pStream) { int len; pStream->read((unsigned char*)&len, sizeof(int)); char* pText = new char[len + 1]; memset(pText, 0, len + 1); pStream->read((unsigned char*)...
#pragma once #include <vector> #include <string> #include <fstream> #include "UtilsLight.h" #include <cassert> #include <tuple> #include <functional> #include <array> // auto/autoreadonly * type/name/init static int maxprops[2][3]; static const std::string sep = "\n"; enum TrimOptions :unsigned char { LForceWS ...
#ifndef NOTE_ABS_H #define NOTE_ABS_H #include <QDialog> namespace Ui { class Note_Abs; } class Note_Abs : public QDialog { Q_OBJECT public: explicit Note_Abs(QWidget *parent = nullptr); ~Note_Abs(); private slots: void on_pushButton_afficher_3_clicked(); void on_pushButton_ajouter_3_clicked()...
#include <DHT.h> #include <LiquidCrystal.h> DHT mydht(A1, DHT11); LiquidCrystal lcd(12, 11, 4, 5, 6, 7); void setup() { Serial.begin(9600); mydht.begin(); lcd.begin(16,2); } void loop() { // 조소 데이터 읽기 int photoVal = analogRead(A0); Serial.print("빛의 세기 : "); Serial.println(photoVal); // DHT11 온습...
#include "FragTrap.hpp" #include "ScavTrap.hpp" #include "NinjaTrap.hpp" int main(void) { FragTrap a; FragTrap* b = new FragTrap("Billy"); FragTrap c = FragTrap(*b); FragTrap d = FragTrap("Tommy Cino"); a.rangedAttack("Billy"); b->takeDamage(a.getRangeDamage()); b->meleeAtta...
#include "TriMesh.h" #include "meshFIM.h" #include "math.h" #include "tinyxml.h" #include <iostream> #include <sstream> #include <string> #include "vnl/vnl_vector.h" #include <vtkVersion.h> #include <vtkPoints.h> #include <vtkPolyData.h> #include <vtkPointData.h> #include <vtkCellArray.h> #include <vtkTriangle.h> #in...
#include <bits/stdc++.h> #define ll long long const ll MOD = 1000000007; const ll INF = 1e18; using namespace std; template<typename T> void print(const T& t) { std::copy(t.cbegin(), t.cend(), std::ostream_iterator<typename T::value_type>(std::cout, " ")); cout << endl; } template<typename T> void print2d(const T& ...
#include <GL\glew.h> #include "RenderBuffer.h" RenderBuffer::RenderBuffer() { glGenRenderbuffers(1, &value); } RenderBuffer::~RenderBuffer() { glDeleteRenderbuffers(1, &value); } RenderBuffer * RenderBuffer::bind() { glBindRenderbuffer(GL_RENDERBUFFER, value); return this; } const RenderBuffer * RenderBuffer::...
#include <iostream> using namespace std; int main () { int input; while ( true ) { cout << ">> " << flush; cin >> input; switch ( input ) { case 0: return input; break; case 1: case 2: case 3: ...
#ifndef MONTICULO_H #define MONTICULO_H #include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <fstream> #include <cmath> #include "NodoComparable.h" using namespace std; template <class T> class Node : public NodoComparable<T>{ private: public: int getID(); T ge...
/*=auto========================================================================= Portions (c) Copyright 2009 Brigham and Women's Hospital (BWH) All Rights Reserved. See Doc/copyright/copyright.txt or http://www.slicer.org/copyright/copyright.txt for details. Program: 3D Slicer Module: $RCSfile: vtkMRMLConnector...
#ifndef FOOD_H #define FOOD_H #include <string> #include "order.h" //eloetelek, levesek, foetelek(haletelek, szarnyasetelek, marhaetelek), salatak class Food : public Order { private: public: Food(std::string _name, float _price); Food(const Food& _food); Food(Food&& _food); const Food& operator=(const Fo...
#include <iostream> #include <vector> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; vector<TreeNode *> createTrees(int start, int end); vector<TreeNode *> generateTrees(int n) { return createTrees(...
// // Created by ZV on 15.05.2018. // #ifndef CHECK_B_HPP #define CHECK_B_HPP #include <iostream> const int a = 10; void print(); #endif //CHECK_B_HPP
// github.com/andy489 #include <iostream> #include <vector> #include <set> using namespace std; int beautifulPairs(const vector<int>& a, multiset<int>& ms, int n) { int bp(0); for(const int& el:a){ multiset<int>::iterator it=ms.find(el); if(it!=ms.end()){ ++bp; ms.erase...
#include <iostream> const int Max = 5; // function prototype double * fill_array(double *, int); void show_array(double *, double *); void revalue(double, double *, double *); using namespace std; int main(void) { double properties[Max]; // fill array double * end = fill_array(properties, Max); // ou...
//////////////////////////////////////////////////////////////////////////////// // // 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 ...
/**LAB WEEK 6: DRAWING EVENTS * CS3210 * @author Dennis Droese * @file main.cpp * @date April 18, 2018 */ /* * A simple driver program for drawing shapes n' stuff */ #include "x11context.h" #include "shape.h" #include "image.h" #include "viewcontext.h" #include "dynamicdraw.h" #include <unistd.h> #include <sst...
#pragma once #include "allocator.h" namespace lu { struct LinearAllocator : public IAllocator { LinearAllocator() : pBufferHead(NULL), pBufferTail(NULL), capacity(0) {} void initialize(byte_t* pBuffer, uint64_t bufferSize); void finalize(); virtual void* allocate(uint64_t size) override; virtual void* a...
// Copyright 2020 JD.com, Inc. Galileo 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 requ...
// // Created by chloe on 01/06/18. // #include "../../header/List.h" List::List(const int n) : Graph(n) { neighbor = new std::set<int>[getNodeCount()]; } void List::addEdge(const int t, const int h) { neighbor[t].insert(h); edgeCount++; } void List::printGraph() { for (int i = 0; i < getNodeCount()...
#ifndef _TNA_GUI_TASKING_WIDGET_H #define _TNA_GUI_TASKING_WIDGET_H value namespace tna { /** * \brief Renders the tasking widget */ void tasking_widget_render(); } /* tna */ #endif /* ifndef _TNA_GUI_TASKING_WIDGET_H */
#include <iomanip> #include <iostream> float ilit1, ilit2; int in; using namespace std; int main() { setlocale(LC_CTYPE, "Russian"); printf("Введите количество литров воды в первом сосуде: "); cin >> ilit1; printf("Введите количество литров воды в первом сосуде: "); cin >> ilit2; if (ilit1 <= 0 || ilit2 <= 0) { ...
/** * 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 <iostream> #include <windows.h> #include "MyList.h" #include "Node.h" #include "Bin.h" #include "Heap.h" #include "HeapNode.h" using namespace std; template <typename B> Node<B>::Node(const B& t) { this->data = t; this->next = nullptr; } template <typename T> MyList<T>::MyList(int capacity) { this->capac...
// // algorithms.hpp // vulpes // // Created by lcl on 2018/7/19. // Copyright © 2018 lcl. All rights reserved. // #ifndef algorithms_hpp #define algorithms_hpp #include <vector> using namespace std; namespace vulpes { namespace algorithms { void insert_sort(vector<int>& array); void select_...
#ifndef SERVERCONNECTOR_H #define SERVERCONNECTOR_H #include <QObject> #include <QUrl> #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkReply> #include <QEventLoop> #include <QTextCodec> #include <QUrlQuery> class GetConfigClass : public QObject { Q_OBJEC...
#include <iostream> #include <set> using namespace std; int main(int argc, char *argv[]) { set<int> set1; set1.insert(3); set1.insert(1); set1.insert(2); set<int>::iterator it; for (it = set1.begin();it != set1.end();it++) { cout << *it << endl; } return 0; }
// // Copyright (C) 2018 Ruslan Manaev (manavrion@yandex.com) // This file is part of the Modern Expert System // #include "Question.h" using namespace mes_core; using namespace nlohmann; using namespace std; const string kTextJson = "text"; const string kAnswersJson = "answers"; const string kPropertyJson = "proper...
#include<stdio.h> #include<stdlib.h> #define size 5 struct pqueue { int data; int key; }; struct pqueue queue[size]; int front=-1,rear=-1; void insert() { struct pqueue info; int i=0; if(rear==size-1) { printf("\nqueue is full"); return; } if(front==-1) { front =rear=0; //front element printf...
#include <iostream> #include <vector> #include <cstring> #include <algorithm> using namespace std; struct Tree_Info { int x1, x2, y, idx; }; int N, Q, A, B; Tree_Info Tree[100001]; int Group[100001]; bool Standard(Tree_Info T1, Tree_Info T2) { if(T1.x1 == T2.x1) return T1.x2 > T2.x2; return T1.x1 < T2.x1...
#ifndef FLOW_GRAPH_NULLARYNODE_HPP #define FLOW_GRAPH_NULLARYNODE_HPP #include "graph/node.hpp" namespace flow { class NullaryNode : public Node { public: NullaryNode() = delete; NullaryNode(const std::string &name); virtual ~NullaryNode(); std::vector<NodePtr> getChildren() const final override; }; } ...
#ifndef PLAYER_H #define PLAYER_H_ #include <QImage> #include <QRect> class player { public: player(int, int, int); ~player(); void moveUp(int); //MOVE UP void moveDown(int); //MOVE DOWN void moveTo(int, int); //MOVE TO (DX/DY) ...
#ifndef Timer_h #define Timer_h #include <FreeRTOS.h> class Timer { private: float period; float period_micros; unsigned long int last_time_micros; unsigned long int current_time_micros; unsigned long int start_time_micros; public: Timer(float period_); ~Timer(); void start(); fl...
/* * File: hlogviewer.h * Author: phrk * * Created on May 30, 2013, 2:46 AM */ #ifndef HLOGVIEWER_H #define HLOGVIEWER_H #include <string> #include <vector> using namespace std; #include "mongo.h" class LogEvent { public: string node; int type; string event; LogEvent(const string node, ...
/* * FstreamC.cpp * * Created on: May 21, 2012 * Author: marchi */ #include "FstreamC.h" void FstreamC::seekg(off_t n,string x){ try{ FILE * fp=gmx_fio_getfp(fin); if(x.find("beg") != string::npos) fseeko(fp,n,SEEK_SET); else if(x.find("end") != string::npos) fseeko(fp,n,SEEK_END); else if(x....
#ifndef OCTREE_H_ #define OCTREE_H_ #include "MathGeoLib/include/Geometry/AABB.h" #include "CubeLine.h" #include "GameObject.h" #include "ComponentTransform.h" #include <list> #include <map> #define MAX_BUCKET_SIZE 6 #define MAX_SUBDIVISION 15 /* ----------- MaxPoint | NW | NE | |---------| | SW | SE | ----...
/* Student: Alvaro Chavez Mixco Date: Monday, October 19 , 2015 course: GAM1546-Games and Graphics Computations II Professor: Jimmy Lord Purpose: Draw all the particles of a single type, this is done uisng dynamic vertices December 1: =Adapted code from class to file December 6: n ParticleRenderer.cp...
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // # DARK PLUGIN - POWERED BY FIRE TEAM // # GAME SERVER: 99.60T (C) WEBZEN. // # VERSÃO: 1.0.0.0 // # Autor: Maykon // # Skype: Maykon.ale //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // # O Sen...
//evaluates systematic uncertainties by varying values in the Geant. //Isaac Mooney, 11/11/2018 #include "params.hh" #include "funcs.hh" #include "RooUnfold.h" #include "fastjet/contrib/SoftDrop.hh" using namespace fastjet; using namespace std; using namespace Analysis; typedef fastjet::contrib::SoftDrop SD; // ---...
#ifndef ADMINISTRATOR_H #define ADMINISTRATOR_H #include <QFile> #include <QTextStream> #include <QList> #include "employee.h" class Administrator : public Employee { public: Administrator(QString fio, size_t uniqueNumber, QString login, QString password, QString department = ""); ~Admini...
#include "EventLoop.h" #include <unistd.h> #include "Channel.h" #include "Poller.h" #include "ThisThread.h" #include "Socket.h" USE_NAMESPACE [[maybe_unused]] constexpr int PollTimeMs = 10000; // must create in loop thread EventLoop::EventLoop() : running_(false), eventHandling_(false), ...
#include "Event.h" #include "Passenger.h" Event::Event(EventType type, unsigned long timestamp, Passenger* passenger) { this->type = type; this->timestamp = timestamp; this->passenger = passenger; } std::ostream& operator<<(std::ostream& os, const Event& event) { std::string type = getEventTypeName(e...
// // FuncCutout.h // SMFrameWork // // Created by SteveMac on 2018. 6. 25.. // #ifndef FuncCutout_h #define FuncCutout_h #include "../ImageProcess/ImageProcessFunction.h" #include "CutoutProcessor.h" #include <zlib.h> class DataHolder : public cocos2d::Ref { public: DataHolder(uint8_t* data, size_t dataLen) ...
/* @Copyright:LintCode @Author: goni0202 @Problem: http://www.lintcode.com/problem/sort-colors @Language: C++ @Datetime: 16-08-13 13:47 */ class Solution{ public: /** * @param nums: A list of integer which is 0, 1 or 2 * @return: nothing */ void sortColors(vector<int> &nums) { ...
#include "CWEMotion.h" #include "CWEMath.h" namespace CWE { // コンストラクタ Motion::Motion(): mHandle(), mResource(Resource::GetInstance()), mOldFrame(0.0f) { } // コピーコンストラクタ Motion::Motion(const Motion& original): mHandle(), mResource(Resource::GetInstance()), mOldFrame(0.0f) { mHandle =mResource.CopyMotionHandl...
#include <bits/stdc++.h> using namespace std; #define ll long long ll MOD = (ll)1e9; struct Node { ll y, sz, x, sum_; Node *left, *right; Node() {} Node(ll x) { this->x = this->sum_ = x; this->y = ((rand() << 15)^rand()); this->left = (this->right) = nullptr; this->sz ...
// Copyright 2020 JD.com, Inc. Galileo 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 requ...
#include "Map.h" #include <BWEM/bwem.h> #include "BlackCrow.h" namespace BlackCrow { using namespace BWAPI; using namespace Filter; Map::Map(BlackCrow &parent) : bc(parent) { tileWidth = Broodwar->mapWidth(); tileHeight = Broodwar->mapHeight(); mapTiles = std::vector<std::vector<Cell>>(tileWidth, std::vect...
/* primitives.h -*- C++ -*- Rémi Attab (remi.attab@gmail.com), 26 Mar 2014 FreeBSD-style copyright and disclaimer apply Include headers for all primitive types. */ #pragma once #include "reflect.h" #include "dsl/type.h" #include "pointer.h" /*********************************...
#include "info_obstaculos_genericos.h" using namespace App_Lectores; Info_obstaculos_genericos::Info_obstaculos_genericos(const std::string& ruta) { cargar(ruta); } void Info_obstaculos_genericos::cargar(const std::string& ruta) { DLibH::Lector_txt L(ruta, '#'); if(!L) { LOG<<"ERROR: Imposible localizar fiche...
// Copyright Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ========================================================================...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int ans = 0, cnt = 1; string a; cin>>a; char prev = a[0]; for(int i=1; i<n; i++) { if(a[i]==prev) cnt++; else { prev = a[i]; ans += cnt-1; cnt = 1; } } ans += cnt-1; cout<<ans<<endl; }
#ifndef CO_SYNC_H #define CO_SYNC_H #include "namespdef.h" NAMESP_BEGIN namespace net { /* template<Socket> int async_read(Socket& s, MsgSt& msg){ auto ret = co_async_read(s, msg); return ret.get(); } template<Socket> int async_write(Socket& s, MsgSt& msg){ auto ...
#include<iostream> using namespace std; int check(int num, int * ptr) { int a, b, c; a = num / 100; b = (num % 100)/10; c = (num % 100) % 10; int num1 = a - b, num2=b - c; if (num1 == num2) { *ptr += 1; return 0; } else { return 0; } } int main() { int num; cin >> num; if (num < 100) { cout << num; }...
#include <iostream> #include <vector> #include <utility> #include <cstdlib> #include <string> #include <fstream> #include <iomanip> #include <sstream> using namespace std; class location{ public: int col; int row; vector<int> trash; }; class sudoku{ public: //these two vectors have to be available to t...
#ifndef REPORTDIALOG_H #define REPORTDIALOG_H #include <QDialog> #include <QList> #include "users.h" #include "administrator.h" #include "supervisor.h" namespace Ui { class ReportDialog; } /** * @brief Класс отчётности рабочих */ class ReportDialog : public QDialog { Q_OBJECT public: /** * @brief Конс...
#ifndef SPAN_SRC_SPAN_IO_STREAMS_FD_HH_ #define SPAN_SRC_SPAN_IO_STREAMS_FD_HH_ #include <memory> #include "span/Common.hh" #include "span/io/streams/Stream.hh" namespace span { namespace fibers { class Scheduler; } // namespace fibers namespace io { class IOManager; namespace streams { cl...
#pragma once #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "WeaponActor.generated.h" DECLARE_DYNAMIC_MULTICAST_DELEGATE(FReloadStarted); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FReloadFinished); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPlayWeaponEffect); UENUM(BlueprintType) enum class EWeaponType : uint8...
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "allheaders.h" #include "customvector.h" #include "HashTable.h" #include <qtmaterialslider.h> #include <qtmaterialradiobutton.h> #include <qtmaterialtoggle.h> #include <qtmaterialtextfield.h> #include <qtmaterialscrollbar.h> #include <qtmateri...
int Solution::solve(vector<int> &a, int k) { int n=a.size(); int l=0,h=n-1,m; int ans=0; while(h>=l) { m=l+(h-l)/2; if(a[m]>k) h=m-1; else { l=m+1; ans=m+1; } } return ans; }
#include <stdio.h> #include<conio.h> #include <string.h> #include<graphics.h> char mat[3][3]={'1','2','3','4','5','6','7','8','9'}; char player1[20],player2[20]; int count=0; void drawboard(){ int i,j; for(i=0;i<3;i++){ printf("\t|"); for(j=0;j<3;j++){ printf(" %c |",mat[i][j]); ...
/** * [Question] * - 再帰を使わずに帰りがけ順で、二分木の走査を行うにはどうすればよいですか? * * [Solution] * - スタックで実装 * - 訪れたノードが leaf かどうか判定する * - leaf であれば表示 * - leaf でなければ,左右の子をスタックに追加してからそのノードを leaf にする * - leaf->left = NULL; * - lear->right = NULL; * * [Note] * - postorder の iterativ...
//Programmer: Ryan Hoffman //Date: 1/27/14 //description: holds the functions for the AI class and its friend funcs #include "game.h" ////////////////////////////////////////////////////////////////////////// // Public functions ///////////////////////////////////////////////////////...
/* *********************************************************** * JLMD++ A C++ version of LJMD motived by LAMMPS. * * http://sites.google.com/site/akohlmey/software/ljmd * and http://lammps.sandia.gov/ * * Some routines are taken in whole or in part from LJMD * or LAMMPS. This software is distributed under the ...
#ifndef OPERATEURDROP_H #define OPERATEURDROP_H #include "../headers/operateur.h" #include "../headers/pile.h" #include "../headers/expressionmanager.h" /// /// \brief Retire la dernière Expression de la Pile /// class OperateurDrop : public Operateur { friend class ExpressionManager; private: /// /// \b...
#pragma once #if !defined(_Debug_New_Defined_) #define _Debug_New_Defined_ #if defined(_DEBUG) #include<crtdbg.h> static class CRT_MEMORY_CHECK { public: CRT_MEMORY_CHECK() { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); } }_crt_memory_check; void* operator new(size_t size, const char* filename...