text
stringlengths
8
6.88M
#include "utils.h" sf::IntRect Utils::windowSize = sf::IntRect(); sf::Font Utils::baseFont = sf::Font(); sf::Vector2f Utils::normalize(const sf::Vector2f& source) { float length = sqrt((source.x * source.x) + (source.y * source.y)); if (length != 0) return sf::Vector2f(source.x / length, source.y / len...
// 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::Devices::I2c::Provider { struct ProviderI2cTransferResult; } namespace Windows::Devices::I2c::Provider { using ProviderI2cTransferRe...
#pragma once //**************************************************************************/ // Copyright (c) 1998-2007 Autodesk, Inc. // All rights reserved. // // These coded instructions, statements, and computer programs contain // unpublished proprietary information written by Autodesk, Inc., and are // protected ...
// Copyright Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ========================================================================...
#include "platform.h" #include "script-kernel.h" #include "script-functype.h" #include "script-functions.h" #ifdef EMSCRIPTEN #include <emscripten.h> #define USE_JAVASCRIPT 0 #else #define USE_JAVASCRIPT 0 #endif #include <mutex> #include <thread> #include <future> // std::async, std::future namespace Scr...
#include <iostream> using namespace std; int main(){ int num,a,b; cin>>num; for(int i=0; i<num; i++){ cin>>a>>b; if(a==b) cout<<0<<endl; else if((a>b && (a-b)%2==0) || (a<b && (b-a)%2==1)) cout<<1<<endl; else cout<<2<<endl; } return 0; }
#include<iostream> using namespace std; int stairs[301]; int dp[301][301]; int n; int compare_max(int i, int j); void print(); int main() { cin >> n; stairs[0] = 0; for (int i = 1; i <= n; i++) cin >> stairs[i]; /* dp 초기값 */ dp[0][0] = 0; for (int i = 1; i <= n; i++) dp[i][i] = stairs[i]; /* dp 채우기 */...
/********************************************************************* Matt Marchant 2014 - 2016 http://trederia.blogspot.com xygine - Zlib license. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this soft...
/* * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2020, Savely Pototsky (SavaLione) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must ...
#ifndef __STONE_H__ #define __STONE_H__ #include "Common.h" class Stone : public CCSprite { public: CREATE_FUNC(Stone); bool init(); void initStone(int id); CCPoint fromPlate(); int _id; bool _red; int _row; int _col; TYPE _type; bool _dead; static int _d; static int _offx; static int _offy; }; #endi...
#ifndef LINKED_LIST_H #define LINKED_LIST_H #include <iostream> using namespace std; template<class T> class linked_list{ struct node{ T dato; node* p_next; node* p_prev=nullptr; node(const T & d, node* p_next_=nullptr){ dato=d; p_next=p_next_; ...
#include<iostream> #include<vector> #include<chrono> #include<cmath> #include<set> #include<map> #include<string> #include<sstream> using namespace std; set<int64_t> getPrimeSet(int64_t N){ set<int64_t> ordered_set; ordered_set.insert(2); for (int64_t n = 3; n <= N; n += 2){ bool flag = true; for (auto...
/* --COPYRIGHT--,BSD * Copyright (c) 2011, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copy...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "Windows.Data.Xml.Dom.1.h" WINRT_EXPORT namespace winrt { namespace ABI::Windows::Foundation::Collections { #ifndef WINRT_GENERIC_139d959e_e7b5_5cb6_a596_4b544478da9b #define WINRT_...
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * }; */ class Solution { public: /** * @param root TreeNode类 * @param p int整型 * @param q int整型 * @return int整型 */ int lowestCommon...
#include "CCharacter.h" CCharacter::CCharacter(T2Double p, int i, T4Int c, double r) : CSomething(p, i, c, r, 0.0) { V_OldMP.set(0.5, 0.5); V_Power = 0; V_InvTime = 0; V_SuperTime= 0; V_LookAngle.set(0.0, 0.0); } void CCharacter::M_GetInvincible(int t) { V_InvTime = t; V_Color.set(255, 255, 0, 100); } void CCh...
/* * TripleBitRespository.cpp * * Created on: May 13, 2010 * Author: root */ #include "MemoryBuffer.h" #include "TripleBitRepository.h" #include "PredicateTable.h" #include "URITable.h" #include "TripleBitBuilder.h" #include "BitmapBuffer.h" #include "StatisticsBuffer.h" #include "EntityIDBuffer.h" #include...
#pragma once #include <deque> #include <memory> #include <opencv2/opencv.hpp> class Image; class OpenCV { const cv::Size m_patternSize; std::vector<std::shared_ptr<Image> > m_images; cv::vector<cv::Mat> m_checkerImgs; cv::vector<cv::vector<cv::Point2f> > m_imagePoints; cv::vector<cv::vector<cv::Po...
/* 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 <stdio.h> #include <stdlib.h> #include <math.h> #include <iostream> #include <cmath> #include <algorithm> using namespace std; #define one struct cir #define pos struct table struct cir { double x,y,r; }; struct table { double x,y; }; one circle[50]; double x,y,dx,dy; int n; void normald() { double tem...
#include "opencv.hpp" using namespace cv; using namespace std; void showResult(char* name, cv::Mat image) { //window's name cv::namedWindow(name); //image cv::imshow(name, image); } Mat addIcon(Mat backGround, Mat icon, int x, int y, int iconColsSize, int iconRowsSize) { cv::Rect rectDst(x, y, icon.cols, icon...
#include<stack> using namespace std; class MinStack { // The basic idea is to have another data structure to maintain the minimum value of each node in the stack // The first element of the data structure should record the current minimum value public: stack<int> minStack; stack<int> regularStack; ...
/// /// \file MarkerData.h /// \brief /// \author PISUPATI Phanindra /// \date 01.04.2014 /// #ifndef MARKER_H #define MARKER_H #include "StringFunc.h" #include <iostream> #include <mutex> #include <vector> #include <map> #include <limits> class Point2d { public: float x; ///< x...
/* 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...
#ifndef SAKHAROV_LR2_LABIO_H #define SAKHAROV_LR2_LABIO_H #include "LabExec.h" string ProceedInput (int argc, char *argv[]); string ReadFromFile (std::string filename = "input.txt"); string ReadFromConsole (); extern bool errorFlag; extern int errorPos; void ProceedError (const std::string & error, int pos); #endif ...
#include "processstepWidget.h" #include "ui_processstepWidget.h" ProcessStepWidget::ProcessStepWidget(ProcessStep *processStep, QWidget *parent) : QWidget(parent), ui(new Ui::ProcessStepWidget) { ui->setupUi(this); ui->parameterLayout->setAlignment(Qt::AlignTop); ui->nameLBL->setAlignment(Qt::Alig...
#pragma once #include "VCoreBase.h" template <typename TElement, unsigned MaxElement> struct VHistoryQueue { static_assert(MaxElement > 2, ""); int mSize = 0; int mRead = 0; alignas(alignof(TElement)) char mBuffer[MaxElement * sizeof(TElement)]; VHistoryQueue() { } ~VHistoryQueue() { Reset(); } bool...
/* * SPDX-FileCopyrightText: (C) 2015-2022 Daniel Nicoletti <dantti12@gmail.com> * SPDX-License-Identifier: BSD-3-Clause */ #ifndef UTILS_H #define UTILS_H #include <Cutelyst/ParamsMultiMap> #include <Cutelyst/cutelyst_global.h> #include <QtCore/QStringList> namespace Cutelyst { namespace Utils { CUTELYST_LIBRAR...
int N=10000003; bool ispossible(vector<int>& a,int p,long long t,long long mxt) { int req_painter=1; int n=a.size(); long long time=0; for(int i=0;i<n;i++) { if(a[i]*t>mxt) return false; if(time+a[i]*t>mxt) { req_painter++; time=a[i]*t; ...
#ifndef ADDSOUV_H #define ADDSOUV_H #include <QDialog> namespace Ui { class addSouv; } class addSouv : public QDialog { Q_OBJECT public: explicit addSouv(QWidget *parent = 0, QString selectedStadium = " "); ~addSouv(); private slots: void on_pushButton_clicked(); void on_pushButton_2_clicked()...
/********************************************************************** * Felix Winterstein, Imperial College London * * File: init_memory_tb.cpp * * Revision 1.01 * Additional Comments: distributed under a BSD license, see LICENSE.txt * **********************************************************************/ #include ...
// This file is subject to the terms and conditions defined in 'LICENSE' included in the source code package #ifndef JACTORIO_INCLUDE_GUI_COMPONENTS_H #define JACTORIO_INCLUDE_GUI_COMPONENTS_H #pragma once #include <functional> #include <type_traits> #include "core/data_type.h" #include "gui/component_base.h" #inclu...
#include <iostream> #include <ctime> #include <chrono> #define TAMANHO 120000 #define MOSTRAR 0 using namespace std; struct Node { int num; struct Node *prox; }; typedef struct Node node; int tam; void inicia(node *LISTA); node *criaNo(); void insereFim(node *LISTA, int i); void insere...
#include <algorithm> int main() { return 1; } class Solution { public: int singleNumber(int A[], int n) { } };
#include <Control/vdfilecontrol.h> VDFileControl::VDFileControl(MainWindow * GUI,QObject *parent) : QObject(parent) { this->t.start(); QDir dir; dir = QDir(); dispatcher = new VDDispatcher(this); this->mw = GUI; QList<QFileInfo> drive = dir.drives(); QFileIconProvider q...
//高斯滤波 #include <iostream> #include <opencv2/opencv.hpp> cv::Mat guassfilter(cv::Mat img, int n) { //建立高斯核模板 //float *guass= new float[n,n]; float *guass = new float[n * n]; float sum = 0; for (int x = 0; x < n; x++) { for (int y = 0; y < n; y++) { guass[x * n + y] ...
#include "../inc.h" class Solution { public: //O(N) space int longestValidParentheses1(string s) { vector<int> stack, his; int r = 0; for(size_t i = 0;i < s.size();++i){ switch(s[i]){ case '(':stack.push_back(i);break; case ')': ...
#include <iostream> #include <queue> #include <ctime> #include <sstream> #include <thread> #include <vector> #include <functional> #include <mutex> #include "factory.hpp" #include "extra.hpp" using server = Server<std::shared_ptr<Figure>>; void print_menu() { std::cout << "1. Add Rectangle" << std::endl; std...
#include "globals_sys.h" #ifndef WIN32 #include <unistd.h> #include <sys/types.h> #include <pwd.h> #endif #ifdef WIN32 constexpr int HYDRAPATHSIZE = 1024; char g_hydraInstallPath[HYDRAPATHSIZE] = "C:/[Hydra]/bin2/"; void hr_setrenderpath(const std::string& a_rhs) { memset(g_hydraInstallPath, 0, HYDRAPATHSIZE); s...
#pragma once #include "DrawingCycle.h" class MoveCycle : DrawingCycle { public: MoveCycle(void); MoveCycle(float radius); ~MoveCycle(void); virtual void AI(sf::RenderWindow& renderWindow, std::map<string, float>& eventMap); };
#ifndef ELEMENT_TABLE_WIDGET_H #define ELEMENT_TABLE_WIDGET_H #include <QTableWidget> #include <ui_client/elements/types/element_ui_base.h> class ElementTableWidget { public: ElementTableWidget(); ~ElementTableWidget(); /** * @brief getRepresentation * @return */ inline QTableWidg...
// 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 "car.h" void Car::init() { // TODO: resize the smaller rectangle to overlap the bigger one // this->recalcSubRecPos(); glm::vec3 tl = _rec.tl(), tr = _rec.tr(), bl = _rec.bl(), br = _rec.br(); glm::vec3 r_diff = tr - br, b_diff = br - bl, b_diff_n = glm::normalize(b_diff); float sub_b_len ...
// // static_request_handler.h // ~~~~~~~~~~~~~~~~~ // #ifndef STATIC_REQUEST_HANDLER_H #define STATIC_REQUEST_HANDLER_H #include <string> #include "request_handler.h" #include "response.h" #include <map> #include "request.h" class static_request_handler : public request_handler { public: request_handler* Init...
/* primitive_long_long.cpp -*- C++ -*- Rémi Attab (remi.attab@gmail.com), 12 Apr 2014 FreeBSD-style copyright and disclaimer apply Long Long reflection */ #include "primitives.h" #include "primitives.tcc" /**********************************************************************...
#ifndef _Com_Cache_h_ #define _Com_Cache_h_ #if 0 #include <libmemcached/memcached.h> namespace Cache::Native { extern thread_local memcached_st *memc; extern thread_local memcached_server_st *servers; void InitMemcachedThread(); bool ClearMemcached(const char* key); bool SetMemcached(const char* key, const char* ...
#include <iostream> #include <iCub/iDyn/iDyn.h> #include <yarp/sig/all.h> #include <yarp/math/api.h> #include <yarp/os/Log.h> #include <yarp/os/all.h> #include <yarp/os/Time.h> #include "../iDyn_KDL_conversion/iDyn2KDL.h" #include "../iDyn_KDL_conversion/KDL2iDyn.h" #include "../icub_model/idyn2kdl_icub.h" #include ...
#include "ScreenMenuSystem.h" ScreenMenuSystem::ScreenMenuSystem() { first = 0; index = 0; str[0] = "读入进度"; str[1] = "存储进度"; str[2] = "游戏设置"; str[3] = "结束游戏"; strX = 42; strY = 32; selY = strY; bmpFrame = Util::getFrameBitmap(109 - 39 + 1, 91 - 29 + 1); bmpArrowUp = Bitma...
#pragma once #include "BSoundDriver.h" class CDirectXSoundDriver: public BSoundDriver { public: CDirectXSoundDriver(); virtual ~CDirectXSoundDriver(); virtual bool CreateSoundDriver(); virtual bool DestroySoundDriver(); virtual bool PlaySound(); };
// github.com/andy489 #include <iostream> #include <vector> using namespace std; typedef vector<int> vi; unsigned count_pairs(const vi &a, const vi &b, int sum) { unsigned answer(0); const int max = 1000000, min = 0, range = max - min; vi buffer_b(range, 0); for (const auto &el : b) ++buffe...
/* GND = GND VCC = 5v SDA = A4 SCL = A5 */ #include <Wire.h> #include "MMA7660.h" MMA7660 accelemeter; void setup() { accelemeter.init(); Serial.begin(115200); } void loop() { float ax,ay,az; accelemeter.getAcceleration(&ax,&ay,&az); Serial.println(ax); delay(5); }
#pragma once #include "Module.h" #include "Globals.h" #include "glmath.h" #include "MathGeoLib/include/Math/float3.h" #include "MathGeoLib/include/Geometry/LineSegment.h" class Shortcut; class ComponentTransform; class ComponentCamera; class ModuleCamera3D : public Module { public: ModuleCamera3D(const char * name, ...
#include "DirMonInvoker.h" #include <glog/logging.h> #ifdef BUILD_AS_PLUGINS #include <Pluma/Connector.hpp> #endif #include <sys/stat.h> #ifndef WIN32 #include <dirent.h> #else #include <strsafe.h> #endif namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR bool connect(pluma::Host& host) { host.add( new Dir...
#include "stdafx.h" #pragma comment( lib, "version.lib")
#pragma once #include <string> namespace drake { namespace geometry { namespace detail { /** Canonicalizes the given geometry *candidate* name. A canonicalized name may still not be valid (as it may duplicate a previously used name). See @ref canonicalized_geometry_names "documentation in GeometryInstance" for de...
#include <iostream> using namespace std; struct Node{ int value; Node* left = NULL; Node* right = NULL; }; Node* add(Node* h,int m){ if (m<=(h->value)){ cout<<"Entered left"<<endl; if (h->left==NULL){ Node* w = new Node; w->value = m; h->left = w; } else{ h->left = add...
#pragma once #include <openssl/dh.h> #include <openssl/rand.h> #include "Dlog.hpp" /**********************/ /**** Helpers *********/ /**********************/ biginteger opensslbignum_to_biginteger(BIGNUM* bint); BIGNUM* biginteger_to_opensslbignum(biginteger bi); class OpenSSLDlogZpAdapter { private: shared_ptr<DH>...
#include "Color.h" #include "MathUtility.h" namespace Corgi { namespace Core { Color LinearColor::ToRGBE() const { const float primary = Math::Max3(R,G,B); Color color; if (primary < 1E-32f) { } return colo...
#include "TFile.h" #include "TTree.h" #include "TLorentzVector.h" #include "TVector3.h" #include <string> #include <iostream> #include <vector> #include "HipoChain.h" #include "clas12reader.h" #include <fstream> using namespace std; int main(int argc, char **argv){ clas12root::HipoChain chain; char File[200]; ...
#include <iostream> #include <vector> #include <algorithm> #include <unordered_map> using namespace std; ////////////////////////////////// METHOD 1 : USING HASH MAP ( TIME COMPLEXITY: O(N) )///////////////////////////////// int solution(vector<int> &A) { unordered_map <int, int> hash; for (...
#include "Patcher_EnableNameColoring.h" #include "../Addr.h" #include "../FileSystem.h" //----------------------------------------------------------------------------- // Static variable initialization LPBYTE CPatcher_EnableNameColoring::addrTarget = NULL; LPBYTE CPatcher_EnableNameColoring::addrIsElf = NULL; LPBYTE ...
#include "file_buffer.h" #include "file_cache.h" using namespace std; /*! * @param cache The whole cache for reserving memory in it */ file_buffer::file_buffer(int64_t full_size, class file_cache &cache) : cache{cache}, full_size{full_size} { /* * TODO ensure nobody else does the same at this time. ...
// // Created by 梁栋 on 2019-05-09. // #include <iostream> #include <vector> #include <queue> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} static TreeNode* buildByLevel(vector<int> nums){ TreeNode* root =...
#pragma once #include <string> class Score_Reader { struct Test { std::string name; int score; }; public: void read_test_scores(); };
#ifndef CASH_DEPO_REGE_H #define CASH_DEPO_REGE_H #include <QDialog> #include <QtSql> #include<QCompleter> #include<QMenuBar> #include<QMenu> #include<QDate> #include<QSqlQuery> #include<QMessageBox> #include<QByteArray> #include<QtNetwork/QNetworkInterface> #include<QBuffer> #include<QFile> #include<QI...
/* Copyright (c) 2014 NicoHood See the readme for credit to other people. HoodLoader2 USB-Serial Transferes from USB to HW Serial and vice versa. It also resets the main MCU on a DTR rise. */ void setup() { // set main MCU by default active pinMode(MAIN_MCU_RESET_PIN, OUTPUT); digitalWrite(MAIN_MCU_RESET...
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2007 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software....
#pragma once #include <initializer_list> #include <iostream> #include <string> #include <vector> namespace tdc { class ASCIITable { private: static inline std::string wrap(std::string& s, size_t width) { size_t end = 0; size_t x = s.find_first_of(" \t"); while(x !=...
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main(){ int t; cin >> t; for(int a0 = 0; a0 < t; a0++){ int n; int k; int total_count=0; cin >> n >> k; vector<int> a(n); for(int a_i = 0;a_...
#ifndef WBACTIONRODINBLACKBOARDWRITE_H #define WBACTIONRODINBLACKBOARDWRITE_H #include "wbaction.h" #include "wbparamevaluator.h" class WBActionRodinBlackboardWrite : public WBAction { public: WBActionRodinBlackboardWrite(); virtual ~WBActionRodinBlackboardWrite(); DEFINE_WBACTION_FACTORY( RodinBlackboardWrite );...
/* *Factorial of the given no */ #include "iostream" using namespace std; int main() { unsigned long long int n,number,fact=1; cout<<"FACTORIAL OF THE GIVEN NUMBER"; cout<<"\nEnter a number :- "; cin>>number; n=number; while (n !=0) { fact=fact*n; n--; } cout<<"The ...
#include "CommonHeader.h" PlayGameButton::PlayGameButton(const char * aCameraName, unsigned int aDrawRenderOrder):Button(aCameraName,aDrawRenderOrder) { } PlayGameButton::PlayGameButton(Scene * apScene, std::string aName, Vector3 aPos, Mesh * apMesh, ShaderProgram * apShader, GLuint aUnselectedTexture, GLuint aSel...
/* EMRAH YILDIRIM 111044056 */ #ifndef SET_CONTAINER_CPP #define SET_CONTAINER_CPP #include "SetContainer.h" namespace HW08 { template<class T> SetContainer<T>::SetContainer() : Container<T>()//call Container<T> constructor { /*bilerek bos birakildi*/ } template<class T> SetContainer<T>::~SetContainer() { /...
#ifndef GENEGUARD #define GENEGUARD #include <string> #include <cstdlib> #include <utility> #include <memory> #include <vector> #include <deque> #include <map> #include <list> #include <cmath> #include <algorithm> #include <random> #include <chrono> #include <iostream> #include <SFML\Graphics.hpp> class GenParams { pub...
#include "CalibrationTests.h" #include "../TaskLayer/CalibrationTask/CalibrationTask.h" #include "../TaskLayer/DbForTask.h" #include <regex> #include <string> #include "../TaskLayer/CalibrationTask/CalibrationTask.h" using namespace TaskLayer; #include "UsefulProteomicsDatabases/UsefulProteomicsDatabases.h" using na...
// // Created by 79164 on 26.11.2020. // #ifndef UDP_SERVER_LIB_H #define UDP_SERVER_LIB_H #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <termios.h> #include <unistd.h> #include <fcntl.h> namespace io{ int kbhit(void); } #endif //UDP_SERVER_LIB_H
#include <bits/stdc++.h> using namespace std; class Solution { public: double myPow(double x, int n) { return pow(x,n); } };
#include "server_utils.h" namespace server { void ServerUtils::buildErrorResp(rapidjson::Document& d, EndpointInterface::ErrorCode err_code, const std::string& msg) { auto& al = d.GetAllocator(); d.AddMember("error_code", static_cast<int>(err_code), al);...
#include <vector> #include <stack> using namespace std; class TreeNode { public: int val; TreeNode * left = nullptr; TreeNode * right = nullptr; }; vector<int> postorderTraversal(TreeNode* root) { vector<int> nodes; stack<TreeNode *> todo; TreeNode* last = nullptr; while(root || !todo.em...
#ifndef CONSOLE_H_ #define CONSOLE_H_ class Console { public: Console(); virtual ~Console(); void Render(void); }; #endif
// // Created by 梁栋 on 2019-03-25. // #include <string> #include <iostream> #include <cstring> using namespace std; class Solution { public: int minDistance(string word1, string word2) { int len1 = int(word1.length()); int len2 = int(word2.length()); int dp[len1 + 1][len2 + 1]; memse...
#ifndef __Box2DWorld__H__ #define __Box2DWorld__H__ class Box2DDebugDraw; class Box2DContactListener; class ShaderProgram; const int32 BOX2D_WORLD_VELOCITY_ITERATIONS = 8; const int32 BOX2D_WORLD_POSITION_ITERATIONS = 3; const float BOX2D_FRAMES_PER_SECOND = 60; class Box2DWorld { protected: b2World* m_pWorld; Bo...
#include "sequence.h" Sequence::Sequence(std::vector<char> alphabet, int lenght) { seq_lenght = lenght; makerand(alphabet); } Sequence::~Sequence() { } std::string Sequence::get_answer() { return trueseq; } bool Sequence::set_trueseq(std::string new_seq) { int size = new_seq.size(); if (size == ...
#include "MyOctant.h" using namespace Simplex; //Static variables from header file uint MyOctant::m_uMyOctantCount = 0; uint MyOctant::m_uMaxLevel = 3; uint MyOctant::m_uIdealEntityCount = 5; //Accessors //Method to get all total number of MyOctants in the world uint MyOctant::GetMyOctantCount() { return m_uMyOctant...
#include <iostream> #include <vector> //vector<int> traversal_path; class DisjointSets { public: int s[256]; DisjointSets() { for (int i = 0; i < 256; i++) s[i] = -1; } int find(int i); }; /* Modify the find() method below * to implement path compression * so that element i and all of * its ancestors in the...
// Copyright (C) 2017 Elviss Strazdins // This file is part of the Ouzel engine. #include <algorithm> #include "TextureResource.h" #include "Renderer.h" #include "core/Engine.h" #include "math/MathUtils.h" namespace ouzel { namespace graphics { TextureResource::TextureResource() { } ...
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include "drmgr.h" #include "param.h" #include "log.h" #include "drmgr.h" #include "mydefs.h" // Note: This function will block until the PRE_ACTIVE_SCRIPT returns bool check_portal_process() { CParam *cP=CParam::GetInstance(); char c...
/** * MIT License * * Copyright (c) 2021 Dantali0n * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modif...
#pragma once #include "mnist_reader.hpp" #include "mnist_utils.hpp" #include "../tensor/tensor.h" namespace transprecision_floating_point { template<typename T> struct mnist_dataset { explicit mnist_dataset(std::string const& mnist_path); tensor<T> train_labels; tensor<T> train_images; tensor<T> test_labels...
//In a factorial a zero arises from the multiplication of 2*5. //Every second number is even, so there are abundant 2s in the sea of prime factors of numbers. //5s can be counted by adding all the factors of power of 5. //As the numbers of 5s are less, the number of 0s is equal to this sum. int Solution::trailingZeroes...
#include "PowerUp.h" void PowerUp::spawn(const Vec2 & pos_in, Timer & timer, std::mt19937& rng) { reset(timer); pos = pos_in; std::uniform_int_distribution <int> randomPower(0, nPowers - 1); type = Type(randomPower(rng)); //type = Type(2); visible = true; timer.init(&visible, timeVisible); } void PowerUp::upda...
#ifndef IMPDST_H #define IMPDST_H /// @file ImpDst.h /// @brief ImpDst のヘッダファイル /// @author Yusuke Matsunaga (松永 裕介) /// /// Copyright (C) 2005-2012 Yusuke Matsunaga /// All rights reserved. #include "YmNetworks/BNetwork.h" BEGIN_NAMESPACE_YM_NETWORKS class ImpNode; ////////////////////////////////////////////...
/*************************************************************************** Copyright (c) 2020 Philip Fortier 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...
#include "Build.h" #include "Singleton.h" using namespace std; void disp(void); void initFunc(); void idleFunc(void); Circle_t circl; Ellipse_t elps(0,0,300,200); int main(int argc,char** argv) { cout<<"Basic OpenGl code"<<endl; glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGBA|GLUT_SINGLE); glutInitWindowSize(W...
//-------------------------------------------------------------- // Arduino Source - MotorMaster.cpp // @Author - J. MacVey //-------------------------------------------------------------- /* This file is part of the Robotics library developed for S. Norr's Robotics course at University of Minnesota-Duluth Th...
class Date{ public: Date(int dd, int mm, int yy); private: int d, m, y; }; Date::Date(int dd, int mm, int yy) { d = dd; m = mm; y = yy; } int main(){ Date oggi = Date(10,04,2017); //OK Date today{10, 04, 2017}; //OK Date tomorrow(11, 04, 2017); //abbreviazione Date toyota; //ERRORE, no inizializzaz...
#pragma once #include "btBulletDynamicsCommon.h" #include "Client.h" #include "Player.h" #include <chrono> using namespace std::chrono; class Bullet : public btRigidBody { public: Bullet(btRigidBodyConstructionInfo& info, int id, int ownerId); ~Bullet(); static Bullet* createNewBullet(int id,btCollisionShape* co...
#include "utils.h" char* AllocChar( DWORD dwSize ) { return (char*)HeapAlloc( GetProcessHeap() , HEAP_ZERO_MEMORY , dwSize ); } void FreeChar( char* AllocChar ) { nt_memset( AllocChar , lstrlenA( AllocChar ) , 0 ); HeapFree( GetProcessHeap() , HEAP_ZERO_MEMORY , AllocChar ); } bool cTimer::delay( DWORD dwMsec ) {...
#include<iostream> #include<cmath> #include<vector> #include<cstdlib> using namespace std; vector<int>h[3]; int main() { h[0].clear(); h[1].clear(); h[2].clear(); return 0; }
// "Copyright [2020] <Copyright rbcks513>" #include<iostream> class Dog { public: Dog(int age, int speed) : age_(age), speed_(speed) {} virtual int getage() const = 0; virtual int getspeed() const = 0; int age() const { return age_; } int speed() const { return speed_; } protected: const int age_; c...