text
stringlengths
8
6.88M
#include <bits/stdc++.h> using namespace std; string fractionDecimal(int n, int d) { cout << float(n/d) << " " << endl; return to_string(float(n / d)); } int main() { cout << fractionDecimal(1, 3) << endl; return 0; }
#pragma once #include "GraphNode.h" #include <vector> #include <iostream> #include <stack> #include <queue> class Graph { typedef std::vector<GraphNode*> NodeList; public: //Creates an empty graph Graph(); ~Graph(); //Creates a graph with the given number of nodes //the contents and links of the node...
/** * Jason Leake October 2019 */ #include "Median.h" #include <iostream> #include <list> #include <vector> #include <algorithm> #include <cassert> using namespace std; Median::Median(size_t window) : window(window) { reserve(window); } auto Median::getCount() -> unsigned long { return window; } auto Media...
#include <cstdio> #include <iostream> using namespace std; typedef long long ll; // #define DEBUG int n; void handle(int a) { // 递归基 if (!a) { cout << 0; return; } int i = 0; while ((1 << (i + 1)) <= a) ++i; // 特判2^1 if (i == 1) cout << 2; else { ...
/* * Constant.h * * Created on: 26 Dec 2015 * Author: admin */ #ifndef CONSTANT_H_ #define CONSTANT_H_ #include <string> const int MESSAGE_EXPIRE_TIME = 5; // Expiration time of send message const int MAX_SIM_TIME = 10; // Max simulation time @unit(s) const int QUERY_FREQUENCY = 30; // ...
/******************************************************************************* * Cristian Alexandrescu * * 2163013577ba2bc237f22b3f4d006856 * * 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ...
#include <bits/stdc++.h> #define MAX 1000000 using namespace std; using ii = pair<int,int>; vector<ii> G[MAX]; int distances[MAX]; int sssp_dijkstra(int source, int destiny, int N) { fill(distances, distances + N + 1, MAX); priority_queue< ii, vector<ii>, greater<ii> > to_visit; distances[source] = 0;...
#include <iostream> using namespace std; int main() { int A[10] = {6,3,8,10,16,7,5,2,9,14}; int H[16] = {0}; int k = 10; for(int i=0; i<10; i++){ if(H[k-A[i]] != 0 && k-A[i] >=0){ cout << A[i] << "+" << k-A[i] << "=" << k << endl; } H[A[i]]...
// // Created by 梁栋 on 2019-01-14. // #include <iostream> #include <vector> #include <queue> using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} ListNode* ListNodeFromVector(vector<int> xs){ ListNode* head = this; for(int i=0;i<xs.size(...
#include<bits/stdc++.h> using namespace std; bool Ispalindrome(string temp) { string temp2 = temp; reverse(temp2.begin(),temp2.end()); if(temp==temp2) { return true; } return false; } int solve(string s,int start,int index,string prev) { if(start > index) { return 99999; } if(index==s.size()) { if(I...
/** * \file Definitions.hpp * * \brief General definitions for the general processing library. * * German Research Center for Artificial Intelligence\n * Project: VirGo4 * * \date 30.10.2012 * * \author felix.rehrmann@dfki.de */ #ifndef TYPETOVECTOR_DEFINITIONS_HPP #define TYPETOVECTOR_DEFINITION...
// // user.cpp // progProject4 // // Created by Damir Mustafin on 13/11/15. // Copyright (c) 2015 Damir Mustafin. All rights reserved. // #include "user.h" #include "admin.h" using namespace std; User::User(string un, string pw){ username = un; password = pw; } bool User::Login(){ Administrator ...
#pragma once #include <tuple> #include <type_traits> #include <utility> #include <realm/core/archetype.hpp> #include <realm/core/world.hpp> #include <realm/util/tuple_util.hpp> #include <realm/util/type_traits.hpp> namespace realm { /** * @brief View * Describes a chunk view for iteration & manipulation of a singl...
// // MultiplayerOnlineGame - multiplayer game project // Copyright (C) 2008-2016 Michael Fink // /// \file MainGameLoop.hpp Main game loop // #pragma once // includes #include <SDL.h> #include <atomic> // forward references /// main game loop class MainGameLoop { public: /// ctor MainGameLoop(bool bUpdateFram...
// This file has been generated by Py++. #ifndef TreeItem_hpp__pyplusplus_wrapper #define TreeItem_hpp__pyplusplus_wrapper void register_TreeItem_class(); #endif//TreeItem_hpp__pyplusplus_wrapper
/* * BrusaCharger.cpp * * Copyright (c) 2013 Collin Kidder, Michael Neuweiler, Charles Galpin 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 limitat...
#pragma once #include <string> using namespace std; class Product { private: string name; int qty; double price; double amount; public: Product(); Product(string name, int qty, double price); string getName(); int getQty(); double getPrice(); double getAmount(); ~Product(); void calculateAmount(); };
//------------------------------------------------------------------------------ // Spacecraft //------------------------------------------------------------------------------ // GMAT: General Mission Analysis Tool. // // Copyright (c) 2002 - 2015 United States Government as represented by the...
/* * * @APPLE_LICENSE_HEADER_START@ * * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file...
#include "ch6.h" #include <debug.h> #include <KPluginFactory> K_PLUGIN_FACTORY_WITH_JSON(ch6Factory, "ch6.json", registerPlugin<ch6>(); ) ch6::ch6(QObject *parent, const QVariantList& args) : KDevelop::IPlugin(QStringLiteral("ch6"), parent) { Q_UNUSED(args); qCDebug(PLUGIN_CH6) << "Hello world, my plug...
// // ViewCopy.cpp // alfrid // // Created by Yi-Wen Lin on 2016/5/29. // // #include "ViewCopy.hpp" #include "Geom.hpp" ViewCopy::ViewCopy() : View("shaders/bigTriangle.vert", "shaders/copy.frag") { _init(); } void ViewCopy::_init() { mesh = Geom::bigTriangle(); } void ViewCopy::render(gl::Texture tex...
#pragma once #include <memory> #include <thread> #include <atomic> #include <QObject> #include <grpcpp/grpcpp.h> #include "client-server.grpc.pb.h" #include "qmlclientstate.h" #include "audiomodule.h" #include "qmlmissedcallsmodel.h" using grpc::Server; using grpc::ServerBuilder; using grpc::ServerContext; using grpc:...
#include <string> #include <iostream> #include "../game.h" #include "../gameStruct.h" // visit Game::buildBase for documentation void Game::researchBase(std::string desc, std::function<void(data::Resource &, data::Building &, data::Troop &, data::Army &)> & callBack, int time){ this->lg3.lock(); std:...
/************************************************************************* > File Name : SubjectAttribute.cpp > Author : YangShuai > Created Time: 2016年07月19日 星期二 18时21分49秒 > Description : ************************************************************************/ #include"Itsdata.h" #include"data_han...
// This file has been generated by Py++. #ifndef StdPairCEGUIStringString_hpp__pyplusplus_wrapper #define StdPairCEGUIStringString_hpp__pyplusplus_wrapper void register_StdPairCEGUIStringString_class(); #endif//StdPairCEGUIStringString_hpp__pyplusplus_wrapper
//Currency Conversion //4/3/2018 //Author: Brandon Seamer #include<iostream> int main() { double userBillfold; double yen; double pounds; double pesos; std::cout << "How much cash, do you have, in your billfold? (Numeric Characters Only)" << std::endl; std::cin >> userBillfold; yen = userBillfold * 82.34; p...
// Author: Markus Schordan // $Id: AstConsistencyTests.h,v 1.8 2008/01/25 02:25:46 dquinlan Exp $ #ifndef ASTTESTS_H #define ASTTESTS_H // DQ (12/7/2003): use platform independent macro defined in config.h // #include IOSTREAM_HEADER_FILE #include <iostream> #include "rosedll.h" #include "AstStatistics.h" // #includ...
#include "pch.h" #include "CppUnitTest.h" #include "..//MathsLib/Maths.h" #include "..//MathsLib/Vector4.h" #include "..//MathsLib/Vector2.h" using std::string; using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace MathsLib; namespace Tests { TEST_CLASS(TestVector4) { public: static con...
// CkAtom.h: interface for the CkAtom class. // ////////////////////////////////////////////////////////////////////// // This header is generated. #ifndef _CkAtom_H #define _CkAtom_H #include "chilkatDefs.h" #include "CkString.h" #include "CkMultiByteBase.h" class CkDateTime; class CkAtomProgress; ...
#ifndef BACHERO_GAME_LOOP #define BACHERO_GAME_LOOP #include <memory> #include <iostream> #include <exception> #include "Engine/Engine.h" #include "Engine/Common/FramerateLimiter.h" #include "Engine/Common/DeltaTime.h" #include "Engine/Render/Camera.h" #include "Game/Entities/Player.h" #include "Game/Entities/Box.h"...
#ifndef SORTING_H #define SORTING_H #include<iostream> #include<vector> #include<QtWidgets> #include<QWidget> class Sorting { public: Sorting(); void initialize(double,double,QGraphicsScene*,std::vector<double>,std::vector<double>,std::vector<QString>); void createRectangles(); void createRectanglesFa...
/******************************************************************* * CS 307 Programming Assignment 2 * Author: Benjmin hoang * Desc: traffic simulation * Date: 4/15/2017 * I attest that this program is entirely my own work *******************************************************************/ #include "...
#pragma once #include "Renderer.h" #include "Mesh.h" // Used to render mesh nodes class MeshRenderer : public Renderer { public: void SetMesh(shared_ptr<Mesh> mesh); void SetWorldTransformation(FXMMATRIX worldTransformation); void SetAmbientLight(XMFLOAT4 ambientLight); void SetDirectionalLight(FXMVECTOR lightVect...
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) { if (headA == nullptr || headB == nullptr) retu...
#ifndef _EVENT_H_ #define _EVENT_H #pragma once #define BIT(x) (1 << x) namespace bne { namespace events { #undef KEY_PRESSED #undef KEY_RELEASED #undef MOUSE_PRESSED #undef MOUSE_RELEASED #undef MOUSE_MOVED class Event { protected: enum class Type { KEY_PRESSED = BIT(0), ...
/************************************************************* * > File Name : P2324.cpp * > Author : Tony * > Created Time : 2019/08/25 20:37:04 * > Algorithm : IDA* **************************************************************/ #include <bits/stdc++.h> using namespace std; inlin...
/* 1380B s1,c1 s2,c2 ... ..... ... sn,cn --> comparisons for pos = 1 s2,c1 s3,c2 ... ... sn,cn-1 s1,cn --> comparisons for pos = 2 . . si,c1 ... sn,cn-i+1 ... sj-1,cn --> comparisons for pos = i . . sn,...
/**************************************************************************** ** Meta object code from reading C++ file 'realtimeplot.h' ** ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.6) ** ** WARNING! All changes made in this file will be lost! ********************************************************...
/* * Copyright (C) 2007-2015 Frank Mertens. * * Use of this source is governed by a BSD-style license that can be * found in the LICENSE file. * */ #include "Registry.h" #include "HeaderStyle.h" namespace fluxclaim { HeaderStyle::HeaderStyle(String language) : language_(language) { registry()->register...
#include <cmath> #include "geometry3D.h" Direction3D::Direction3D() { x = y = z = 0; } Direction3D::Direction3D(float X, float Y, float Z) { x = X; y = Y; z = Z; } Direction3D::Direction3D(float X0, float Y0, float Z0, float X1, float Y1, float Z1) { x = X1 - X0; y = Y1 - Y0; z = Z1 - Z0; } float Direction...
// Copyright (c) 2020 [Your Name]. All rights reserved. #include "my_app.h" #include "../src/alien.h" #include <cinder/app/App.h> #include "cinder/gl/gl.h" #include "poScene/SpriteView.h" #include <cinder/audio/audio.h> namespace myapp { using cinder::Color; using cinder::ColorA; using cinder::Rectf; using cinder::a...
class Solution { public: int lengthOfLIS(vector<int>& nums) { int n = nums.size(); if(n == 0) return 0; vector<int> dp(n); dp[0] = 1; int result = 1; for(int i = 1; i < n; i++) { int max_num = 0; for(int j = 0; j < i; j++) ...
#include "Exit.h" #include "View.h" Exit::Exit( QGraphicsScene *Scene ) : exitButtonScene{Scene} { clickExitButton = false; //set picture setPixmap(QPixmap(":/images/exit.png")); //add to scene Scene->addItem(this); //setPos setPos(350,500); //create level1 button music exit...
#pragma once #include "Vector2.h" #include "Vector3.h" #include "Material.h" #include "Types.h" //FLAGS : // 7 6 5 4 3 2 1 0 // |no lighting|no zBuffer | ... // class Triangle { public: Triangle(); ~Triangle(); Vector3* va; Vector3* vb; Vector3* vc; Vector3* pa; Vector3* pb; Vector3* pc; ...
// This is an independent project of an individual developer. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com #include "FastFloat.h" #include "Maths.h" namespace MathsLib { // There is quite a lot of static members in this class // so we need to...
#ifndef MENU_INNOUT_DISPLAY #define MENU_INNOUT_DISPLAY #include "../composite/menu_component.hpp" #include "../composite/menu_burger/header/menu_items_innout.hpp" #include "../composite/menu_burger/header/menu_innout.hpp" class menu_innouts_display { public: void display_innouts_customer_favorites() { ...
/** * Copyright (C) 2017 Alibaba Group Holding Limited. All Rights Reserved. * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * ...
#include <windows.h> #include <GL/glut.h> void dibujarFiguras(){ glBegin(GL_POINTS); glVertex2f(0,.8); glEnd(); glBegin(GL_LINES); glVertex2f(-.5,.5); glVertex2f(.5,.5); glEnd(); glBegin(GL_LINE_STRIP); glVertex2f(-.5,.2); glVertex2f(0...
#include<iostream> #include<string> using namespace std; const int LISTSIZE = 5; //array of 5 strings int main() { int numItems = 0; char input; string item; string list[LISTSIZE]; int max = LISTSIZE - 1; int total = LISTSIZE; do { cout<<"\n==GROCERY LIST MANAGER=="; cout<<"\nEnter your choice:...
#include "christmas_tree.hpp" #include <algorithm> #include <iostream> #include <string> #include <vector> void draw_tree(int height) { const size_t size = height * height * 2; std::string tree(size, '.'); std::vector<int> f1(size); std::vector<int> f2(size); std::generate(f1.begin(), f1.end(), [...
/* 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...
#pragma once #include "Analysis/Partition.h" #include "Analysis/Numbers.h" #include "llvm/Pass.h" #include <functional> #include <memory> #include <unordered_map> #include <vector> namespace llvm { class Function; class CallGraph; class CallGraphNode; class LoopInfo; } namespace pdg { class PDG; } namespace vazge...
// This file has been generated by Py++. #ifndef ConstBaseIterator_a74f832b0a98ff325f0d295bba46f58b_hpp__pyplusplus_wrapper #define ConstBaseIterator_a74f832b0a98ff325f0d295bba46f58b_hpp__pyplusplus_wrapper void register_ConstBaseIterator_a74f832b0a98ff325f0d295bba46f58b_class(); #endif//ConstBaseIterator_a74f832b0a...
// -*- C++ -*- // // Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory, // Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC // // This file is part of FreePOOMA. // // FreePOOMA is free software; you can redistribute it and/or modify it // under the terms of the Expat license. // // This progr...
#ifndef LIGHT_HPP #define LIGHT_HPP #include <cstdint> #include "SDLAssets.hpp" #include "Vector.hpp" class Light { public: __host__ __device__ Light(Vec3<float> origin, uint8_t r = 255, uint8_t g = 255, uint8_t b = 255, float intensity = 1.0); __host__ __device__ Light(float x, float y, float z, uint8_t r =...
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <string> #include <set> #include <cmath> #include <list> #include <unordered_map> #include <unordered_set> #include <cstring> #include <climits> #include <queue> #include <assert.h> using namespace std; int W[101]; int H[101]; double D[...
/*====================================================================* - Copyright (C) 2001 Leptonica. 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 c...
#include "Board.hpp" #include "City.hpp" #include "Player.hpp" #include "Dispatcher.hpp" using namespace pandemic; Dispatcher::Dispatcher(Board &board, enum City city){ CurrentCity = city; theBorad = &board; } Player& Dispatcher::fly_direct(enum City city){ if(city==CurrentCity){ ...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "../base.h" #include "Windows.Graphics.Display.0.h" #include "Windows.Foundation.0.h" #include "Windows.Foundation.1.h" #include "Windows.Storage.Streams.1.h" WINRT_EXPORT namespace w...
#include <stdexcept> #include "../utils/macros.hpp" #include "../math/int_exp.hpp" #include "opt_green.hpp" using namespace std; using namespace Eigen; namespace cbasis { template<int m_s, int m, int m_r> OptGreen<m_s, m, m_r>::OptGreen(LC_EXPs_S _driv_S, EXPs _basis, LC_EXPs_R _driv_R, int _L, double _Z, ...
#include "Application.hpp" Application::Application(int width, int height){ Window=new RenderWindow(VideoMode(width, height, 32), "AnimalFighter",Style::Close); Window->UseVerticalSync(true); //Window->SetFramerateLimit(60); menu=new Menu(Window); } void Application::EventH...
#include<iostream> #include<vector> #include<algorithm> #include<string> #include<set> #include<map> #include<stack> #include<queue> using namespace std; typedef long long ll; int main() {int t; cin>>t; while(t--){ int n; cin>>n; int x[4*n],y[4*n];map<int,int>mx,my; for(int i=0;i<4*n-1;i++){ c...
// Implement the next permutation, which rearranges numbers into the numerically next greater // permutation of numbers. If such arrangement is not possible, // it must be rearranged as the lowest possible order ie, sorted in an ascending order. #include<bits/stdc++.h> using namespace std; int findciel(vector<int>& ...
/*************************************************************************** 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...
// Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include <Rcpp.h> using namespace Rcpp; // Mnn NumericMatrix Mnn(NumericMatrix X, int M); RcppExport SEXP _MySpectralClustering_Mnn(SEXP XSEXP, SEXP MSEXP) { BEGIN_RCPP Rcpp::RObject rc...
// // timed_interpolation.cpp // t_agent // // Created by Hana on 2017/12/12. // // #include "ofxTimedInterpolation.h" using namespace std::chrono; ofxTimedInterpolation::ofxTimedInterpolation() { isWaiting = true; value = 0.0; duration = 1000.0; } void ofxTimedInterpolation::setDuration(double _dura...
#ifndef BACHERO_ENGINE_PHYSICS_COLLIDER_COMPONENT #define BACHERO_ENGINE_PHYSICS_COLLIDER_COMPONENT #include "Engine/ECS/Component.h" #include "Engine/ECS/Entity.h" #include "Engine/Components/TransformComponent.h" #include "Engine/Math/Rect.h" #include "Engine/Math/Mat2x2.h" #include <climits> //Rectangles only! Ev...
#pragma once #ifndef OGRE_WIDGET_HPP #define OGRE_WIDGET_HPP #include <QWidget> #include <QDebug> #include <OGRE/Ogre.h> #include <QVector> #include <core/cameracontroller.hpp> class OgreWidget : public QWidget { Q_OBJECT public: OgreWidget (QWidget* parent); virtual ~OgreWidget(); // READ ONLY prote...
#include <iostream> #include <Stack> using namespace std; void main() { stack<double> s;//可以是各种数据类型; for( int i=0; i < 10; i++ ) s.push(i); while(!s.empty()) { printf("%lf\n",s.top()); s.pop(); } cout << "the size of s: " << s.s...
/******************************************************************************** ** Form generated from reading UI file 'WorkZone.ui' ** ** Created by: Qt User Interface Compiler version 5.8.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ******************************************...
#include<bits/stdc++.h> using namespace std; int main(){ int t, x, k; cin >> t; while( t --){ cin >> x >> k; int factors = 0; int cnt = 0; for(int i = 2; i <= sqrt(x); i++){ while(x%i == 0){ x /= i; cnt ++; } } ...
#pragma once #include <unordered_map> #include <array> #include <tudocomp/compressors/lz_common/factorid_t.hpp> namespace tdc {namespace lz_pointer_jumping { template<typename lz_state_type> class FixedBufferPointerJumping { public: static const size_t MAX_JUMP_WIDTH = 17; using lz_state_t = lz_state_type; ...
#include <stdio.h> // sizeof(x_) will be a multiple of max variable byte boundary(by default max varialbe size). // In here its a multiple of 4 typedef struct { char a; // 1 byte int b; // 4 bytes short c; // 2 bytes char d; // 1 byte } x_; // x_actual_memory_layout Shows x_'s actual mem...
//#include <bits/stdc++.h> //#define M 10 //#define N 10 //using namespace std; // //class Node //{ //public: // int x; // int y; // int dist; // // Node* parent; // // Node(int ax, int ay, int adist, Node* aparent) // { // x = ax; // y = ay; // dist = adist; // parent = aparent; // } //}; // //void printPath(Node*...
#include <stdio.h> #define N 1001 int visited[N][N]; int room[N][N]; //int dx[]={1, 0, 0, -1} , dy[]={-1, 0, 0, 1};//for all neighbours int dx[]={0, -1, 0, 1}, dy[]={-1, 0, 1, 0}; int noOfRoom; int store[N][N]; int calculate(int row, int col) { int max = 0, k; //k is used for the 4 directions for(k=0;k<4;k++) ...
#include<cstdio> #include<iostream> #include<queue> using namespace std; struct Node { int doctor; int pri; int num; bool friend operator < (Node a, Node b) { if(a.pri == b.pri) return a.num > b.num; return a.pri < b.pri; } }node; int main() { int n; char ...
/* * Copyright (C) 2007-2015 Frank Mertens. * * Use of this source is governed by a BSD-style license that can be * found in the LICENSE file. * */ #include <flux/stdio> #include <flux/RegExp> #include <flux/DirWalker> #include <flux/Arguments> using namespace flux; class Match: public Object { public: inl...
#include "common/Compiler.h" #include "common/FastRand.h" #include "common/WorkloadSim.h" #include <benchmark/benchmark.h> #include <sstream> #include <stdexcept> namespace FwdIntException { template <int N> ATTRIBUTE_NOINLINE int IMPL_FwdIntException(int gt10) { workload(gt10); int res = IMPL_FwdIntException<N ...
// Based on https://github.com/tzapu/SonoffBoilerplate #define BUTTON 0 #define RELAY_AUX 12 #define RELAY_HEATER 13 #define TEMP_PIN 5 //pin connected to temp sensor (for control) //#define TEMP_PIN_AUX 4 //pin for auxilliary temp...
/*************************************************************************** dialogointervalo.h - description ------------------- begin : jul 26 2003 copyright : (C) 2003 by email : *************************...
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* sortList(ListNode* head) { if(head == NULL || head->next == NULL) return head; ListNode* slow = head; ...
#ifndef PEAR_GRAPHICS_SPRITE_H #define PEAR_GRAPHICS_SPRITE_H #include "PEngine/graphics/renderable2D.h" #include <GL/glew.h> #include <glm/gtc/matrix_transform.hpp> namespace pear { namespace graphics { class Sprite : public Renderable2D { public: Color col; GLuint textureID; bool sorted; static ...
#include "GameStartLayer.h" #include <AI.h> #include "AppMacros.h" CCScene * GameStartLayer::scene() { CCScene * scene = CCScene::create(); GameStartLayer * layer = GameStartLayer::create(); scene->addChild(layer); return scene; } bool GameStartLayer::init() { CCLay...
#include "ScreenGoodsList.h" #include "BaseGoods.h" #include "Canvas.h" #include "Util.h" #include "GameView.h" #include "common.h" #include "Player.h" using namespace std; Bitmap * ScreenGoodsList::sbmpBg = NULL; Rect * ScreenGoodsList::mRectGoodsDsp = NULL; Canvas * ScreenGoodsList::sCanvas = NULL; ScreenGoodsList...
/*************************************************************************** Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 2010-2020 DADI ORISTAR TECHNOLOGY DEVELOPMENT(BEIJING)CO.,LTD FileName: OSHashTable.h Description: Defines a template class for hash tables. Comment: copy from...
#include "sieve.h" const vector<int> sieve::primes(int n) { vector<bool> is_prime(n+1, true); int i = 2; while (true) { for (int j = i * 2; j < is_prime.size(); j += i) { is_prime[j] = false; } i++; if (i * i > n) break; for (i; i < is_prime.size(); i++) { if (is_prime[i] == true) break;...
#include <cstdio> #include <vector> void inorder_travel(const Tree *node, std::vector < int > &order, ){ if (node == NULL) return; inorder_travel(node->left, order); order.push_back(node->val); inorder_travel(node->right, order); } bool check_bst(Tree *node){ if (node == NU...
#pragma once #include <vector> #include <map> #include "Common.hpp" #include "Device.hpp" #include "Platform.hpp" namespace rustling { class abstractDeviceCreator { public: abstractDeviceCreator() {} virtual Device * create(cl_device_id & id) const = 0; }; template <class C> class DeviceCreator : public abstr...
#include<bits/stdc++.h> using namespace std; int d[1010][1010]; char s1[1010], s2[1010]; int main(){ scanf("%s", s1); scanf("%s", s2); int n = strlen(s1); int m = strlen(s2); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(s1[i-1] == s2[j-1]) { d[i][j] = d[i-1][j-1] + 1; } else { ...
#include <3ds.h> #include <cstddef> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <limits> #include <new> #include "khax.h" #include "khaxinternal.h" extern u32 __ctru_heap; extern u32 __ctru_heap_size; //-----------------------------------------------------------...
#include "Graphic\Scene.h" #include "Graphic\Light.h" using namespace NGraphic; using namespace NGraphic::NScene; Scene::Scene(): size(10,10,10) { } Scene::Scene(float x, float y, float z):size(x,y,z) { m_camMain.m_pos =Vector3(0, 2.0, -2); } void NScene::Scene::addObject(std::shared_ptr<Object> obj) { } std::sha...
#ifndef READ_INSTRUCTION_H #define READ_INSTRUCTION_H #include "opinstruction.h" #include "varregister.h" #include "../visitors/codevisitor.h" #include <string> using namespace std; class ReadI; /** * The implementation of the operation interface for read instructions */ class ReadOperation: public Operation { ...
class Solution { public: int lengthOfLongestSubstring(string s) { int index = 0, max = 0; int start = -1; int charIndex[256]; memset(charIndex, -1, sizeof(int)*256); while(s[index] != '\0') { if(start < charIndex[s[index]]) { s...
#ifndef CUBEQUAD_H_ #define CUBEQUAD_H_ #include "MathGeoLib\include\Math\float3.h" #define NULL 0 #define NUM_VERTICES 8 //A cube has 6 faces //Each face has 2 triangles //Each triangle is form by 3 vetices #define NUM_INDICES 8*4 typedef unsigned int uint; class CubeLine { float vertices[NUM_VERTICES * 3]; u...
/* Author: Nayeemul Islam Swad Idea: - Let dp[n][m] be the answer for n '1's and m '-1's. - All the (n + m)-length sequences can be devided into two cases, those starting with a '1' and those starting with a '-1'. - If the sequence starts with a '1', for any such sequence the maximum prefix sum would b...
#ifndef CHARACTER_H #define CHARACTER_H #include "engine/entity.h" #include "resourceidentifiers.h" #include "engine/command.h" #include "engine/commandqueue.h" #include "tilemapnode.h" #include "engine/animatedspritenode.h" #include "animationtable.h" #include "pathtable.h" #include "engine/speakingbubblenode.h" ...
#ifndef GAME_OF_LIFE_H #define GAME_OF_LIFE_H #include"Cell.h" #include"CellVector.h" #include"Cell2DVector.h" #include<iostream> #include<cstdlib> #include<cstdio> //using namespace HW06; namespace HW06 { class GameOfLife { public: //constructor GameOfLife(const int row = -1000, const int col = -1000) : ...
#pragma once namespace Utils { size_t makeBinary(size_t i); size_t toBinarySet(size_t count); void iterateCortages(size_t size, std::function<void(size_t)> && fn); }
// fftglue.cpp -- CAML Interface to FFAST 2-D FFT Routines // // DM/MCFA 12/98 // ------------------------------------------------------------ // Create a dynamic lib with: // // gcc -dynamiclib -o libLispFFT.dylib fft_glue.cpp \ // -lstdc++ -lfftw3 -framework VecLib // #define USE_FFTW 0 #if USE...
#ifndef LEVEL1BUTTON_H #define LEVEL1BUTTON_H #include <QGraphicsPixmapItem> #include <QGraphicsScene> #include <QGraphicsSceneMouseEvent> #include <QMediaPlayer> class Level1Button :public QGraphicsPixmapItem { friend class Menu; private: QGraphicsScene * level1Scene; QMediaPlayer * level1ButtonMusic; ...