text
stringlengths
8
6.88M
/** * Copyright (c) 2014, Timothy Stack * * 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 copyright notice, this * list of condi...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2002-2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** */ #ifndef ES_UTILS_ESSCHED_H #define ES_UTILS_ESSCHED_H #inclu...
#ifndef WINDOWRECOGNIZER_HH_ #define WINDOWRECOGNIZER_HH_ #include "Window.hh" #include "AudioInputController.hh" #include "WidgetRecognitionArea.hh" #include "WidgetComparisonArea.hh" #include "WidgetStatus.hh" #include "RecognizerListener.hh" #include "RecognizerProcess.hh" #include "RecognizerStatus.hh" #include <...
#include <gtest/gtest.h> #include <vm/mix_generic_word.h> namespace mix { TEST(GenericWordTestSuite, set_positive_address) { GenericWord<5> word; word.set_address(70); EXPECT_EQ(1, word.bytes[0]); EXPECT_EQ(6, word.bytes[1]); EXPECT_EQ(Sign::Positive, word.sign); } TEST(GenericWordTestSuite, set_negativ...
#ifndef _GameOverProc_H_ #define _GameOverProc_H_ #include "BaseProcess.h" class GameOverProc :public BaseProcess { public: GameOverProc(); virtual ~GameOverProc(); virtual int doRequest(CDLSocketHandler* clientHandler, InputPacket* inputPacket,Context* pt) ; virtual int doResponse(CDLSocketHandler* clientH...
#include "widget.h" #include <QApplication>//包含应用程序类 //main函数程序入口 //arg命令行变量的数量 agv命令行变量数组 int main(int argc, char *argv[]) { //a为应用程序对象 QApplication a(argc, argv); //窗口对象 Widget w; w.show(); //让a进入消息循环 return a.exec(); }
/** Kabuki SDK @file /.../Source/Kabuki_SDK-Impl/_G/Scene.h @author Cale McCollough @copyright CopYright 2016 Cale McCollough © @license Read accompanying /.../README.md or online at http://www.boost.org/LICENSE_1_0.txt */ #pragma once #include <string> #include "LaYer.h" #include "Enti...
#ifndef MyTruthAnalysis_HelperFunctions_H #define MyTruthAnalysis_HelperFunctions_H // xAOD #include <xAODTruth/TruthParticle.h> #include <xAODJet/JetContainer.h> #include <xAODJet/Jet.h> #include <exception> namespace TruthAna { class TauIsNotFinalOrDecayNoNeutrino : public std::exception { }; cons...
#include <cstdlib> #include <time.h> #include "MazeGenerator.h" #include "MazePointStack.h" MazePointStack stack; MazeGenerator::MazeGenerator(void) { srand(time(NULL)); } MazeGenerator::~MazeGenerator(void) { } int** MazeGenerator::getMaze() { return _maze; } void MazeGenerator::generateNewMaze(int width, int ...
#include<iostream> #include "Poco/Net/HTMLForm.h" #include "Poco/URI.h" #include "Poco/Net/HTTPClientSession.h" #include "Poco/Net/HTTPRequest.h" #include "Poco/Net/HTTPResponse.h" #include "Poco/StreamCopier.h" #include "Poco/Net/NetException.h" void pocoPost1() { Poco::Net::HTMLForm form1; form1.add("a...
#pragma once #include "plbase/PluginBase.h" #include "CEntity.h" #pragma pack(push, 4) class PLUGIN_API CDummy : public CEntity { public: }; #pragma pack(pop) VALIDATE_SIZE(CDummy, 0x38);
#include <iberbar/Paper2d/Transform.h> iberbar::Paper2d::CNodeTransform::CNodeTransform() : m_floatx_Anchor( 0.0f, 0.0f ) , m_floatx_Pivot( 0.0f, 0.0f ) , m_floatx_Position( 0.0f, 0.0f ) , m_floatx_ContentSize( 0.0f, 0.0f ) , m_floatx_Scaling( 1.0f, 1.0f ) , m_vec_Anchor() , m_vec_Pivot() , m_vec_Scaling() ...
#pragma once #include "hardware/i2c.h" #include "hardware/irq.h" #ifdef __cplusplus extern "C" { #endif void pi_alarm_init(uint alarm_num, irq_handler_t callback, uint32_t delay_us); // declaring it static inline seems to fix the fluttering problems static inline void pi_alarm_rearm(int alarm_num, uint32_t delay_...
/* Copyright (c) 2014 Mircea Daniel Ispas This file is part of "Push Game Engine" released under zlib license For conditions of distribution and use, see copyright notice in Push.hpp */ #pragma once #include "Math/Vector.hpp" #include <cstdint> namespace Push { class Touch { public: enum...
#include<bits/stdc++.h> #define rep(i,n) for (int i =0; i <(n); i++) using namespace std; using ll = long long; int main(){ int N,W; cin >> N >> W; //方針:まずは各時刻の配列を用意する //入力を受け取ったら、Timetable[S]は加算、Timetable[T]をPだけ減算する //累積和を取り、数字がWを超えたらNoを出力する vector<int>Time_table(200100,0); ...
// task3.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. // #include "pch.h" #include <iostream> #include <cstdio> #include <time.h> using namespace std; int main(int argc, char *argv[]) { int i = 0; time_t Time = 0;// для sub и add time_t Time1 = 0, Time2 = 0; // ...
#ifndef GAMELOGIC_H #define GAMELOGIC_H #include <vector> #include "gamecell.h" #include <unordered_map> class GameLogic { public: static void handleCellRevealed(std::vector<std::vector<GameCell*>> &gameBoard, GameCell* cell); private: static void addNeigbors(std::vector<std::vector<GameCell*>> &gameBoard, G...
#include <iostream> #include "shape.h" #include"twoD.h" using namespace std; main(){ two2D o; }
// This file was generated based on /Users/r0xstation/18app/src/.uno/ux13/app18.unoproj.g.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.UX.PropertyAccessor.h> namespace g{namespace Uno{namespace UX{struct PropertyObject;}}} namespace g{namespace Uno{namespace UX{stru...
#include <cstdio> #include <iostream> #include <vector> #include <string> #include <stack> using namespace std; struct TreeNode{ int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL){} }; int solve(TreeNode *node, int sum){ int sum = sum*10+node->val; if(node == NULL...
#include<cstdio> #include<malloc.h> #include<stdlib.h> #include<conio.h> struct node { int a; struct node *next; }; void insert(struct node **ptr,int data) { struct node *newnode,*temp; if(*ptr == NULL) { (*ptr) = (struct node *)malloc(sizeof(struct node...
#pragma once #include "CShader.h" #include "TScopedResource.h" #include "Noncopyable.h" class CShader; class CShaderResource : Noncopyable { public: CShaderResource(); ~CShaderResource(); bool Load( void*& shader, ID3D11InputLayout*& inputLayout, ID3DBlob*& blob, const char* filePath, const char* entryFu...
/* * Copyright (c) 2016-2021 Morwenn * SPDX-License-Identifier: MIT */ #ifndef CPPSORT_PROBES_ENC_H_ #define CPPSORT_PROBES_ENC_H_ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include <functional> #include <iterator> #include <...
#include <iostream> #include <algorithm> using namespace std; #define NUM 3 struct node { int a; int b; double c; }; bool cmp(node x, node y) { if(x.a != y.a) return x.a < y.a; if(x.b != y.b) return x.b > y.b; return x.c > y.c; } int main() { node nodeArr[NUM] = { {2, 2, 1.2}, {3, 4, 1.6}, ...
#pragma GCC optimize("Ofast") #include <algorithm> #include <bitset> #include <deque> #include <iostream> #include <iterator> #include <string> #include <map> #include <queue> #include <set> #include <stack> #include <vector> #include <unordered_map> #include <unordered_set> using namespace std; void abhisheknaiidu()...
#pragma once #include "PCH.hpp" #include "GameObject.hpp" class Tree : public GameObject { public: Tree(Game* game); void Update(); void Render(); void Clean(); };
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2009 Opera Software ASA. All rights reserved. * * This file is part of the Opera web browser. It may not be distributed * under any circumstances. */ #include "core/pch.h" #ifdef DOM_JIL_API_SUPPORT #include "modules...
#include "vertex_buffer.h" #include <Windows.h> #include <DirectXMath.h> #include "device.h" HRESULT VertexBuffer::initialize(UINT capacity, VertexBuffer::SimpleVertex* vertices, D3D11_PRIMITIVE_TOPOLOGY topology,const Device& device) { //-------------------- // 頂点バッファの定義 //-------------------- D3D11_BUF...
#include "dynamicbody.h" namespace sge { namespace physics { DynamicBody::DynamicBody(float x, float y, float width, float height) :Body(Type::Dynamic, x, y, width, height) { m_Speed = math::vec2(0,0); } DynamicBody::~DynamicBody(){} void DynamicBody::onUpdate() { Body::onUpdate(); } void DynamicBody::...
// // Created by gurumurt on 4/6/18. // #ifndef OPENCLDISPATCHER_SELECTION_H #define OPENCLDISPATCHER_SELECTION_H #endif //OPENCLDISPATCHER_SELECTION_H #include <cstring> #include "../Environment.h"; #include "../globals.h"; class selection_kernel { public: string name = "selection"; string kernel_src; ...
#include <bits/stdc++.h> using namespace std; #define LimSUP 1e15 #define LimINF 31622777 unsigned long long int cuantos; vector<unsigned long long int> criba(LimINF); vector<unsigned long long int> primos; vector<unsigned long long int> factores(1003); vector<unsigned long long> enes(1003); vector<b...
/* * BHMain.cpp * * Created on: Aug 26, 2014 * Author: ushnish * Copyright (c) 2014 Ushnish Ray All rights reserved. */ #include "dmc.h" #define MPI using namespace std; extern int setup(int rank, string baseSpecFile); int main(int argc,char* argv[]) { #ifdef MPI if(argc<2) { cout<<"Format is: <f...
#include "game.hpp" int main(int argc, char* args[]) { Game game; return 0; }
#ifndef COMMON_TESTS_PATHAPPENDERTEST_H #define COMMON_TESTS_PATHAPPENDERTEST_H #include "AutoTest.h" namespace common { namespace util { namespace tests { class PathAppenderTest final : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase_data(); void combineTest(); void operatorTest(); }...
// proyecto bomba de agua // Control con transistor C2344 // Etapa de potecia por relevador controlado por transistor int baseAgua=45; int entCisterna = A7; // int tinAlto =A6; // int tinBajo =A5; // int tinOut=12; int b_apagada=11; int a_cisterna= 3; int tran=2; int estado; //1-lleno, 2-Vacio, 3-Sin agua int cisSi...
#include "EventHandler.hpp" EventHandler::EventHandler(){ m_eventRunning = false; m_eventLoaded = false; ResourceManager& rm = ResourceManager::GetInstance(); m_textFont = rm.loadFont("default22", "data/default.ttf", DRAW_TEXT_SIZE); m_titleFont = rm.loadFont("default26", "data/default.ttf", DRAW_TEXT_SI...
#pragma once class Fade; class MusicFade; class LoadBalancingListener; class ModeSelect; class ExchangeData; class backParticle; class GameCursor; class ReturnButton; class NetPVPMode :public GameObject { public: NetPVPMode(); void init(std::vector<std::string > files, int monai[3], int moid[3],int aimode[3]); boo...
#include<bits/stdc++.h> using namespace std; #define MOD 1000000007 #define pb push_back #define mp make_pair #define fi first #define se second typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--) { int n,m; cin>>n>>m; int P[n+1][...
/* -*- coding: utf-8 -*- !@time: 2019-09-16 14:58 !@author: superMC @email: 18758266469@163.com !@fileName: 0001_find_num_in_two_dims_array.cpp */ #include "environment.h" class Solution { public: bool Find(int target, vector<vector<int> > array) { if (array.size() == 0) { return false; ...
// Created on: 1995-12-01 // Created by: EXPRESS->CDL V0.2 Translator // Copyright (c) 1995-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the te...
#include <iostream> #include <vector> using namespace std; class Solution { public: int trap(vector<int>& height) { int N = height.size(); vector<int> left(N, 0), right(N, 0); int leftLimit = 0, rightLimit = 0; for(int i=0;i<N;i++){ leftLimit = max(leftLimit, height[i]); ...
#include <glaux.h> #include <types.hpp> #include <windows.h> class CGL { private: HDC dc; HGLRC rc; public: CGL(); ~CGL(); void InitOpenGL(HWND hWnd); void Resize(HWND hWnd); void StopOpenGL(); void StartSceneDraw(); void StopSceneDraw(); void Light(int Light, float ...
#pragma once #include "Fornitual.h" class Sofa : virtual public Fornitual { public: Sofa(float l, float w, float h); void sit(); };
#include <stdio.h> #include <conio.h> #include <math.h> int main() { int a[50]; int i,n,p,nr; printf("Dati numarul de elemente ale tabloului mai mici sau egal cu 50:\n"); scanf("%d",&n); printf("Introducerea a %d elemente:\n",n); for(i=0;i<n;i++) { printf("a[%d]=",i+1); scanf("%d",&a[i]); } printf("\nTabloul este:"); ...
// Copyright (c) 2021 ETH Zurich // // SPDX-License-Identifier: BSL-1.0 // 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) #include <pika/init.hpp> #include <pika/modules/execution.hpp> #include <pika/testing.hpp>...
#ifndef LEVELINTERFACE_H_ #define LEVELINTERFACE_H_ #include "SceneInterface.h" #include "Player.h" class LevelInterface : public SceneInterface { public: LevelInterface(); virtual ~LevelInterface(); virtual void update(); }; #endif
#ifndef AD_CNMETHOD_H #define AD_CNMETHOD_H #include "../FDRegularMethod.hpp" #include "../implicit/EuroImplicitMethod.hpp" template<typename X> class EuroCNMethod : public FDRegularMethod<X> { protected: std::vector<X> *prev_K; std::vector<X> *cur_K; public: EuroCNMethod(Option<X> *_option, X xl, X xu,...
#include <bits/stdc++.h> using namespace std; vector <bool> kidsCandies(vector <int> &candies , int eCandies) { int n = candies.size() , mCandies = 0; for(int i = 0 ; i < n ; i++) if(candies[i] > mCandies) mCandies = candies[i]; vector <bool> result(n); for(int i = 0 ; i < n ; i++...
#ifndef DPDK_LOGGER_CLASS_METRIC_INTERFACE_H #define DPDK_LOGGER_CLASS_METRIC_INTERFACE_H #include "rte_eal.h" class MetricInterface{ public: MetricInterface(){} virtual ~MetricInterface(){}; // Initialize the Metrics library. A pointer can be supplied as a parameter virtual bool...
/* * ===================================================================================== * * Filename: branch.h * * Description: All branching related classes * * Version: 1.0 * Created: Monday 12 November 2012 09:30:29 IST * Revision: none * Compiler: gcc * * ...
#pragma once #include <boost/smart_ptr/shared_ptr.hpp> #include "Networking/General/SG_ClientSession.h" #include "Packets/MMO/Social/SocialPackets.h" class SG_ChatHandler { public: typedef enum { CHAT_NORMAL = 1, // normal, white chat CHAT_NORMAL2 = 2, // same CHAT_ALL = 3, // orange message CHAT_M...
#include <iostream> #include <vector> #include "utils.h" using namespace std; // 给定一个数组,将其中的奇数放在数组的左边,偶数放在数组的右边,且保持奇数与奇数的稳定性,偶数与偶数的稳定性 class OddEvenPartition { public: void reOrderArray(vector<int>& array) { vector<int> odd, even; for (int elem : array) { if (elem % 2 == 1) odd.emplace_back(elem); else ev...
#pragma once #include <Kinect.VisualGestureBuilder.h> #include <Kinect.h> #include <iostream> #include <list> #include <stdio.h> #include "renderer.h" #define FRAME_DEPTH 0 #define FRAME_COLOR 1 #define FRAME_INFRARED 2 #define FRAME_BODY 3 #define VIRTUAL_RECTANGLE_CORNER_L_X 0.05 #define VIRTUAL_RECTANGLE_CORNER_...
#include "Asteroid.h" Asteroid::Asteroid(SDL_Rect *r, SDL_Surface *s,double x, double y, double a,double sp):DynamicGameObject(r,s,x,y,a,sp) { health = 100*rect->w; damage = 10*rect->w; }
#pragma once #include <Sys/Signal_.h> #include "BaseElement.h" namespace Gui { class ButtonBase : public BaseElement { protected: enum eState { ST_NORMAL, ST_FOCUSED, ST_PRESSED }; eState state_; public: ButtonBase(const Vec2f &pos, const Vec2f &size, const BaseElement *parent); void F...
#ifndef ADJACENCY_MATRIX #define ADJACENCY_MATRIX 1 #include <stdexcept> #include "GraphAdjacencyBase.hpp" #include "include/list.hpp" #include "include/seq_linear_list.hpp" namespace cs202 { class AdjacencyMatrix : public GraphAdjacencyBase { private: LinearList<int> matrix; int v; bool is_vali...
#include "serveur.h" #pragma comment(lib, "ws2_32.lib") using namespace std; int main(int argc, char* argv[]) { u_short port; string pseudo; pthread_t thread1; pthread_t thread2; data serverData; cout << "Port: "; cin >> port; cout << "Pseudo: "; cin >> pseudo; serverData.mutex = PTHREAD_MUTEX_INITIALIZ...
// // Created by yutianzuo on 2018/5/8. // #ifndef USELIBCURL_GETREQUEST_H #define USELIBCURL_GETREQUEST_H #include "request.h" class HttpGetRequest : public HttpRequest<HttpGetRequest> { public: HttpGetRequest(HttpGetRequest &&rvalue) = delete; void operator=(HttpGetRequest &&) = delete; HttpGetReques...
/// \file NiCfRunAction.hh /// \brief Definition of the NiCfRunAction class; adapted from /// Geant4 example B5 B5RunAction.hh #ifndef NiCfRunAction_h #define NiCfRunAction_h 1 #include "G4UserRunAction.hh" #include "globals.hh" class NiCfEventAction; class G4Run; /// Run action class class NiCfRunAction : p...
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*- * * Copyright (C) 2003-2009 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. * * Morten Stenshorne */ #ifndef __X11_OPPAINTER_H__ #define __X11_OPPAINTER_H__ #inclu...
#include <iostream> #include "queue.h" // Creates an empty queue queue::queue(){ front = nullptr; back = nullptr; queue_size = 0; } // Copy constructor queue::queue(const queue& q){ front = nullptr; back = nullptr; node* new_node = q.front; queue_size = q.queue_size; wh...
//=========================================================================== //! @file model_base.h //=========================================================================== #pragma once //=========================================================================== //! @class ModelBase //==========================...
#include <Array.h> #include <iostream> using namespace std; int main(void) { Array<int> ta(102400); Array<int> tb = ta; for(int i = 0 ; i < 102400 ; i++) { tb[i] = i; } cout<<"data is:"<< tb.Data() << endl <<"base is:"<< tb.Base() << endl <<"le...
#include <iostream> using namespace std; class Fraction { friend ostream &operator<<(ostream &out, const Fraction &c); friend Fraction operator+(const Fraction &leftFrac, const Fraction &rightFrac); public: Fraction(int newNum=1, int newdeNum=1); Fraction& operator++(); Fraction operator++(int); //Fraction operat...
// https://oj.leetcode.com/problems/interleaving-string/ // Use DP class Solution { public: bool isInterleave(string s1, string s2, string s3) { int size1 = s1.size(), size2 = s2.size(), size3 = s3.size(); if (size3 != size1 + size2) { return false; } bool match...
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "CrearHistoria.h" #include "Clases.h" #include "TablasDatos.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TFor...
#include <torch/torch.h> #include <ATen/Context.h> #include <iostream> torch::Tensor ActivationFunction(const torch::Tensor &x) { // Sigmoid function. auto retVal = 1/(1+torch::exp(-x)); return retVal; } torch::Tensor SoftMax(const torch::Tensor &x) { auto sum = torch::sum(torch::exp(x),1); return torch::ex...
#include "DemoApp.h" #include "SceneManager.h" #include "CollisionChecker.h" DemoApp::DemoApp(void) { } DemoApp::~DemoApp(void) { } void DemoApp::OnStart() { AllocConsole(); FILE* pCout; freopen_s(&pCout, "conin$", "r", stdin); freopen_s(&pCout, "conout$", "w", stdout); freopen_s(&pCout, "conout$", "w", stde...
//Program Name: Triangle Challenge with Structures //Created by Kartik Nagpal - kn8767 - kartiknagpal@utexas.edu #include <iostream> #include <cmath> using std::cin; using std::cout; using std::endl; using std::string; struct triangle { float a; float b; float c; float Theta1; float Theta2; }; int solve(triangl...
#include <bits/stdc++.h> using namespace std; int n, m, p, a, b, f[10010]; int find(int x) {if (f[x] != x) f[x] = find(f[x]); return f[x];} int main() { scanf("%d%d%d", &n, &m, &p); for (int i = 1; i <= n; i++) f[i] = i; for (int i = 1; i <= m; i++) scanf("%d%d", &a, &b), f[find(b)] = find(a); for (int i = 1; i <= ...
#pragma once #include <unordered_map> namespace oglml { class PostProcessor; } namespace breakout { class APostEffectState; class PostEffectsStateManager { using EnumStateName = int; public: static PostEffectsStateManager& Get(); void Init(); void Begin(); void End(); void Draw(float dtMillis...
#pragma once #include <vector> #include <memory> #include <cstdint> namespace trevi { class Block { public: Block(){} Block( const Block& other ) { *this = other; } Block& operator = ( const Block& other ) { _data = other._data; ...
// Created on: 1993-01-11 // Created by: Christian CAILLET // Copyright (c) 1993-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2007 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** */ #ifndef PIFORMS_H #define PIFORMS_H class HTML_Element; class...
#include <iostream> #include <vector> #include <algorithm> #define mid lt + (rt-lt)/2 #define vx Element * using namespace std; struct Window { int y, r, l; char ble; }; Window make_window(int y, int l, int r, char ble) { Window *node = new Window; node->y = y; node->r = r; node->l = l; n...
#include "COtherCategory.h" COtherCategory::COtherCategory(QObject *parent) : CERPCategory(parent) { } COtherCategory::~COtherCategory() { } QString COtherCategory::Category()const { return QString::fromLocal8Bit("ÆäËû"); }
#pragma once #include"Padre.h" #include"PoderTeamA.h" #include<List> using namespace System::Drawing; using namespace std; class TeamA:public Padre { private: bool transparente; int puntoH; int puntoV; int AnchoI; int AltoI; public: TeamA(int x,int y,Bitmap^bmp); TeamA(); ~TeamA(); void S...
#include <iostream> #include <vector> #include <map> using namespace std; map<int, int> myMap; int c[200000]; void modMerge(int a[], int l, int m, int r) { int n = r-l+1, k, i, j; for(i=m, j=r, k=n-1; i>=l && j>m; ) { if(a[i] > a[j]) { map<int, int>::iterator it = myMap.find(a[i]); it->second += j-...
/* plane.cpp Colin Fitt -- cfitt -- C6312039 Course CpSci 1020, Prof. Catherine Hochrine Major Programming Assignment #3: Due 11:59pm Sunday, April 20th This program parses and loads the data for the plane structure. Also a printerer function. */ #include "ray.h" pparm_t plane_parse[] = { {"point", 3, sizeof(doubl...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 1995-2011 Opera Software ASA. All rights reserved. * * This file is part of the Opera web browser. It may not be distributed * under any circumstances. */ /* Cross-module security manager: DOM model Lars T Hansen....
#include "gtest/gtest.h" using namespace testing; class ConfigurableEventListener : public TestEventListener { protected: TestEventListener* eventListener; public: /** * Show the names of each test case. */ bool showTestCases; /** * Show the names of each test. ...
#pragma once #include "../stdafx.hpp" class CLI { public: CLI( void ) = default; bool RegisterCommand( const std::string& command ); bool RegisterHelpCommand( const std::string& command, const std::string& helper ); bool IsCommand( const std::string& command ) const; bool ...
#include "linear_form.hpp" #include "integration.hpp" namespace space { namespace { double EvalHatFn(double x, double y, Element2D *elem, size_t i) { auto bary = elem->BarycentricCoordinates(x, y); assert((bary.array() >= 0).all()); return bary[i]; } } // namespace std::array<double, 3> LinearForm::QuadEval(E...
#ifdef DEBUG #define _GLIBCXX_DEBUG #endif #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <ctime> #include <memory.h> #include <cmath> #include <string> #include <cstring> #include <queue> #include <vector> #include <set> #include <deque> #include <map> #include ...
#include "compiler/iterators.hpp" namespace perseus { namespace detail { istreambuf_multipass_position_iterator::istreambuf_multipass_position_iterator() { } /// Adapting an istreambuf_multipass_utf32_iterator istreambuf_multipass_position_iterator::istreambuf_multipass_position_iterator( istr...
////////////////////////////////////////////////////////////////////////////// // // Copyright (c) Triad National Security, LLC. This file is part of the // Tusas code (LA-CC-17-001) and is subject to the revised BSD license terms // in the LICENSE file found in the top-level directory of this distribution. // ////...
#include <iostream> using namespace std; int main() { int t, n, k, rem, sz, temp, r; string ans = ""; cin >> t; for (int i = 0; i < t; i++) { cin >> n >> k; rem = n % k; sz = n / k; for (int i = 0, r = 1; i < n; i++) { ans += (char)(96 + r); ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2005 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #include "core/pch.h" #ifdef SVG_SUPPORT #include "modules/svg/src/sv...
#pragma once #include <QObject> class CIOCPNet; class CMessageEventMediator; class CSoftUpgradeWidget; class CNetClass : public QObject { Q_OBJECT public: CNetClass(QObject *parent = 0); virtual ~CNetClass(void); static CNetClass* Instance(); CIOCPNet *m_pNetClt; CMessageEventMediator *m_pMessag...
#include <algorithm> #include <time.h> #include "stack_plate.h" /* * question: * Imagine a (literal) stack of plates. if the stack get too high, it might topple,therefore ,in real life, we would likely start a new stack when the previous stack exceeds some threshold, Implement a data structure, SetOfStack the mimics...
#include<iostream.h> #include<conio.h> #include<limits.h> int matrixmul(int a[],int n) { int k,l,m[10][10],s[10][10],q,i,j; for(i=1;i<n;i++) { m[i][i]=0; } for(l=2;l<n;l++) { for(i=1;i<(n-l+1);i++) { j=i+l-1; m[i][j]=INT_MAX; for(k=i;k<=j-1;k++) { q=m[i][k]+...
#include"mOpenCL.h" int main() { cl_device_type devtype = CL_DEVICE_TYPE_GPU; //cl_device_type devtype = CL_DEVICE_TYPE_GPU || CL_DEVICE_TYPE_ACCELERATOR; mOpenCL openCL_obj(devtype); cl_char slp; std::cout << "Enter a key to end the program." << std::endl; std::cin >> slp; return 0; }
#include <iostream> #include <stdlib.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> using namespace std; int main() { int rand1 = rand() % 10; int rand2 = rand() % 10; int id = shmget(69, 0x1000, IPC_CREAT | 0666); if (id == -1) { cout << "Page creation failed: " << id << endl; } else ...
#ifndef WALKENEMY_H #define WALKENEMY_H #include "Enemy.h" #include "../FrameTimer.h" namespace gnGame { /// <summary> /// 歩く敵 /// 一直線に歩いていく /// </summary> class WalkEnemy : public Enemy{ public: WalkEnemy(const Vector2 _pos, const ActorParameter _parameter); virtual ~WalkEnemy() = default; virtual void...
// This program is free software: you can use, modify and/or redistribute it // under the terms of the simplified BSD License. You should have received a // copy of this license athis program. If not, see // <http://www.opensource.org/licenses/bsd-license.html>. // // Copyright (C) 2017, Onofre Martorell <onofremartore...
// // Created by 钟奇龙 on 2019-05-14. // #include <iostream> #include <vector> using namespace std; int minSortLenght(vector<int> arr){ if(arr.size() < 2) return 0; int noMinIndex = -1; int minValue = arr[arr.size()-1]; for(int i=arr.size()-2; i>=0; --i){ if(arr[i] < minValue){ minVal...
/* * @lc app=leetcode.cn id=322 lang=cpp * * [322] 零钱兑换 */ // @lc code=start #include<iostream> #include<vector> #include<algorithm> using namespace std; class Solution { public: int coinChange(vector<int>& coins, int amount) { vector<int> dp(amount+1, -1); dp[0] = 0; // for(int i=0;...
#ifndef INPUTFIELD_H #define INPUTFIELD_H #include <SFML/Graphics.hpp> #include "Dimensions.h" //#include "Interface.h" using namespace sf; class InputField { public: InputField(Vector2f position, String text); ~InputField() {} bool isInside(Vector2f position); void createOutline(Vector2f pos); void draw(Rend...
#include "util.h" #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string> string formatString(const char *fmt, ...) { // Do a bunch of formatting. This part shamelessly stolen from the printf // man page. /* Guess we need no more than 100 bytes. */ int n, size = 100; char *p; va_li...
#pragma once #include "misc\Vector2.h" class Ref { public: const static int WIN_W[3]; const static int WIN_H[3]; static float pxRate; const static int FLD_W; const static int FLD_H; const static int ENEMY_MAX; const static int PLAYER_SHOT_MAX; const static int ENEMY_SHOT_MAX; const static int EFFECT_MAX; ...