text
stringlengths
8
6.88M
#include "ShaderManager.h" namespace liman { ShaderManager::~ShaderManager() { m_shaders.clear(); m_shaderList.clear(); } bool ShaderManager::CreateShader(std::string shaderStr) { auto findIt = m_shaders.find(shaderStr); if (findIt == m_shaders.end()) { LOG("ShaderManager", "Creating shader " + shaderS...
#include "../inc.h" struct Solution1 { //O(N^2) int solve(long long c, const vector<long long> & a, const vector<long long> & b){ C = c; A = a; B = b; int ret = 0; for (size_t i = 0; i < A.size(); ++i) if (canFrom(i)) ++ret; ...
#include <math.h> #include <RcppArmadillo.h> extern "C"{ void sadmvn_(int *n, double *lower, double *upper, int *infin, double *correl, int *maxpts, double *abseps, double *releps, double *error, double *value, int *inform ); }; // ordre parametres: // submod1, .., submodK, covRE, seuil1, g...
#include <stdio.h> int MSS(int[], int); int MSS1(int[], int); int MSS2(int[], int); int MaxSubseqSum3(int[], int); int main() { freopen("in.txt", "r", stdin); int n; int a[100000]; scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", a+i); } printf("%d", MSS(a, n)); return 0; } int MSS(int seq[], int...
#include "LayerGameOver.h" #include "AppMacros.h" #include "LayerGameMain.h" #include "Plane.h" CCScene * LayerGameOver::scene() { CCScene * scene = CCScene::create(); LayerGameOver * layer = LayerGameOver::create(); scene->addChild(layer); return scene; } bool LayerGameOver::init() { CCLayer::init(); C...
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <fstream> #include <cstring> #include<iomanip> #include<string> #include<cmath> #include "Header.h" using namespace std; const int MAX = 30; const char Tmp_fileName[] = "buff.txt"; //name of a buffer-file which is used to convert a double number ...
// // Created by wqy on 19-12-17. // #include "SignalAction.h" using namespace esc; int SignalAction::getID() { return 2; }
#include <WiFi.h> #include <stdio.h> #include <AzureIoTHub.h> #include <apps/sntp/sntp.h> #include "blink.h" #include "logging.h" #include "device_configuration.h" #include "iot_device_core.h" #include "iot_device_connection.h" #ifndef IOTDEVICE_PROTOCOL_MQTT #define IOTDEVICE_PROTOCOL_MQTT #endif #define IOTDEVICE...
#include "lista.h" void wczytaj_liste(string nazwa , Lista *&glowa, int & ilosc ) { ilosc=0; ifstream plik; Lista *akt, *ogon; akt=NULL; glowa=NULL; do_wczytania( nazwa.c_str() , plik ); while( !plik.eof() ) { ogon=akt; akt=new Lista; plik>>akt...
#ifndef APPLIANCE_H #define APPLIANCE_H #include <iostream> #include <fstream> #include <string> #include <cstdlib> #include <ctime> #include <vector> using namespace std; //========================================= //== Global Variables (settings) // string DELIM = "------------------------------------------"; /...
#include "Edge.h" Edge::Edge() { src=dst=0; cost = 0.0f; } Edge::Edge( GraphNode *sourceNode, GraphNode *destinationNode, float theCost ) { src = sourceNode ; dst = destinationNode ; cost = theCost ; }
// counting sort // _ ____ __ _ _ __ // (_/_(_(_(_)(__ / (_(_/_(_(_(_/__(/_/ (_ // /( .-/ .-/ // (_) (_/ (_/ #include "../_library_sort_.h" // Độ phức tạp: // Best: O(n + k) | Avarage: O(n + k) | Worst: O(n + k) | Memory: O(n + k) | Stable...
#include "ExitGame.h" ExitGame::ExitGame() : std::exception("Thank you for playing the game. Goodbye!\n") { }
#include <evdsptc.h> #include "evdtest.h" #include <stdio.h> #include <assert.h> #include <fcntl.h> #include <sys/stat.h> #include <CppUTest/CommandLineTestRunner.h> #include <CppUTest/TestHarness.h> #include <CppUTestExt/MockSupport.h> #define USLEEP_PERIOD (10000) #define NUM_OF_USLEEP (10) extern "C" { extern ev...
#ifndef RODINBTNODEACTIONDECORATOR_H #define RODINBTNODEACTIONDECORATOR_H #include "rodinbtnodedecorator.h" #include "array.h" class WBAction; class RodinBTNodeActionDecorator : public RodinBTNodeDecorator { public: RodinBTNodeActionDecorator(); virtual ~RodinBTNodeActionDecorator(); DEFINE_RODINBTNODE_FACTORY( ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; int a[n], dp[n][2]; for(int i=0; i<n; i++) cin>>a[i]; dp[0][0] = 0; dp[0][1] = 0; for(int i=1; i<n; i++) { dp[i][0] = dp[i-1][1]+a[i-1]-1; dp[i][1] = max(a[i]-1+dp[i-1][0], abs(a[i]-a[i-1])+...
// // Created by matan on 1/14/20. // #ifndef SOLID_SERVER_REDO_ISEARCHABLE_H #define SOLID_SERVER_REDO_ISEARCHABLE_H #include "../State.h" #include "../Position.h" #include <vector> using namespace std; template<class Position> class ISearchable { public: virtual State<Position> *getInitialState() = 0; vi...
#include "../include/puzzle.h" enum puzzle::zero_movement puzzle::oppositeMovement(enum puzzle::zero_movement dir) { switch(dir) { case puzzle::ZERO_UP: return puzzle::ZERO_DOWN; case puzzle::ZERO_DOWN: return puzzle::ZERO_UP; case puzzle::ZERO_LEFT: return puzzle::ZERO_RIGHT; case puzzle::ZERO_RIGH...
/* 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 "Compiler.h" void Compiler::GenerateTokens(const char* input_file, const char* output_file, const char* id_table, const char* label_table) { Compiler::LexicalUnit::CLexicalUnit clu; clu.GenerateTokens(input_file, output_file, id_table, label_table); }
#include<iostream> #include<bits/stdc++.h> using namespace std; int main() { string str1 = "3333311111111111"; string str2 = "44422222221111"; reverse(str1.begin(), str1.end()); reverse(str2.begin(), str2.end()); cout<<str1<<endl<<str2; strigstream ss1(str1); strigstream ss2(str2); string temp,temp2; string s...
#include "searcha.h" /* A collection of graph search algorithms. The graph is unweighted and directed and represented as an adjacency list, al. The variable al is a vector of vetors */ #include <iostream> #include <stack> #include <queue> using namespace std; /* Perform breadth-first-search. */ void bfs ( const vec...
/* * WordGenerator.h * * Created on: Nov 11, 2013 * Author: vbonnici */ /* * the same of DNA4WordGenerator but can input/output words in std::string type */ #ifndef WORDGENERATOR_H_ #define WORDGENERATOR_H_ namespace dolierlib{ class WordGenerator{ int k; int m; dna5_t *dkmer; dna5_t *ckmer; ...
/* * SPDX-FileCopyrightText: 2019 Rolf Eike Beer <eike@sf-mail.de> * * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once #include "cache_set.h" struct relation_object_replacer { osm_t * const osm; const object_t &old; const object_t &replace; relation_object_replacer(osm_t *o, const object_t &t, ...
#include "player.h" #include <string> #include <iostream> player::player(){ name="Reimu Harukei"; hpstat=750; atkstat=65; spatkstat=80; defstat=50; spdefstat=55; hp=hpstat; atk=atkstat; spatk=spatkstat; def=defstat; spdef=spdefstat; } player::player(std::string initialname, int initia...
/* * ball.cpp * * Created on: 11. dec. 2016 * Author: dusted */ #include "ball.hpp" Ball::Ball(SDL_Texture *tex, SDL_Rect rect, float x, float y, float velx, float vely) { this->rect = rect; this->posx = x; this->posy = y; this->velx = velx; this->vely = vely; this->texture = tex; } void Ball::move(...
//--------------------------------------------------------------------------- #ifndef Unit2H #define Unit2H //--------------------------------------------------------------------------- #include <System.Classes.hpp> #include <Vcl.Controls.hpp> #include <Vcl.StdCtrls.hpp> #include <Vcl.Forms.hpp> #include "WebModuleUni...
#include<bits/stdc++.h> #define maxn 200005 #define maxm 25 #define mod 1000000007 #define int long long using namespace std; int f[maxm+2][maxn]; int cur[maxn]; int a[maxn], b[maxn], len[maxn]; signed main() { int n, m, k; cin >> n >> m >> k; for(int i=0; i<n; i++) scanf("%lld",&a[i]); b[0] = a[0]%k; f[0][0]++; ...
#include "String.hpp" #include "StringUtility.hpp" #include "Exception.hpp" #include <cstring> #include <cstdio> namespace engine { StringImpl::StringImpl() : m_size(0) , m_buffer(0) , m_capacity(0) {} StringImpl::StringImpl(const char* cstr) { m_size = StringLen(cstr); ...
#include <iostream> using namespace std; int main() { double a, b; cin >> a >> b; cout << fixed; //cout.setf(ios::fixed); 같은기능 cout.precision(6); cout << "첫 번째 수 : " << a << '\n'; cout << "두 번째 수 : " << b << '\n'; cout << "합 : " << a + b; //a,b의 자료형이 float이면 2.999999로 출력됨 }
// // 17837_RE.cpp // Algorithm // // Created by 박세은 on 2020/06/03. // Copyright © 2020 박세은. All rights reserved. // /* 17837. 새로운 게임 다시풀기2 */ #include <iostream> #include <vector> using namespace std; struct horseInfo { int r, c, dir; horseInfo(){} horseInfo(int rr, int cc, int dd) { r =...
#include <cstdio> using namespace std; // A binary heap is a binary tree that is completely filled and satisfy heap order property. // In a Min(Max) heap, for every node X, the key in the parent of X is smaller(larger) or equal to the key in X, with the exception of root (which has no parent). // For element at index ...
/** * 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 * * ...
// // Created by zlc on 2021/5/25. // #include "../include/part_slam/sensor_range/rangereading.h" namespace GMapping { using namespace std; // 构造函数 // n_beams 指定了激光束的数量 // d 表示各个激光的距离 // angle 每束激光的角度 // 均匀角度的激光雷达数据 // RangeReading::RangeReading(unsigned int n_beams, const double *d) // { // m_beam...
//============================================================================ // Name : main.cpp // Author : Lei // Version : // Copyright : Your copyright notice // Description : Hello World in C++ //============================================================================ #include <iostream> #in...
#include "stdafx.h" #include "class.h" Data::Data(){} Data::Data(string make, string model, int body_type, int fuel, int transmission, int engine_size, int year, int value) { m_make = make; m_model = model; m_body_type = body_type; m_fuel = fuel; m_transmission = transmission; m_engine_size = engine_size; m_ye...
#include <cstdio> #include <cstring> int main() { int num[20]; int numToCnt[11]; int maxi; while (scanf("%d", &num[0]) != EOF) { memset(numToCnt, 0, sizeof(numToCnt)); for (int i = 1; i < 20; i++) scanf("%d", &num[i]); for (int i = 0; i < 20; i++) num...
#include "WrapperClass.h" Napi::FunctionReference WrapperClass::constructor; WrapperClass::WrapperClass(const Napi::CallbackInfo& info) : Napi::ObjectWrap<WrapperClass>(info) { Napi::Env env = info.Env(); Napi::HandleScope scope(env); int length = info.Length(); if (length != 1 || !info[0].IsNumber()) { ...
#include <bits/stdc++.h> using namespace std; // multiple states // buy[i] = max(buy[i - 1], sell[i - 2] - prices[i]); // sell[i] = max(sell[i - 1], buy[i - 1] + prices[i]); class Solution { public: int maxProfit(vector<int> &prices) { int ssize = prices.size(); if (ssize <= 1) ...
#include<bits/stdc++.h> using namespace std; void solve(vector<long long>& arr,int n,int m,long long& max_value,int& output,int index,int cur,int cur_str) { if(cur <= m) { if( cur> max_value) { max_value = cur; output = cur_str; } } if(index==n) ...
#include<bits/stdc++.h> using namespace std; struct node { int data; node* left; node* right; node(int val) { data=val; left=NULL; right=NULL; } }; int sumAtK(node* root, int k) { if(root==NULL) //if root is null then return { return -1; } int l...
#include "Channel.h" #include <sys/epoll.h> #include "Logger.h" #include "EventLoop.h" USE_NAMESPACE constexpr int NoneEvent = 0; constexpr int ReadEvent = EPOLLIN | EPOLLPRI; constexpr int WriteEvent = EPOLLOUT; Channel::Channel(EventLoop& loop, int fd) : loop_(loop), fd_(fd), event_(0), actionEvents_(0), eventHan...
// This file has been generated by Py++. #ifndef FontIterator_hpp__pyplusplus_wrapper #define FontIterator_hpp__pyplusplus_wrapper void register_FontIterator_class(); #endif//FontIterator_hpp__pyplusplus_wrapper
#include <Arduino.h> #include "Can485DisplayHelper.h" #define BLOCK 255 void setup() { DisplayInit(); } void loop() { clearDisplay(); delay(200); setCursorPosition(1,1); writeToDisplay("Hello World!"); delay(500); clearDisplay(); delay(200); setCursorPosition(2,1); if(false) { for(int i =...
/************************************************************* * > File Name : P2723.cpp * > Author : Tony * > Created Time : 2019/05/16 12:41:08 **************************************************************/ #include <bits/stdc++.h> using namespace std; const int maxk = 110; const int ma...
#include <iostream> #include <vector> #include <algorithm> #include <unordered_map> #include <unordered_set> #include <set> #include <algorithm> #include <chrono> using namespace std; int main() { int n; cin >> n; vector<unordered_set<int>> subset(n); unordered_map<int, int> position, run_id_position;...
#include <iostream> #include <string> #include "itkImage.h" #include "itkImageFileReader.h" #include "itkVectorLinearInterpolateImageFunction.h" #include "itkGradientImageFilter.h" #include "itkPoint.h" #include <sstream> #include <fstream> #include "itkFixedArray.h" #include "utils.h" #include "vnl/vnl_vector_fixed.h"...
//----------------------------------------------------------------------------- // Perimeter Map Compiler // Copyright (c) 2005, Don Reba // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met:...
/* * SPDX-FileCopyrightText: 2020 Rolf Eike Beer <eike@sf-mail.de> * * SPDX-License-Identifier: GPL-3.0-or-later */ #include "icon.h" #include <algorithm> #include <array> #include <cstring> #include <filesystem> #include <memory> #include <QDebug> #include <QLabel> #include <QPainter> #include <QString> #include...
/** * * @file SerialDeviceSelector.cpp * @author Naoki Takahashi * **/ #include "SerialDeviceSelector.hpp" #include "Device/Actuator/ServoMotor/SerialServoMotor.hpp" #include "Device/ControlBoard/SerialControlBoard.hpp" #include "Device/Sensor/IMU/InertialMeasurementUnit.hpp" #include "Device/Actuator/Ser...
/* * Copyright (C) 2019 wuuhii. All rights reserved. * * The file is encoding with utf-8 (with BOM). It is a part of QtSwissArmyKnife * project. The project is a open source project, you can get the source from: * https://github.com/wuuhii/QtSwissArmyKnife * https://gitee.com/wuuhii/QtSwissArmyKnife * ...
#include "GPUOCLLayer.h" #include "crandom.h" #include "MemoryStorageCPU.h" #include "MemoryStorageOCL.h" void GPUOCLLayer::CreateBuffersGeom(InputGeom a_input, cl_mem_flags a_flags) { } void GPUOCLLayer::CreateBuffersBVH(InputGeomBVH a_input, cl_mem_flags a_flags) { } //m_memoryTaken[MEM_TAKEN_GEOMETRY] = compresse...
#include "speedometer.h" speedometer::speedometer(int num) { speed = 0; number = num; kill = false; } void speedometer::increment() { if (speed < 200) speed++; } void speedometer::decrement() { if (speed > 0) speed--; } void speedometer::Kill() { kill = true; } int speedometer::main(void) { while (!kill...
/*********************************************************************** created: Sun Jan 11 2009 author: Paul D Turner *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2009 Pa...
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.cpp :+: :+: :+: ...
class Solution { public: string removeDuplicates(string S) { // 本题用栈实现 stack<char> st; // 是char类型! for(char s : S){ // 类Python语法 if(st.empty() || s != st.top()){ // 待输入元素和栈顶元素比较,如果相同,直接让栈顶元素出栈。反之,让待入栈元素入栈。 st.push(s); }else{ st.pop()...
#include "playertablemodel.h" #include <parser/outputparser.h> #include <utility> // std::move PlayerTableModel::PlayerTableModel(QObject* parent) : QAbstractTableModel(parent), headers({"Name", "Score", "Ping"}) { } QList<Player> PlayerTableModel::getPlayers() const { return players; } void PlayerTabl...
/****************************************************************************** * CommandFactory * * Authors: * Chantel Frizzell, Jeremy DeHaan * * Date Last Modified: * 2017-03-13 * * The command factory is used to aid in code reusibilty. Generates commands for * any type of command. *******************...
#include "Approach.h" Approach::Approach(Boid* parent, sf::Vector2f* target, float weight) : SteeringBehaviour(parent) { this->target = target; this->weight = weight; type = SB_APPROACH; name = "Approach"; } sf::Vector2f Approach::CalculateSteeringForce() { return Seek(*target); }
/* * sais.h * * Created on: Sep 27, 2013 * Author: vbonnici */ /* * sais.h for sais-lite * Copyright (c) 2008-2010 Yuta Mori All Rights Reserved. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), ...
#pragma once #include <string> using namespace std; class Reference{ protected: string lastName; string firstName; int year; string title; string editionPlace; string editor; public: Reference(string _lastName, string _firstName,string _title, string _edP...
#include "employee.h" Employee::Employee() { name=""; number=0; money=0.0; } int Employee::employeeMax=1000; Employee::~Employee() { cout << "bye!" << endl; }
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); database = new Database; setWindowIcon(QIcon(":/icons/images/ic_launcher.png")); setWindowTitle("MCRC Ground Control Station"); //3D ui->...
#ifndef STATEMACHINE_H #define STATEMACHINE_H #include <string> /** * A simple abstract class for a state machine. Users may apply commands to the * state machine, each prompting an internal state transition and the return of * an output in string form. * * Correct implementations are deterministic: applying t...
/************************************************************* * > File Name : P2320.cpp * > Author : Tony * > Created Time : 2019/09/14 20:37:54 * > Algorithm : 二分 **************************************************************/ #include <bits/stdc++.h> using namespace std; inline ...
#include <vector> #include <stdlib.h> #include <iostream> #include <map> #include <unordered_map> #include <set> #include <queue> #include <stack> #include <algorithm> #include <stdio.h> #include <fstream> using namespace std; bool const cmp(const vector<int>& x1, const vector<int>& x2) // &一定要加 { return x1[0]>x2...
// 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. #include "ui/base/event.h" #if defined(USE_X11) #include <X11/Xlib.h> #endif #include <cstring> #include "ui/base/keycodes/keyboard_code_conversion...
// Singleton Design Pattern #include<bits/stdc++.h> using namespace std; // Admin class is a singleton class as in our system only one Admin can exist class Admin { public: string name; int id; static Admin *AdminInstance; private: // make the constructor priva...
#ifndef DYN_UI_NAVIGATOR_H #define DYN_UI_NAVIGATOR_H /******************************************************************************** ** Form generated from reading UI file 'navigator.ui' ** ** Created: Fri Nov 26 22:18:28 2010 ** by: Qt User Interface Compiler version 4.7.1 ****************************...
// // MenuLayer.hpp // CatchGirl // // Created by xin on 16/4/6. // // #ifndef MenuLayer_hpp #define MenuLayer_hpp #include <stdio.h> #include "cocos2d.h" #include "SceneManager.hpp" #include "ui/cocosGUI.h" #include "cocostudio/CocoStudio.h" using namespace ui; USING_NS_CC; class MenuLayer:public Layer{ public:...
#include <cstdio> #include <iostream> #include <map> #include <vector> #include <queue> #include <cstring> #include <cmath> #include <algorithm> using namespace std; map<int,int>rupa; vector<int>saikat; int res; void bfs(int a,int b,map<int,vector<int> >sagar) { queue<int>q; int ans=0; res=0; q.push(a);...
#include "create_cities.h" istream &operator >> (istream &in, create_cities &ob) { char *name_city = new char[101]; double h, m, s; cout << "Introduceti numele orasului: "; in.getline(name_city + 1, 101); int lg = strlen(name_city + 1); for (int i = 1; i <= lg; ++i) ob.pushC(name_city[...
#pragma once #include "app.h" class team_items { public: team_items(u8* memory_pointer); ~team_items(); private: };
#ifndef __LayerEnemy_H__ #define __LayerEnemy_H__ #include "cocos2d.h" #include "Enemy.h" USING_NS_CC; //! 各种飞机的生命值 const int SMALL_MAXLIFE = 1; const int MID_MAXLIFE = 3; const int BIG_MAXLIFE = 5; class LayerEnemy :public CCLayer { public: CREATE_FUNC(LayerEnemy); bool init();...
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin>>n; int a[n]; for (int i=0; i<n; i++) { cin>>a[i]; } int max = a[0]; int sum = a[0]; for (int i=1; i<n; i++) ...
#include "Ball.h" Ball::Ball() { } // // license:GPLv3+ // Ported at: VisualPinball.Unity/VisualPinball.Unity/VPT/Ball/BallCollider.cs // void Ball::Collide3DWall(const Vertex3Ds& hitNormal, float elasticity, const float elastFalloff, const float friction, float scatter_angle) { }
#include <bits/stdc++.h> using namespace std; int main() { string a; cin>>a; int ans = 1; for(int i=0; i<a.length(); i++) { if(a[i]>='A' && a[i]<='Z') ans++; } cout<<ans<<endl; }
#ifndef TSDPDFMATCHER_H_ #define TSDPDFMATCHER_H_ #include "IPreMatcher.h" #include <string> #include <tinyxml2.h> class TsdPdfMatcher : public IPrematcher { public: TsdPdfMatcher(); virtual ~TsdPdfMatcher(); virtual bool init(const std::string& configXml) override; virtual bool doRegistration(obvious::Sensor...
#ifndef _BASE_THREAD_H_ #define _BASE_THREAD_H_ #include <string> #include <pthread.h> namespace base { class ThreadWorker { public: virtual ~ThreadWorker() {}; virtual void *run() = 0; }; class Thread { public: Thread(ThreadWorker *worker, std::string name = ""); ~Thread(); void start(); v...
#include "Builder.h" std::string Builder::getCpu() { return std::string("i7 7700K"); } std::shared_ptr<Memory> Builder::getMemory() { return std::make_shared<Memory>(16); } std::shared_ptr<Storage> Builder::getStorage() { return std::make_shared<Storage>(1024); }
// Copyright (c) 2014, OpenFlow // Author: kobemiller<kobemiller@126.com> // Created: 2014-07-03 // Description: // #ifndef OPENFLOW_AGENT_HANDLER_H #define OPENFLOW_AGENT_HANDLER_H #pragma once #include <vector> #include "rpc/agent/AgentService.h" namespace openflow { namespace agent { class CAgentHandler : pu...
/** * Universidad de La Laguna * Escuela Superior de Ingeniería y Tecnología * Grado en Ingeniería Informática * Diseño y Análisis de Algoritmos * * Algoritmos constructivos y búsquedas por entornos * * @author Ángel Tornero Hernández * @date 12 Abr 2021 * @file GreedyAlgorithm.cc * */ #includ...
#include <iostream> using namespace std; //virtual function //Abstract class - MUST contain at least one pure virtual function , CANT create objects! Used as a template for creating other classes class Enemy { protected: int attackPwr{}; public: void setPwr(int x) { this -> attackPwr = x; } //virtual functi...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll f(ll, ll); int main() { ll a, b; cin>>a>>b; cout<<f(a, b)<<endl; } ll f(ll a, ll b) { if(b==1) return a; if(!a) return 0; if(a>b) { ll n = a/b; if(n*b==a) n--; return f(a-n*b, b)+n; } else { ll n = (b/a); if(n*a==b) n--;...
//----------------------------------------------- // // This file is part of the Siv3D Engine. // // Copyright (c) 2008-2018 Ryo Suzuki // Copyright (c) 2016-2018 OpenSiv3D Project // // Licensed under the MIT License. // //----------------------------------------------- # include "CObjectDetection.hpp" # include <Si...
#ifndef prke_h_ #define prke_h_ #include "../Global/GlobalHeaders.h" #include "PRKE_Tools.h" class PRKE { public: // Constructor PRKE (unsigned int); // Destructor ~PRKE () {} void perform_prke_step(); void set_prke_parameters ( const vector<double>& time_reactivity_...
/* 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 <stdio.h> #include <stdlib.h> using namespace std; int main() { int num1, num2; printf("Ingresar el Primer numero:\n "); scanf("%d", &num1); printf("Ingresar el Segundo numero:\n "); scanf("%d", &num2); if (num1>num2) { printf("El Primer Numero es el ma...
#include <iostream> using namespace std; int main() { int score[3]; double aver = 0; for (int i = 0; i < 3; i++) { cin >> score[i]; aver += score[i]; } aver = aver / 3.0; cout << fixed; cout.precision(2); cout << aver << endl; if (aver >= 75) cout << 'A'; else if (aver >= 50) cout << 'B'; else cout << ...
#define MAXSIZE 5 #define LISTINCREMENT 10 #include<stdio.h> #include<stdlib.h> typedef struct{ int *elem; int length; int listsize; int incrementsize; }SqList; /*线性表的初始化操作*/ void InitList(SqList &myList , int maxsize , int incresize){ // 构造一个最大容量为maxsize的顺序表L myList.elem = new int[maxsize]; // 为顺序表分配一个最大容量...
#ifndef _HS_SFM_BUNDLE_ADJUSTMENT_BA_GCP_CONSTRAINED_JACOBIAN_MATRIX_HPP_ #define _HS_SFM_BUNDLE_ADJUSTMENT_BA_GCP_CONSTRAINED_JACOBIAN_MATRIX_HPP_ #include "hs_sfm/bundle_adjustment/ba_naive_jacobian_matrix.hpp" namespace hs { namespace sfm { namespace ba { template <typename _Scalar, typena...
#include <whiskey/Printing/Printer.hpp> #include <whiskey/AST/Node.hpp> namespace whiskey { const unsigned int Printer::defaultTabWidth = 2; void Printer::printNewline(std::ostream &os, unsigned int indent) { os << "\n"; for (unsigned int i = 0; i < indent * tabWidth; i++) { os << ' '; } } Printer::Printe...
/** * * @file Buffer.cpp * @author NaokiTakahashi * **/ #include "Buffer.hpp" #include <stdexcept> #include <algorithm> #include <Tools/Math/Matrix.hpp> #include "TimeSeriesData.hpp" namespace RobotStatus { template <typename T> Buffer<T>::Buffer(const SizeType &maximum_data_size) { resize(maximum_d...
#include <iostream> #include <cmath> using namespace std; int main() { int r1, r2, number, num1, num2, count = 0; cout << "Enter the number you want to check: "; cin >> number; num1 = number; num2 = number; while (num1 > 0) { r1 = num1 % 10; while (num2 >...
void Solution::merge(vector<int> &a, vector<int> &b) { int n=a.size(); int m=b.size(); int i=n-1,j=m-1; int l=m+n-1; a.resize(m+n); while(j>=0) { if(i>=0 and a[i]>b[j]) { a[l--]=a[i--]; } else { a[l--]=b[j--]; } ...
#include "Base/SlideCore.h" SlideCore::SlideCore():Matrix() { //ctor } SlideCore::SlideCore(int Row,int Col):Matrix(Row,Col),EmptyCell(Row-1,Col-1) { int p = 1; for(int i = 0;i<Row;i++) for(int j = 0; j< Col; j++) (*this)[i][j] = p++; (*this)[Row-1][Col-1] = 0; } void SlideCore::Move(Direction D) { swit...
#include<bits/stdc++.h> using namespace std; int main(){ int m,n,d,s,e; cin>>m>>n; d=m; s=m; while(d>=n){ d=m/n; e=m%n; s=s+d; d=d+e; m=d; } cout<<s; return 0; }
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace std; using namespace __gnu_pbds; double INF = 1e100; double EPS = 1e-12; typedef long long int ll; typedef pair < int,int > PII; typedef ...
#ifndef BEXP_IC_TRANSLATOR_H #define BEXP_IC_TRANSLATOR_H #include "treevisitor.h" #include "ictranslator.h" #include "labelset.h" #include "../symboltable.h" #include "../instructions/instructions.h" #include "../instructions/gotoi.h" #include "../instructions/ifi.h" #include "../instructions/varregister.h" #include ...
#include "pch.h" #include "Rasterizer.h" #include "algorithm" #include "ppl.h" using namespace DirectX; using namespace GameEngine; Rasterizer::Rasterizer() { } void Rasterizer::SetFrameBuffer(byte* buffer, unsigned int width, unsigned int height) { m_buffer = buffer; m_pixelWidth = width; m_pixelHeight = height; ...