text
stringlengths
8
6.88M
// 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) #pragma once #include <pika/config.hpp> namespace pika::cuda::experimental { /// RAI...
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <functional> #include <queue> #include <string> #include <cstring> #include <numeric> #include <cstdlib> #include <cmath> using namespace std; typedef long long ll; #define INF 10e10 #define REP(i,n) for(int i=0; i<n; i++) #define R...
#ifndef DIALOG_H #define DIALOG_H #include <QDialog> namespace Ui { class Dialog; } /** * @brief A classe Dialog serve para recuperar as dimensões * escolhidas pelo usuário ao criar um novo escultor. */ class Dialog : public QDialog { Q_OBJECT public: /** * @brief Dialog é o constru...
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*- * * Copyright (C) 1995-2009 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. * * @author Arjan van Leeuwen (arjanl) */ group "quix.UnixOpSkinElement"; require _UNIX...
/**************************************************************************** * * * Author : lukasz.iwaszkiewicz@gmail.com * * ~~~~~~~~ * * Lice...
#include "Parser.h" #include <stdexcept> int start_parsing(int argc, char *argv[], uint n) { if (argc <= n) { throw std::runtime_error("The parameter is missing"); } auto N = std::atoi(argv[n]); if (N <= 0 || std::string(argv[n]) != std::to_string(N)) { throw std::runtime_error("Incorrect parameter");...
#include<iostream> using namespace std; typedef unsigned long long int ll; bool kt(ll n){ ll k = 0, x = n /2; for(ll i = 1; i <= x; i++) if(n % i == 0) k = k + i; if(k == n) return true; return false; } int main(){ ll n; cin >> n; if(kt(n)) cout<<"Yes"; else cout<<"No"; ...
// 0921_6.cpp : 定义控制台应用程序的入口点。 // #include <iostream> #include<algorithm> using namespace std; int main() { int N; const int size = 100; while (cin >> N) { double a[size]; int i; double sum=0; for (i = 0; i < N; i++) { cin >> a[i]; } sort(a, a + N); for (i = 1; i < N-1; i++) { sum += a[i]...
#ifndef __WPP__QT__WPP_H__ #define __WPP__QT__WPP_H__ #include <QObject> #include <QVariant> #include <QNetworkConfigurationManager> #include <QLocale> #include <QDebug> #include <QTimeZone> class QWindow; namespace wpp { namespace qt { class Wpp: public QObject { Q_OBJECT Q_PROPERTY(double dp2px READ dp2px WRITE...
#include <iostream> #include <unistd.h> #include <cmath> #include <cstdio> #include <cstdlib> #include <string.h> #include <stdint.h> #include "globalTypes.h" #include "procSelect.h" #include "procProject.h" #include "procUnionDiffXprod.h" #include "procDedup.h" //The SW RA Pr...
// Created on: 2001-06-25 // Created by: Alexander GRIGORIEV // Copyright (c) 2001-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 GNU Lesser General Public License version ...
#include "CharacterEntity.h" #include "Skill.h" #include "../../Game/Mains/Application.h" #include "../../Base/Source/Main/Engine/System/InputManager.h" CharacterEntity::CharacterEntity() : Position(Vector3(0, 0, 0)) , Scale(Vector3(10, 10, 1)) , Name("") , Level(0) , Health(0) , MaxHealth(0) , Attack(0) , Defence(0)...
#include "Endgame.h" #include "Keyboard.h" Endgame::Endgame(uint32_t axi_base_addr, Scene *menu, uint8_t id) : Scene(menu, id), axi_text(reinterpret_cast<uint32_t*>(axi_base_addr)) { } void Endgame::Init(uint8_t info) { winner_id = info; time = 0; blink_status = 0; } void Endgame::HandleInput...
#include "TrackPart.h" TrackPart::TrackPart() { instability = 0; iter = 0; column.loadImage("column.gif"); } TrackPart::~TrackPart() { } void TrackPart::update() { if(ofGetElapsedTimef() == 5.0f){ this->setPosition( this->getPosition().x , this->getPosition().y + instability); iter = 0; } } void TrackPar...
#ifndef DOCUMENTMANAGER_H #define DOCUMENTMANAGER_H #include <QMap> #include <QtGui/QTabWidget> #include <QtGui/QTreeWidget> #include "DocHolder.h" #include "Chat.h" #include "../net/ConferoNet.h" #include "ui_ip.h" const QString NEW_CONNECTION_STRING("<new connection>"); class DocumentManager : public ...
// Created on: 2014-03-17 // Created by: Kirill GAVRILOV // Copyright (c) 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 GNU Lesser General Public License version 2.1 as pu...
#include <string> #include <iostream> #include <iomanip> #include <cmath> #include <fstream> #include <exception> #include <random> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/program_options.hpp> #include <sstream> #include <unistd.h> #include "simpleLogger.h" #include "Med...
#include <vector> #include "ListaFichas.h" using namespace std; //Estructura del nodo: parent>>nodo>>hijos //Parent es el nodo predecesor //Nodo es el nodo en sí //Hijos es el vector de nodos sucesores class Nodo { private: ListaFichas fichas; int nhijos; Nodo* padre; vector<Nodo*> hijo; public: ...
// // Created by 钟奇龙 on 2019-05-11. // #include <iostream> #include <string> using namespace std; string pointNewchar(string s,int k){ if(s.size() == 0 || k < 0 || s.size() <= k){ return ""; } int num = 0; for(int i=k-1; i>=0; --i){ if(isupper(s[i])){ num++; }else{ ...
#include<cstdio> #include<cstring> #include<cmath> const int M = 105; bool dia[M][M],vis[M]; int mat[M]; double xx[M][2],yy[M][2]; int n,m; bool dfs(int k) { for(int i=0;i<m;++i){ if(!vis[i] && dia[k][i]){ vis[i] = 1; if(mat[i]==-1 || dfs(mat[i])){ mat[i...
/* Always we have to give sorted array to binarySerch Algorithm.. */ #include<iostream> using namespace std; int binarySearch(int a[], int k, int n); int main(){ int a[10] = {1,2,3,4,5,6,7,8,9,10}; int n = 10; int k; cout<<"Enter element to search : "; cin>>k; int result = binarySearch(a,k...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <folly/portability/GMock.h> #include <folly/portability/GTest.h> #include <quic/codec/QuicPacketBuilder.h>...
#ifndef IGRAPH_H #define IGRAPH_H #include <unordered_set> #include <unordered_map> #include <deque> #include <vector> #include <algorithm> template<typename ID, typename DATA, typename WEIGHT = size_t> class IGraph { public: virtual bool addNode(ID id, DATA && data) = 0; virtual void deleteNode(ID id) = 0; ...
// Created on: 1994-06-17 // Created by: EXPRESS->CDL V0.2 Translator // Copyright (c) 1994-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...
#pragma once #include "GameObject.h" class BackGround : public GameObject { private: struct Vertex { Vector2 position; DWORD color; Vector2 uv; }; Vertex vertice[4]; float speed; LPD3DXEFFECT pEffect; LPDIRECT3DTEXTURE9 pTex; class Camera* camera; public: BackGround(); ~BackGround(); void Init(); v...
#pragma once #include "gameNode.h" #include "enemy.h" #include "boss.h" #include "Phoenix.h" //캐릭터 상태 (애니메이션 포함) #define MAXBULLET 30 enum STATE { IDLE, LEFT, RIGHT, MOVE, DIE, ULTIMATE }; class player : public gameNode { private: image* _move; //달리는 프레임이미지 10*2 image* _death; image* _gameover; image* _bl...
#include "currentdate.h" #include "ui_currentdate.h" currentDate::currentDate(QWidget *parent) : QDialog(parent), ui(new Ui::currentDate) { ui->setupUi(this); } currentDate::~currentDate() { delete ui; } void currentDate::onEdit_Pushed() { *input = ui->dateEdit->date(); if_can = true; thi...
#include<bits/stdc++.h> using namespace std; main() { int n, m; while(cin>>n>>m) { int ar1[1000], ar2[1000], i, ans; for(i=0; i<m; i++) cin>>ar1[i]; sort(ar1, ar1+m); int best = 1e9; for(int k=0; k<=(m-n); k++){ best = min(best, ar1[k+n-1]-ar1[...
/* * TGraphics.cpp * * Created on: May 19, 2017 * Author: Alex */ #include "TGraphics.h" #include <app.h> //#include <Elementary.h> //#include <system_settings.h> //#include <efl_extension.h> #define BUFLEN 500 TCairoGraphics::TCairoGraphics():surface(NULL) { // TODO Auto-generated constructor stub } ...
/**************************************************************************** ** Resource object code ** ** Created by: The Resource Compiler for Qt version 5.14.1 ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ static const unsi...
#include "GnMeshPCH.h" #include "GnSequence.h" GnImplementRTTI(GnSequence, GnObject); void GnSequence::SetTargetObject(GnObjectForm* pObject) { GnTimeController* pkControl = mpsTimeControls; while( pkControl ) { bool failed = pkControl->SetTargetObject(pObject); if( failed == false ) { GnLogA( "Warning : ...
#include<bits/stdc++.h> using namespace std; int sum_poly(int i, int n, int x) { if(n==0) return 1; if(i<n) return (int)pow(x,i)+sum_poly(i+1, n, x); return 0; } main() { int n, v, x; cin>>x>>n; v= sum_poly(0, n, x); cout<<v<<endl; return 0; }
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "blub.h" #include <stdio.h> class BlubBlub : public QObject { Q_OBJECT public: BlubBlub() : QObject() { } public slots: int getValue() const { retu...
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; bool Y = false; for(int i=0; i<n; i++){ string s; cin >> s; if(s == "Y") Y = true; } if(Y) cout << "Four" << endl; else cout << "Three" << endl; return 0; }
// // Created by Noam pnueli on 10/02/2017. // #ifndef GRAPHICSTEST_MATH_2D_H #define GRAPHICSTEST_MATH_2D_H #include <iostream> #include <vector> #include <cmath> #define PI 3.141592654 typedef std::vector<std::vector<double>> mpoints; class vector2d { public: double x; double y; vector2d() { x = 0; ...
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- /** Copyright (C) 1995-2008 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. * * @author Owner: Alexander Remen (alexr) */ #ifndef DELETEFOLDE...
#ifndef ASA047_H #define ASA047_H void nelmin ( double fn ( double x[] ), int n, double start[], double xmin[], double *ynewlo, double reqmin, double step[], int konvge, int kcount, int *icount, int *numres, int *ifault ); void timestamp ( ); #endif
#ifndef libanddif_H #define libanddif_H #include <iostream> #include <vector> #include <string> #include <algorithm> #include <cmath> #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_mixer.h> #include <SDL2/SDL_ttf.h> #include "RSDL/src/rsdl.hpp" using namespace std; #define GAMEFIELD_WIDTH 800 ...
#pragma once #include <QString> #include <QSet> #include <QStringList> #include <QVector> #ifdef _MSC_VER #include "pstdint.h" #else #include <stdint.h> #endif class Core; class Client { protected: QByteArray inputBuffer_; QByteArray outputBuffer_; int id_;//socket handle Core *parent_; public: Client(void); ...
#include "pulse.h" Pulse::Pulse(uint delay) { m_delay = delay; m_later = make_timeout_time_ms(0); } bool Pulse::expired() { if(absolute_time_diff_us(get_absolute_time(), m_later) > 0) return false; m_later = make_timeout_time_ms(m_delay); return true; }
#include "LineOrientedVT100Client.h" #include "Line.h" #include <cstdio> #include <math.h> LineOrientedVT100Client::LineOrientedVT100Client() : m_cursorColumn(-1) , m_cursorRow(-1) , m_previousCharacter('\0') { appendNewLine(); // Ye olde first line. } LineOrientedVT100Client::~LineOrientedVT100Clien...
//Научите свою поисковую систему отбрасывать стоп-слова. //На вход примите сначала строку стоп-слов, а затем с нового абзаца — строку-запрос. // //Выводите только те слова, которых нет в списке запрещённых. // //Ввод: //with many very //very kind dog with brown fur // //Вывод : //[kind] //[dog] //[brown] //[fur] #inc...
#ifndef LABPROG_PLAYER_H #define LABPROG_PLAYER_H #include "Entity.h" class Player : public Entity { public: Player(float x, float y, sf::Texture &texture); ~Player(); bool removeLife(sf::CircleShape *L[3]); int countLifes(); sf::Sprite getSprite(); private: std::stack<bool> lifes; v...
#pragma once #include "Variable.h" #include <vector> #include <string> #include <map> // Parses a system of equations from a specified file and returns // a solved system or errors detailing why no solution can be reached // Representation: // noErrors (bool) - true when system is solvable // v (map) - maps...
// Created on: 1993-04-07 // Created by: Laurent BUCHARD // 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 GN...
#include "MainGame.h" void main() { MainGame mg; }
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*- * * 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. */ #include "core/pch.h" #include "modul...
#include <iostream> using namespace std; int main() { cout<<"Nama: Zulhan Ozi Firmanu"<<endl; cout<<"NIM: F1b019148"<<endl; cout<<"Kelompok: 28"<<endl; int my_array [8] = {3,4,5,6,7,2,9,8}; cout << ("Data ke-1 : ",my_array[0]); cout << ("Data ke-2 : ",my_array[1]); cout << ("Data ke-3 : ",my_array[2]); cout ...
//忽略因为非GCC编译器导致的错误 #include<iostream> using namespace std; int a[1000000]; int b[1000000]; int main() { int m = 0; int n = 0; int i; cin >> m; for (i = 0; i < m; i++) { cin >> a[i]; } cin >> n; for (i = 0; i < n; i++) { cin >> b[i]; } int arr[m + n]; int p = m; int q = 0; for (i = 0; i < m + n...
// Created on: 2011-09-20 // Created by: Sergey ZERCHANINOV // Copyright (c) 2011-2013 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 GNU Lesser General Public License version 2...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include <folly/Conv.h> #include <folly/lang/Bits.h> #include <glog/logging.h> #include <quic/QuicConstants.h> #include <quic/Qui...
#include "NetBackendClient.h"
#include "Vector.h" /***********/ /*vec3*/ /***********/ vec3::vec3() { x = 0; y = 0; z = 0; } vec3::vec3(float posX, float posY, float posZ) { x = posX; y = posY; z = posZ; } vec3::vec3(float posX, float posY, float posZ, bool normalize) { vec3 v = vec3(posX, posY, posZ); float a; ...
#include <iostream> #include <stdio.h> #include <stdlib.h> #include "powerOfTwo.h" #include "graph.h" int main(int argc, char *argv[]) { //computeTwoToTheN(); struct Graph* graph; int shortestPathDist; graph = createGraph(); printf("The Graph, where 1 is blocked, and 0 is clear"); printGraph(graph); //no n...
/*! * \file memorydelegate.h * \author Simon Coakley * \date 2012 * \copyright Copyright (c) 2012 University of Sheffield * \brief Header file for the memory table delegate */ #ifndef MEMORYDELEGATE_H_ #define MEMORYDELEGATE_H_ #include <QItemDelegate> #include <QModelIndex> #include <QObject> #include <QSize> #i...
#include <avr/EEPROM.h> #include <avr/interrupt.h> #include <phys253.h> #include <LiquidCrystal.h> // Sensor Ports #define IR_L 0 #define IR_R 1 #define LEFT_QRD 2 #define RIGHT_QRD 3 #define LEFT_MOTOR 3 #define RIGHT_MOTOR 0 class MenuItem { public: String Name; uint16_t Value; uint16_t* EEPROMAddress; stat...
#ifndef CARD_H #define CARD_H #include <cstdlib> #include <iostream> using namespace std; /****************************************************** ** Class: Card ** Purpose: A class to hold all of the relevant ** variables that make up a card object, as well as ** all of its necessary functionality. *****************...
/* =========================================================================== Copyright (C) 2017 waYne (CAM) =========================================================================== */ #pragma once #ifndef ELYSIUM_GRAPHICS_RENDERING_IWRAPPEDFENCE #define ELYSIUM_GRAPHICS_RENDERING_IWRAPPEDFENCE #endif...
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. /** * * @author Ove Martin Malm * @date Creation date: 2000-21-08 * @version $Id$ * * Copyright (c) : 1997-2000 Fast Search & Transfer ASA * ALL RIGHTS RESERVED */ #include <stdlib.h> #include...
#include "TestPlane.h" #include "../Debug.h" #include "../vendor/glm/glm.hpp" #include "../vendor/glm/gtc/matrix_transform.hpp" #include "../vendor/imgui/imgui.h" #define WIDTH 800 #define HEIGHT 800 namespace test { TestPlane::TestPlane(GLFWwindow* window) : m_Window(window) { // Vertices c...
#include "StdAfx.h" #include "UIManager.h" UIManager::UIManager(MyGUI::Gui* mGUI) :mGUI(mGUI) { } UIManager::~UIManager() { } void UIManager::update(float deltaT) { if (infoTimer > 0.0f) { infoTimer -= deltaT; if (infoTimer <= 0.0f) { infoTimer = 0.0f; mGUI->findWidget<MyGUI::Tex...
// Copyright (c) 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 GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special ...
// // Created by gurumurt on 10/16/18. // #ifndef OPENCLDISPATCHER_BANDITENVIRONMENT_H #define OPENCLDISPATCHER_BANDITENVIRONMENT_H #endif //OPENCLDISPATCHER_BANDITENVIRONMENT_H #include "bandit.h" #include "policy.h" struct ScoreOptimal{ double score, optimal; }; class BanditEnvironment{ public: MultiAr...
#include "magicbullet.h" MagicBullet::MagicBullet(QObject *parent) : FlyingProp(parent) {} MagicBullet::MagicBullet(int x, int y, int width, int height, int direction, ...
#define F_CPU 8000000UL #include <avr/io.h> #include <avr/iotnx5.h> // for CLKPR //#include <util/delay.h> #include <stdlib.h> //#include <avr/power.h> #define NOISE_PIN (1<<PB1) int main() { // set clock to 8Mhz CLKPR = 1 << CLKPCE; // Tell chip we want to scale the clock CLKPR = 0; // prescaler is 1, giving 8M...
using namespace std; #include<iostream> #include<conio.h> #include<string.h> void showhint(); void check(string word,char splayer,string fullword); void fill(char splayer,string word,string fullword); //void result(); string fill(char splayer); char splayer; string word,fullword; int main() { showh...
// // Created by manout on 17-8-2. // #include <iostream> #include <vector> #include <string> /* * 从输入中找到分数最高和最低的两位同学的学好 * */ struct info { std::string name; std::string ID; size_t score{0}; }; using result_t = std::pair<info, info>; void get_top_last() { size_t size = 0, i = 0; info pre, high...
#include "bits/stdc++.h" using namespace std; int main() { // pair container 2 values of any type pair < int, string > p1,p2; //intialize p1 = make_pair(1,"vivek"); p2 = {1,"vishal"}; // value vs reference pair <int , string > p_val=p1; pair <int, string > &p_ref=p2; cout<<"Intialization\n"; cout << p1.firs...
#ifndef geometry_h #define geometry_h #include "linalg_util.hpp" #include "math_util.hpp" #include "geometric.hpp" #include "string_utils.hpp" #include "GL_API.hpp" #include "tinyply.h" #include "tiny_obj_loader.h" #include <sstream> #include <vector> #include <fstream> #include <algorithm> namespace avl { stru...
#include "../../idlib/precompiled.h" #pragma hdrstop #include "../Game_local.h" #include "../vehicle/Vehicle.h" #define MAX_MISSILE_JOINTS 4 #define MAX_HOVER_JOINTS 4 class rvMonsterStroggHover : public idAI { public: CLASS_PROTOTYPE( rvMonsterStroggHover ); rvMonsterStroggHover ( void ); ~rvMonsterStroggHover...
/* kamalsam */ #include<iostream> using namespace std; int main() { long long i,n; cin>>n; for(i=0;i<n;i++) { long long j,sum,m; cin>>m; long long int a[m]; sum=0; for(j=0;j<m;j++) cin>>a[j]; for(j=0;j<m;j++) sum=(sum+a[j])%m; ...
#pragma once #include "Object.h" #include <hgevector.h> typedef std::vector<CObject*> MOBJ; typedef std::vector<CObject*>::iterator MOBJ_ITR; /* **可移动物体,只能进行点对点移动 */ class CMoveableObj : public CObject { public: CMoveableObj(hgeResourceManager* rs); virtual ~CMoveableObj(); virtual bool Init() = 0; virtual voi...
#pragma once #include <memory> #include "Test.hpp" namespace smart_pointer { // `exception` class definition class exception : std::exception { using base_class = std::exception; using base_class::base_class; }; // `SmartPointer` class declaration template <typename T, typename Allocator> class SmartPointer { ...
#include<bits/stdc++.h> using namespace std; const int M=1e5+10; long long a[M]; int has[M]; int main() { int n,m; long long sum=0,ans=0; scanf("%d%d",&n,&m); for (int i=1;i<=n;i++) { scanf("%I64d",&a[i]); if (i>1) ans+=(a[i]*a[i-1]); sum+=a[i]...
/* * TInfoBox.h * * Created on: May 27, 2017 * Author: Alex */ #ifndef TINFOBOX_H_ #define TINFOBOX_H_ #include "TPopupBox.h" class TInfoBox: public TPopupBox { public: TInfoBox(const char* text); virtual ~TInfoBox(); }; #endif /* TINFOBOX_H_ */
/************************************************************************/ /* File name : MIMEMessage.h */ /************************************************************************/ /* Contents : MIME メールメッセージ */ /* ...
$NetBSD$ Rewind to the start of the password database. --- src/greeter/UserModel.cpp.orig 2019-03-31 07:59:59.000000000 +0000 +++ src/greeter/UserModel.cpp @@ -60,6 +60,8 @@ namespace SDDM { QFile::exists(themeDefaultFace) ? themeDefaultFace : defaultFace); struct passwd *current_pw; + + ...
/* Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... For example, given nums = [3, 5, 2, 1, 6, 4], one possible answer is [1, 6, 2, 5, 3, 4]. */ class Solution { public: void wiggleSort(vector<int>& nums) { for(int i = 1; i < nums.size(); ++i){ ...
#include "vm.hpp" #include <cstdlib> #include <exception> #include <iostream> #include <gc_cpp.h> #include "gc/gc_allocator.h" #include <boost/filesystem.hpp> int main(int argc, char** argv) { GC_INIT(); char* online = getenv("ONLINE"); char* profile = getenv("PROFILE"); try { VM* vm = new (GC) VM(argc, ...
#pragma once class WallItem; #include "Connection.h" class WallItem:public QGraphicsPixmapItem { protected: Connection* connections[2]; public: virtual void updatePositions()=0; virtual Connection** getConnections()=0; virtual void deatach()=0; virtual ~WallItem(){}; };
#include <iostream> using namespace std; int main() { char quote = 34; const char* lines[] = { "#include <iostream>", "", "using namespace std;", "", "int main() {", " char quote = 34;", " const char* lines[] = {", " ", " ...
#include "serializer.h" #include <QFile> #include <QTextStream> #include <QDateTime> #include <QDebug> void Serializer::Serialize( QVector<quint16> values, QString fileName ) { QFile file( fileName ); if( !file.open(QIODevice::Append )) { qInfo()<<"Cannot write file"; return...
// // Created by chris on 11/08/2017. // #ifndef MINECRAFT_CLONE_READFILE_H #define MINECRAFT_CLONE_READFILE_H #include <fstream> // Returns pointer to heap data containing file contents char* readFile(const char* path) { char* data = nullptr; std::ifstream file(path, std::ios::binary | std::ios::ate); ...
#include<iostream> #include<conio.h> #include<string.h> using namespace std; struct book { // private: long int bookid; char booktitle[20]; int price; public: book input(); /* void input() { cout<<"Enter the data of book; bookid, booktitle, price"<<endl; cin>>bookid>>booktitle>>price; }*/ void ouput() { ...
/* * Copyright(c) 2018 WindSoul Network Technology, Inc. All rights reserved. */ /** * Desc: 字节流操作工具类 * Author: * Date: 2018-04-24 * Time: 17:41 */ #ifndef __BYTEARRAYTOOL_H__ #define __BYTEARRAYTOOL_H__ #include "CoreMinimal.h" class ByteArrayTool { public: static void IntToByte(char* buf, int index, int value);...
#include <stack> #include <iostream> using namespace std; int main(){ string operation; stack<int> st; while(true){ cin >> operation; if(operation == "exit") break; if(operation == "push"){ int n; cin >> n; st.push(n); cout << "ok" << endl; }else if(operation == "pop"){ cout << st.top() <...
#include "Nodo.h" class Stack { public: Nodo* first; //Primer elemento del stack Nodo* last; // Último elemento del stack int size; //Tamaño del stack Stack() { first = NULL; last = NULL; size = 0; }; ~Stack() {}; void push_front(int val); void print(); bool search(int val); void pop_back(); };
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <functional> #include <queue> #include <string> #include <cstring> #include <numeric> #include <cstdlib> #include <cmath> #include <map> using namespace std; typedef long long ll; #define INF 10e17 // 4倍しても(4回足しても)long longを溢れない #de...
#include "debounce.h" #include "Arduino.h" #if 1 Debounce::Debounce(int gpio, int delay) { pinMode(gpio, INPUT_PULLUP); _gpio = gpio; _delay = delay; _later = 0; } void Debounce::update() { //static absolute_time_t later = make_timeout_time_ms(0); //static auto later = millis(); //if(absolute_time_dif...
#pragma once #include "xr_util.h" #include "xr_file.h" namespace xr { class net_t { public: net_t() { this->fd = INVALID_FD; } virtual ~net_t() { file_t::close_fd(this->fd); } int fd; public: //send `total` bytes of data //return:number of bytes sent:success //-1:error //负数:其他错误 virtual int send(cons...
#pragma once #include "Keng/FileSystem/FwdDecl.h" namespace keng::filesystem { class FileSystem; using FileSystemPtr = core::Ptr<FileSystem>; class File; using FilePtr = core::Ptr<File>; }
#include <bits/stdc++.h> using namespace std; long long int X,Y; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> X >> Y; X*=Y; cout << X; return 0; }
// // Created by 1 on 03.10.2015. // #ifndef BOOST_OPTIONAL_OPTIONAL_H #define BOOST_OPTIONAL_OPTIONAL_H #endif //BOOST_OPTIONAL_OPTIONAL_H #include <assert.h> #include "type_traits" struct none_t {} none; template <typename T> struct optional { optional(): is_none(true) {} optional(optio...
#include "GamePch.h" #include "IKComponent.h" #include "Projectile.h" uint32_t IKComponent::s_TypeID = hg::ComponentFactory::GetGameComponentID(); IKComponent::IKComponent() : m_target(nullptr), UpdateFunc(nullptr), m_iteration(0) { } void IKComponent::LoadFromXML(tinyxml2::XMLElement* data) { int num = 0; m_ro...
// Auduino Phase accumulator // // by Peter Knight, Tinker.it http://tinker.it, // Ilja Everilä <saarni@gmail.com> // // ChangeLog: inline void Phase::setInc(uint16_t value) { inc = modInc = value; } inline void Phase::modulate(uint16_t mod) { // 16bit * 14bit >> 13bit -> 17bit modInc = mod == 0x2000 ? inc :...
#include<bits/stdc++.h> using namespace std; long long x,y,m,n,l,f,ans; void readit(){ scanf("%d%d%d%d%d",&x,&y,&m,&n,&l); } void writeit(){ if (f) printf("Impossible\n"); else printf("%d\n",ans); } long long gcd(long long a,long long b){ if (!b) return a; else return gcd(b,a%b); } void exgcd(long lo...
/* * Copyright (c) 2021 Morwenn * SPDX-License-Identifier: MIT */ #ifndef CPPSORT_FIXED_ODD_EVEN_MERGE_NETWORK_SORTER_H_ #define CPPSORT_FIXED_ODD_EVEN_MERGE_NETWORK_SORTER_H_ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #includ...
#include <iostream> #include "Sales_data.h" int main() { Sales_data item_last, item_new; int total_cnt = 0; std::cin >> item_last.bookNo; total_cnt += 1; while(std::cin >> item_new.bookNo) { if(item_new.bookNo == item_last.bookNo) { total_cnt += 1; } else { ...
#include "ICamera.h" #include <memory> const glm::mat4& LaiEngine::ICamera::GetViewMatrix() const noexcept { return mViewMatrix; } const glm::mat4& LaiEngine::ICamera::GetProjectedMatrix() const noexcept { return mProjectedMatrix; } const glm::mat4& LaiEngine::ICamera::GetProjectedViewMatrix() const noexcept { r...
/* * FriendMgr.h * * Created on: Jul 22, 2017 * Author: root */ #ifndef FRIENDMGR_H_ #define FRIENDMGR_H_ #include <vector> #include <set> #include "Smart_Ptr.h" #include "MsgCommonClass.h" #include "MessageStruct/CharLogin/PlayerInfo.pb.h" #include "Timer/TimerInterface.h" #include "MessageCommonRet.h" #i...