text
stringlengths
8
6.88M
#include "DeviceDisplayBinary.h" #include "DeviceDisplay.h" namespace ART { DeviceDisplayBinary::DeviceDisplayBinary(DeviceDisplay* deviceDisplay) { _deviceDisplay = deviceDisplay; } DeviceDisplayBinary::~DeviceDisplayBinary() { } void DeviceDisplayBinary::create(DeviceDisplayBinary* (&deviceDisplayBinary)...
#ifndef TIMER_H #define TIMER_H #include "../Common/Types.h" class CTimerImplementation; class CTimer { public: CTimer(); ~CTimer(); void Start(); f32 End(); void Restart(); bool HasStarted() const; f32 GetElapsedTime(); f32 GetElapsedTimeAndReset(); void Set( f32 fSeconds ); private: CTimerImpleme...
/******************************************************************************* * Cristian Alexandrescu * * 2163013577ba2bc237f22b3f4d006856 * * 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ...
/*************************************************************************** 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...
// WordChecker_AdditionalTests.cpp // additional tests for word checker #include <string> #include <vector> #include <gtest/gtest.h> #include "ListSet.hpp" #include "WordChecker.hpp" TEST(WordChecker_AdditionalTests, canGenerateSuggestionsBySwapAdjacentPair) { ListSet<std::string> set; set.add("ABDC"); s...
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; while(scanf("%d %d", &a, &b)!=EOF){ if(a == b) printf("0\n"); else printf("%d\n", abs(a-b)-1); } return 0; }
#include "ItemBridgeStartPos.h" ItemBridgeStartPos* ItemBridgeStartPos::create(CCDictionary* dict) { ItemBridgeStartPos* ret = new ItemBridgeStartPos; ret->init(dict); ret->autorelease(); return ret; } bool ItemBridgeStartPos::init(CCDictionary* dict) { Item::init(); _type = Item::IT_mushroom; setPositionByPro...
// =========================================== // // G4 to Root macro // // version 2.0 // 23/02/2013 // // Authors: P. Chimenti and G. A. Valdiviesso // // =========================================== int g4_2_root( TString inFile="SimulationOutput.G4", TString outFile="SimulationOutput.root" , Int_t split = 1, Int...
#include <math.h> #include <conio.h> #include <stdio.h> #include <locale.h> #include <stdlib.h> #include <string.h> #define ZEROABSC -273.15 #define ZEROABSF -459.67 float leTemperatura(int opcao); float converteTemperatura(int opcao, float *temperatura); int main(void) { setlocale (LC_ALL, "Portuguese"); float...
// This file has been generated by Py++. #ifndef UVector2_hpp__pyplusplus_wrapper #define UVector2_hpp__pyplusplus_wrapper void register_UVector2_class(); #endif//UVector2_hpp__pyplusplus_wrapper
#include<stdio.h> #include<stdlib.h> #define n 10 int arr[n]; void bubbleSort(int arr[]) { int x,i,j,k; for(j=0;j<=n-1;j++) { for(i=0;i<=n-j-1;i++) { if(arr[i]>arr[i+1]) { x=arr[i]; arr[i]=arr[i+1]; arr[i+1]=x; } } } printf("\n%sorted array is"); for(k=0;k<=n-1;k++) { print...
// // ExifShellExt - Exif data shell extension // Copyright (C) 2008 Michael Fink // /// \file ExifRewriter.cpp EXIF data rewriter for JFIF files // // includes #include "stdafx.h" #include "ExifRewriter.hpp" #include <ulib/stream/EndianAwareFilter.hpp> void ExifRewriter::OnBlock(BYTE bMarker, WORD wLength) { if (...
// // Created by gadi on 07/01/2020. // #ifndef SEARCHALGORITHMS__CACHEMANAGER_H_ #define SEARCHALGORITHMS__CACHEMANAGER_H_ /** * CacheManager: interface. * @tparam Problem mostly string * @tparam Solution mostly string */ template<class Problem, class Solution> class CacheManager { public: virtual bool isExis...
#include<opencv2\core.hpp> #include<opencv2\highgui.hpp> #include <iostream> #include <fstream> #include <iomanip> #include <LinearEquations.h> #include <interpolation.h> using namespace cv; using namespace std; double* readTraitFile(string filename, int TraitNum){ //第i个特征点的x坐标在2*i,y坐标在2*i+1,i=0,1...TraitNum-1 ifst...
// // Created by tyan on 1/31/18. // #ifndef MYSQL_CPP_RESUTSET_H #define MYSQL_CPP_RESUTSET_H #include <vector> #include <mysql/mysql.h> #include <memory> #include <string> #include "sqlexception.h" using std::vector; using std::string; using std::shared_ptr; class StatementWrap; class ResultSet { public: e...
#include "VoxelChunk.h" #include <DataHandling/MeshShapes.h> #include <glm/gtc/matrix_transform.hpp> #include <iostream> VoxelChunk::VoxelChunk(const Array3D<uint32_t>& data, const glm::vec3& position) :m_VoxelData{data} ,m_Position{position} { } void VoxelChunk::GenerateMesh() { Mesh* cubeMesh = CreateCubeMesh(1....
#include <bits/stdc++.h> using namespace std; struct node { int data; struct node *l; struct node *r; node(int val) { data = val; l = NULL; r = NULL; } }; bool isIdentical(node *&root1, node *&root2) { if (root1 == NULL && root2 == NULL) { return true...
/* Author: Collin Dietz Date: 3/28/17 */ #ifndef QUICKSORT_CPP #define QUICKSORT_CPP #include<vector> #include"quicksort.h" using namespace std; //swap function template<class T> void swap(vector<T>& v, int a, int b) { T temp = v.at(a); v[a]= v.at(b); v[b]= temp; } //partition function, chooses r as partition t...
#include<bits/stdc++.h> using namespace std; int countWaysToMakeChange(int n,int* d,int nd, int** output)// we need 2D array because we are storing two information(n,denominations array size) { // required value is 0 we will return d0 coin if(n==0) { return 1; } if(nd == 0)// no denomination coins are given ...
#include "Application.h" #include <iostream> #include "HelperFunctions.h" #include <string> #include <fstream> #include <libgen.h> #include <cstring> #include <sstream> #include <ostream> using namespace std; #define AL_DEFAULT_MAX_PACKET_SIZE 1024 #define AL_DEFAULT_SERIAL_PORT 0 #define AL_DEFAULT_MAX_RECONNECTS 3...
/**************************************************************************** TinyFSK Version 1.0.1 Copyright (C) 2013 Andrew T. Flowers K0SM 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 wi...
// This file has been generated by Py++. #include "boost/python.hpp" #include "generators/include/python_CEGUI.h" #include "ListHeaderSegment.pypp.hpp" namespace bp = boost::python; struct ListHeaderSegment_wrapper : CEGUI::ListHeaderSegment, bp::wrapper< CEGUI::ListHeaderSegment > { ListHeaderSegment_wrapper(:...
// This file is subject to the terms and conditions defined in 'LICENSE' in the source code package #include <gtest/gtest.h> #include "core/orientation.h" #include "core/coordinate_tuple.h" namespace jactorio { TEST(Orientation, Construct) { const Orientation orien = Orientation::up; EXPECT_EQ(o...
#define _WINSOCK_DEPRECATED_NO_WARNINGS #include <iostream> #include <cstdlib> #include <winsock2.h> #include <string> using namespace std; #define endl "\n" int main(int argc, char *argv[]) { WSADATA wsaData; hostent *host; SOCKADDR_IN addr; string IP_addr; if (WSAStartup(MAKEWORD(2, 2), &wsaDa...
#include <etw/etw_providers.h> // Turns the DEFINE_GUID for EventTraceGuid into a const. #define INITGUID #include <WinSock2.h> #include <evntcons.h> #include <evntrace.h> #include <guiddef.h> #include <wbemidl.h> #include <wmistr.h> #include <string> #include <vector> #include "etw_session_base.h" #include "etw_p...
#include "Earth.h" /*! * Draw quad large enough to always seem like there is an earth below the road */ void Earth::DrawObject() { glBindTexture(GL_TEXTURE_2D, Textures::GetInstance()->GetTextures()[2]); glBegin(GL_QUADS); glTexCoord2f(0, 1000); glVertex3f(-10000, -0.03, 10000.0); glTexCoord2f(100...
#include<iostream> using namespace std; int dp[21]; int dp2[21]; int missile[20]; int n; int main() { n=0; while(!cin.eof()) { cin >>missile[n++]; dp[n-1]=dp2[n-1]=0; } dp[0]=dp2[0]=1; for(int i=0;i<n;i++) { for(int j=0;j<i;j++) { if(missile[j]>missile[i]) { dp[i]=max(dp[i],dp[j]+1); } ...
/*Write a program in C++ to swap two numbers. Sample Output: Swap two numbers : ----------------------- Input 1st number : 25 Input 2nd number : 39 After swapping the 1st number is : 39 After swapping the 2nd number is : 25 */ #include<iostream> using namespace std; int main() { int a=25, b=39; int c; c...
#include "SDL_main.h" #include "Common.h" #include "Testing.h" #include "Log.h" #include "Server.h" #include "Client.h" #include "Mapper.h" #include "AppGui.h" #include "IniFile.h" #include "Settings.h" #include "ResourceConverter.h" #include "BuildSystem.h" #include "Version_Include.h" static void DockS...
/********************************************************************** * Program: randFun2.cpp * Author: Jason Cearley * Class: CS161 * Date: 11/05/14 * Modified: 11/05/14 * Description: This program will generate a random number b/w a user * entered min and max value using a function with * pointers ...
/******************************************************************************* * Cristian Alexandrescu * * 2163013577ba2bc237f22b3f4d006856 * * 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ...
#include <bits/stdc++.h> using namespace std; using ll = long long int; bool cmp(ll a, ll b){ return labs(a) > labs(b); } void solve(){ int n; cin >> n; vector<ll> v(n), vp, vn; ll neg = 0; for(ll &x : v) { cin >> x , neg += (x <= 0); if(x >= 0) vp.push_back(x); else vn.p...
void leggiEeprom() // legge l'ultimo stato di funzionamento registrato .. { azione1 = EEPROM.read(bitStart+1); // legge i valori memorizzati per azione1 azione2 = EEPROM.read(bitStart+2); // legge i valori memorizzati per azione2 azione3 = EEPROM.read(bitStart+3); // legge i valori memorizzati per azione3 ...
#include <string> #include <vector> #include <algorithm> using namespace std; long long solution(string expression) { long long answer = 0; vector<char> oper_list = { '*','+','-' }; // next_permutation 사용시 정렬 되어있어야함. vector<char> oper; vector<long long> number; string num = ""; for (int i = 0 ;i < expression.s...
int i; int main() { if (i) ; else { cout << "hello" } }
#ifndef Cube_H #define Cube_H #include <QGLWidget> class VertexPoints : public QObject{ Q_OBJECT public: VertexPoints(GLfloat x, GLfloat y, GLfloat z, const QColor &color) : vertex({x, y, z}), color(color) {} QColor color; GLfloat vertex[3]; public slots: void ChangeVertex(GLfloat x, GLfl...
/** * * * * @author Sam Shull <http://samshull.blogspot.com/> * @version 0.1 * * @copyright Copyright (c) 2011 Sam Shull <http://samshull.blogspot.com/> * @license <http://www.opensource.org/licenses/mit-license.html> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of...
#pragma once #include <functional> #include <netinet/in.h> enum EUserErrorCodes { kUserErrorOk = 0, kUserErrorTooLong, kUserErrorAlreadyExists, kUserErrorInvalidCredentials, kUserErrorInvalidAuthKey, kUserErrorUnauthorized, kUserErrorForbidden, }; struct Socket { u...
/* Author: Nayeemul Islam Swad Idea: - https://github.com/jebouin/CompetitiveProgramming/blob/master/Olympiad/POI/POI10%20sums.cpp */ #include <bits/stdc++.h> using namespace std; #define debug(a) cerr << #a << ": " << a << endl typedef long long ll; typedef pair<int, int> pii; #define x first #define y sec...
/* ** Copyright (c) 2016, Xin YUAN, courses of Zhejiang University ** All rights reserved. ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the 2-Clause BSD License. ** ** Author contact information: ** yxxinyuan@zju.edu.cn ** */ /* This file contains ...
#include "TurnDown.h" TurnDown::TurnDown(Snake &snake, Body body[], Map &map) :snake(snake), body(*body), map(map) { } void TurnDown::Execute() { if (snake.AteSomething()) { snake.BasicBodyMove(&body); for (int a = 1; a < snake.End(); a++) { snake.snakeBody[a].IncreaseYCoordinates(); if (snake.snake...
#ifndef GAMEINSTANCE_H #define GAMEINSTANCE_H #include <QObject> #include "piece.h" #include <queue> #include <cstdlib> #include <algorithm> #include <QTimer> using namespace std; class gamewindow; class GameInstance : public QObject{ Q_OBJECT public: GameInstance(); ~GameInstance(); void startGr...
#ifndef __TIMER_H__ #define __TIMER_H__ #include "Globals.h" #include "SDL\include\SDL.h" class Timer { public: // Constructor Timer(); void Start(); void Stop(); void Pause(); void UnPause(); Uint32 Read(); Uint32 ReadSc(); void SetMultiplier(float t); private: bool running; bool paused; Uint32 st...
#ifndef WIZINDEX_H #define WIZINDEX_H //#include "wizmisc.h" #include "wizobject.h" #include "cppsqlite3.h" #include <map> #include <set> #define WIZ_DATABASE_VERSION "1.0" #define WIZ_NO_OBSOLETE struct WIZDATABASEINFO { // optional QString bizName; QString bizGUID; // required, p...
// 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 <string> using namespace std; class Solution { public: string defangIPaddr(string address) { string str; for (auto c : address) { if (c == '.') str += "[.]"; else str += c; } return str; } };
#ifndef PROYECTO_SDL2_DERIVADA_AUDIO_H #define PROYECTO_SDL2_DERIVADA_AUDIO_H #include "../base/audio_base.h" class Audio:public Audio_base { private: Audio(); public: }; #endif
#ifndef __SETTING_SCENE_H__ #define __SETTING_SCENE_H__ #include "cocos2d.h" #include "cocos-ext.h" using namespace cocos2d; class SettingScene: public cocos2d::CCLayer { public: SettingScene(); virtual ~SettingScene(); static CCScene* scene(); virtual bool init(); CREATE_FUNC(SettingScene); // a selector ...
/******************************************************************************** ** Form generated from reading UI file 'display.ui' ** ** Created by: Qt User Interface Compiler version 5.0.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! *******************************************...
/** * // This is the MountainArray's API interface. * // You should not implement it, or speculate about its implementation * class MountainArray { * public: * int get(int index); * int length(); * }; */ class Solution { public: int findPeak(MountainArray &arr) { int n = arr.leng...
/* Author: Kevin Hawkins Date: 4/2/2001 */ #ifndef __GUI_H #define __GUI_H #include "font.h" #include "h.h" #include "texture.h" class CGUI { private: int ms_left; int enemiesLeft; CFont *font; CFont *crosshair; CFont *endText; public: CGUI(); ~CGUI(); void set_seconds_left(in...
// Matt Geyer // CS 477 Algorithms HW 5 // Segmented Least Squares // // Do segmented least squares using dynamic programming #include <iostream> #include <fstream> #include <vector> using namespace std; class point{ public: float x,y; point( float , float ); void print(); }; point::point( float cx , ...
#ifndef MAP_H #define MAP_H_ #include <QImage> #include <QRect> class map { public: map(int, int); ~map(); //MAP CONSTRUCTOR QRect getRect(); QImage & getImage(); //IMAGE GET private: QImage image; QRect rect; int po...
// // Created by Ji Li on 2017/9/9. // #ifndef CRSIM_GRAPH_H #define CRSIM_GRAPH_H #include "../global/include.h" const int MAX_NODE_NUM = 110;// maximum number of nodes class Edge { public: int start; //start node int end; //end node int capacity; //capability of each edge int remain; //remaining c...
#include <iostream> #include <cstdio> using namespace std; //definicao da struct typedef struct aluno { long int matricula; char nome [70]; double nota [3]; int faltas; double frequencia; } Taluno; int main () { Taluno aluno[60]; int nalunos; int imaior=0, imenor=0; cout<<"Digite...
// // Loger.h // RNN // // Created by Daniel Solovich on 1/11/18. // Copyright © 2018 Daniel Solovich. All rights reserved. // #ifndef Loger_h #define Loger_h #define DEBUGGER_MODE 1 #if DEBUGGER_MODE == 1 #define LOG(x) std::cout << x << std::endl #else #define LOG(x) #endif #endif /* Loger_h */
#ifndef IMAGEPROPERTIESEDITOR_H #define IMAGEPROPERTIESEDITOR_H #include <QDialog> #include <QSqlDatabase> #include <QSqlQuery> #include <QSqlRecord> #include <QDebug> #include <QMessageBox> #include <QSqlTableModel> #include "Global.h" namespace Ui { class ImagePropertiesEditor; } class ImagePropertiesEditor : publ...
#include<cstdio> #include<iostream> using namespace std; int city[1010]; int find_father(int n) //查找祖先节点,当节点记录的祖先是自己,则表示查找到祖先了 { if(city[n] == n) { return n; } return find_father(city[n]); } void merge_ab(int a,int b) //合并节点:设置共同祖先 { int x = find_father(a); int y = find_father(b); i...
/* Bullet Continuous Collision Detection and Physics Library Maya Plugin Copyright (c) 2012 Advanced Micro Devices, Inv. 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. Permission is g...
class JournalReference: public Reference{ private: int journalYear; int number; public: JournalReference(string _lastName, string _firstName,string _title, string _edPlace, string _editor, int _year, int _yearJournal, int _number) :Referenc...
#include <stdio.h> const int value = 500000; int arr[40]; int cache[40][value*2]; int n; int s; int func(int pos, int sum) { if(pos == n) { if(sum == s) return 1; else return 0; } if((sum < value) && (sum > -value)) if(cache[pos][sum+value] != -1) return cache[pos][sum+value]; int ret = func(p...
#include <iostream> #include "Contest.hpp" int main() { CContest obj; obj.start(); std::cout << std::endl << "Done."; std::cin.get(); }
/************************************************************* * > File Name : c1066_2.cpp * > Author : Tony * > Created Time : 2019/09/17 13:01:17 * > Algorithm : math **************************************************************/ #include <bits/stdc++.h> using namespace std; type...
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // # DARK PLUGIN - POWERED BY FIRE TEAM // # GAME SERVER: 0.97.40T (C) WEBZEN. // # VERSÃO: 1.0.0.0 // # Autor: Maykon // # Skype: Maykon.ale //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // # O S...
#include <stdio.h> #include <sys/mman.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <monkit.h> #include <semaphore.h> #include <time.h> #include <queue> #include "dmaManager.h" #include "FlashIndication.h" #include "FlashRequest.h" #define SEGNUM 4 #define VERBOSE tru...
#ifndef FLOW_EXPRESSIONS_EQUALEXPRESSION_HPP #define FLOW_EXPRESSIONS_EQUALEXPRESSION_HPP #include "expressions/binary_expression.hpp" #include "expressions/expression.hpp" #include "expressions/scope.hpp" namespace flow { class EqualExpression : public BinaryExpression { public: EqualExpression(ExpressionPtr left...
// Fill out your copyright notice in the Description page of Project Settings. #include "BBGameMode.h" #include "BBPlayerState.h" #include "Kismet/GameplayStatics.h" #include "BallBoyController.h" ABBGameMode::ABBGameMode(const FObjectInitializer& ObjectInitializer) :Super(ObjectInitializer) { DefaultPawnClass = AB...
#pragma once #define DIALOG 101 #define IDT_QTEXT 1001 #define IDG_GROUP 1003 #define CHECKDIALOG 105 #define RADIODIOALOG 103 #define CHECK0 1010 #define RADIO0 1004 #define CTEXT 1015 #define RTEXT 1009 #include <windows.h> #include "Field.h" #include <algorithm> #include <string> #include "Question.h" #include <n...
#include "WindowsTimer.h" #include <windows.h> #include <assert.h> CTimerImplementation* NTimer::CreateTimer() { return new CWindowsTimer; } CWindowsTimer::CWindowsTimer() : m_iStartTicks( -1 ) , m_iTicksPerSecond( 0 ) { LARGE_INTEGER iTicksPerSecond; QueryPerformanceFrequency( &iTicksPerSecond ); m_iTicksPerSe...
#ifndef MESH_H #define MESH_H #include "ray.h" #include <iostream> #include <surface_mesh/surface_mesh.h> #include <string> #include <vector> #include <Eigen/Core> #include "opengl.h" class BVH; class Shader; class Mesh : public surface_mesh::Surface_mesh { using Vector3f = Eigen::Vector3f; using Vector2f ...
#pragma once #include "Models.h" #include "Shaders.h" #include "Texture.h" #include "Constant.h" #include <map> #include <vector> #include <string> class EnemyData { public: EnemyData(); EnemyData(std::shared_ptr<Models> model, std::shared_ptr<Shaders> shader, std::shared_ptr<Texture> texture); ~EnemyData(); std:...
#ifndef _NEAREST_NEIGHBOUR_ #define _NEAREST_NEIGHBOUR_ #include <math.h> #include <float.h> namespace NN { class NearestNeighbour { public: NearestNeighbour(void) : distance(0), shortest_distance(0), smallest(DBL_MAX) { } double EuclideanDistance(const Vector_2D<>& test, const Vector_2D<>& train...
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "wyarray.h" double *vector_init_double (double a, int n) { double *x=(double *)malloc(n*sizeof(double)); for (int i=0; i<n; i++) x[i]=a; return x; } double **matrix2d_init_double (...
#include<iostream> #include<conio.h> #include<stdlib.h> #include<math.h> #include<GL/glut.h> using namespace std; int tx,ty,angle,length; int init() { cout<<"ENTER THE INITAL POINT x - "; cin>>tx; cout<<"\nENTER THE INITAL POINT Y - "; cin>>ty; cout<<"\nENTER THE LENGTH OF TRRIANGLE...
#include "client.h" #include "../protocol/protocol.h" client::client(connection &con,connector &connect) : connect(connect),c(con) { } client::~client() { this->c.~connection(); this->~mutex_thread(); } void client::do_job() { while(this->running) { try{ protocol p; std::string tmp; tmp=p.propery_da...
// CodeGear C++Builder // Copyright (c) 1995, 2009 by Embarcadero Technologies, Inc. // All rights reserved // (DO NOT EDIT: machine generated header) 'Idhashmessagedigest.pas' rev: 21.00 #ifndef IdhashmessagedigestHPP #define IdhashmessagedigestHPP #pragma delphiheader begin #pragma option push #pragma option -w- ...
#include "Scene.h" Scene::Scene() { mBackColor = 0x4866ff; } void Scene::update(float dt) {} void Scene::draw() {} void Scene::onKeyDown(int keyCode) {} void Scene::onKeyUp(int keyCode) {} void Scene::onMouseDown(float x, float y) {} D3DCOLOR Scene::getBackColor() const { return mBackColor; }
#include "networking\Singularity.Networking.h" namespace Singularity { namespace Networking { IMPLEMENT_OBJECT_TYPE(Singularity.Networking, NetworkDelegate, Singularity::IDelegate); NetworkDelegate::NetworkDelegate(NetworkCallback callback) : m_pCallback(callback) { } void NetworkDelegate::Inv...
#include "MenuPage.hpp" MenuPage::MenuPage(StateManager& manager, nk_context* nk, const std::string &name) : manager(manager), nk(nk), name(name), area{0,0,0,0} { show(false); } MenuPage::~MenuPage() { nk_window_close(nk, name.c_str()); } void MenuPage::update(float deltaTime) { if (nk_begin(nk, &layout, name.c_...
#include<bits/stdc++.h> using namespace std; string solve(string s){ string ans = ""; stack<int> ind; unordered_map<int,bool> vis; for (int i = 0; i < s.length(); i++) { if(s[i]=='(') ind.push(i); if(s[i]==')'){ if(!ind.empty()) ind.pop(); else vis[i] = true; ...
#include <bits/stdc++.h> const int MAX_N = 1e5 + 10 ; struct data { int r , g , b ; void inf() { r = std::min(r , 255) ; g = std::min(g , 255) ; b = std::min(b , 255) ; } friend data operator +(data a , data b) {return (data){a.r + b.r , a.g + b.g , a.b + b.b} ;} ; friend data operator -(data a , data b) ...
#pragma once #include <string> #include "Command.hpp" #include "DataFormat.hpp" #include "AbstractDataProvider.hpp" #include "AbstractCommandHandler.hpp" #include "RenderController.hpp"
using namespace std; int test_print() { cout << "Hello Joshua." << endl; return 0; }
class MyInterval { public: int left, right; int prev, next; }*myinterval; int rmloss(int index) { return myinterval[index].right-myinterval[index].left; } int mrgloss(int index) { return myinterval[index].right-myinterval[myinterval[index].next].left; } class Operation { public: ...
/* PROJECT NAME:MR.Monitor 2 27/04/17 Marek Kiejza s00173510 Rebecca McGlynn S00173508 */ #include <Wire.h> #include "rgb_lcd.h" rgb_lcd lcd; const int colorR = 255; const int colorG = 0; const int colorB = 0; #include <Bridge.h> #include <BridgeServer.h> #include <BridgeClient.h> // Listen to the defaul...
#include <gtest/gtest.h> #include <string> using namespace std; int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); int status= RUN_ALL_TESTS(); fprintf(stderr, "done\n"); return status; } class MiscTest : public ::testing::Test { protected: virtual void SetUp() { } }; ...
#pragma once #include <string> #include "Interpolation.h" #include <vector> #include <fstream> #include <assert.h> #include <QMessageBox> /*! * \brief The PropertyType enum * class stores the properties which is used in ThermalProperties class */ enum class PropertyType { conductivity, viscosity, prandtl }; /*! * \...
/* Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Example 1: Input: s = "A man, a plan, a canal: Panama" Output: true Explanation: "amanaplanacanalpanama" is a palindrome. Example 2: Input: s = "race a car" Output: false Explanation: "raceacar" is n...
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--){ int n; cin>>n; vector<int>arr(n); for(int i=0; i<n; i++)cin>>arr[i]; int m2=INT_MIN,m1=INT_MAX; for(int i=0; i<n; i++){ int curr = arr[i],lc=0,rc=0; int j=i-1,k...
#pragma once // MyShape command target enum DrawType{T_POINT,T_LINE,T_ELLIPSE,T_RECTANGLE} ; class MyShape : public CObject //为对象serializable 要CObject { DECLARE_SERIAL(MyShape) //为对象serializable 声明 public: MyShape();//要有无参数的构造函数 MyShape(DrawType type,CPoint &start,CPoint &end); void Draw(CDC * pDC); virtual ~MyS...
class Solution { int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } public: string fractionAddition(string expression) { vector<int> numerator; vector<int> denominator; int sign = 1; int left = 0; while(left < expre...
/****************************************************************************** * * Copyright (c) 2017, the Perspective Authors. * * This file is part of the Perspective library, distributed under the terms of * the Apache License 2.0. The full license can be found in the LICENSE file. * */ #include <perspecti...
class Solution { public: string removeKdigits(string num, int k) { string res = ""; // string works as stack: pop_back int n = num.size(), keep = n - k; for (char c : num) { while (k && res.size() && res.back() > c) { // maintain increasing stack // remove the la...
#include <iostream> using namespace std; class BaseClass1 { public: void func1() { cout << "BaseClass1::func1()" << endl; } }; class BaseClass2 { public: void func1() { cout << "BaseClass2::func1()" << endl; } void func2() { cout << "BaseClass2::func2()" << endl; } }; //派生类继承Base1、Ba...
// // Copyright Jason Rice 2019 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // #ifndef NBDL_DETAIL_COOKIE_PARSER_HPP #define NBDL_DETAIL_COOKIE_PARSER_HPP #include <cwctype> #include <string_view> namespace...
/* * AtomIndex.cpp * * Created on: May 26, 2011 * Author: marchi */ #include "AtomIndex.h"
#include <iostream> using namespace std; // Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: bool hasCycle1(ListNode *head) { ListNode * m = head; ListNode * t = head; ...
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int max_x =0; int* arr = new int[200000](); for(int i=0;i<n;i++) { int x,y; cin >> x >> y; if(x > max_x) { max_x=x; } if(arr[x/2] < y) { arr[x/2]= y; } } int area = 0; for(int i=(max_x/2) -1;i>=0 ;i--) { if( i...
// 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 <cstdio> int main() { int arr[20] = { 20, 46, 98, 38, 13, 66, 71, 92, 23, 90, 3, 74, 8, 88, 63, 73, 79, 19, 11, 28 }; int len = 20; // ASC int j, tmp; for(int i = 1; i < len; i++) { // WARNING: 插入只能倒着来 j = i; tmp = arr[i]; while(j > 0 && tmp < arr[j-1]) { // ATTENTION 若以arr[...