text
stringlengths
8
6.88M
#include <algorithm> #include <iostream> #include <vector> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); int n; std::cin >> n; std::vector<int> input; input.reserve(n); for (int i = 0; i < n; ++i) { int a; std::c...
#include "msg_0x36_blockaction_stc.h" namespace MC { namespace Protocol { namespace Msg { BlockAction::BlockAction() { _pf_packetId = static_cast<int8_t>(0x36); _pf_initialized = false; } BlockAction::BlockAction(int32_t _x, int16_t _y, int32_t _z, int8_t _byte1, int8_t _byte2, int16_t _blockId) : _pf_x(_x) , _p...
/** * @file messagesystem.cpp * * @brief File containing information regaurding the message system implmenentaiton * @version 0.1 * @date 2021-08-02 * * @copyright Copyright (c) 2021 * */ #include "messagesystem.h" #include "messagemanager.h" #include "thread.h" #include "utils.h" #include "...
/************************************************************************************************** *Program: Delta *Programmer: Toben "Littlefoot" "Narcolapser" Archer *Date: 12 04 14 *Purpose: A class for managing the display of geometry. **********************/ #include "ResourceManager.cpp" #include "Mesh.c...
#include <iostream> #include <pthread.h> #include <thread> int Global; void *Thread1(void *x) { Global = 42; return x; } int main() { pthread_t t; pthread_create(&t, NULL, Thread1, NULL); Global = 43; pthread_join(t, NULL); return Global; }
#include <bits/stdc++.h> using namespace std; long long int N,M,i; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> M; if(N%2==0) i = N; else i = N+1; for(;i<=M;i+=2){ cout << i << '\n'; } return 0; }
#include<stdio.h> #include<conio.h> #include<stdlib.h> struct nodo { int info; struct nodo *sig; }; struct nodo *raiz=NULL; struct nodo *fondo=NULL; void insertar(int x) { struct nodo *nuevo; nuevo=malloc(sizeof(struct nodo)); nuevo->info=x; nuevo->sig=NULL; if (vacia())...
#include "ListOfConstantLengthReads.h" #include "ReadsListTypes.h" namespace PgSAIndex { template<typename uint_read_len, typename uint_reads_cnt, typename uint_pg_len, unsigned char LIST_ELEMENT_SIZE, uchar FLAGS_OFFSET> ListOfConstantLengthReads<uint_read_len, uint_reads_cnt, uint_pg_len, LIST_ELEMENT_SIZE,...
// // EPITECH PROJECT, 2018 // zappy // File description: // ServPanel.hpp // #include "ServPanel.hpp" ServPanel::ServPanel() { srvClient = std::make_shared<SrvClient>(); } ServPanel::~ServPanel() { } void ServPanel::setVisible(bool visible, int id) { for (std::vector<EditBox>::iterator it = list.begin(); i...
#pragma once #include "defines.hpp" #include <cmath> #include <vector> #include <iomanip> #include <fstream> #include <memory> #include <map> #include <queue> #include <map> #include <string> #include <array> #include <climits> #include <cstdlib> #include <iterator> #include <algorithm> #include <type_traits> #inclu...
// // Created by tonell_m on 21/01/17. // #include "../include/Pos.hh" Pos::Pos(const int x, const int y) : x(x), y(y) { } Pos::Pos(Pos const &cpy) : x(cpy.x), y(cpy.y) { } Pos::~Pos() { } Pos& Pos::operator=(Pos const &pos) { if (this != &pos) { this->x = pos.x; this->y = pos.y; } return *th...
#include <iostream> #include <algorithm> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <memory.h> #include <math.h> #include <string> #include <string.h> #include <queue> #include <vector> #include <set> #include <deque> #include <map> #include <functional> #include <numeric> #include <sstream> typ...
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; // Author: Tatparya Shankar void getSumOfMultipes() { int number; int sum = 0; int scan; scan = scanf( "%d", &number ); for( int i = 3; i < number; i++ ) { if( i % 3 == 0 || i % 5 == 0 ) { ...
#include "gui.h" #include "input.h" rect::rect(float x,float y,float width,float height) { _x = x; _y = y; _width = width; _height = height; } bool rect::point_inside(glm::vec2 p) { return ( p.x>_x && p.x<_x+_width&& p.y>_y && p.y<_y+_height ); } bool rect::point_inside(float...
#pragma once #include "Task.h" #include "R2D2.h" #include "Robot.h" #include "Xwing.h" #include "SoundTestTask.h" #include "Billboard.h" namespace T3D { class AnimationTest : public Task { public: float variance = 0.2f; float elapsedTime = 0; R2D2 * r2d2; Robot * robot; Xwing * xwing; Music * music;...
/**************************************** Zerus97 *****************************************/ #include <bits/stdc++.h> #define loop(i,s,e) for(int i = s;i<=e;i++) //including end point #define pb(a) push_back(a) #define sqr(x) ((x)*(x)) #define CIN ios_base::sync_with_stdio(0); cin.tie(0); #define...
/* Copyright 2021 University of Manchester 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 required by applicable law or agreed to in writing, s...
// // Created by jwscoggins on 12/12/20. // #ifndef SIM960_GENERICNUMBER_H #define SIM960_GENERICNUMBER_H #include <type_traits> template<typename T, std::size_t width> class GenericNumber { public: GenericNumber(T val = static_cast<T>(0)) : _val(val) { } [[nodiscard]] [[maybe_unused]] constexpr auto get() co...
char val; int leftorright; int downorup,baseycorrection; int cworccw,basethetacorrection; int hitcommand,encoderangle,prevangleconstant; int senseValue, pwmvalue; int angleconstant; void setup() { Serial.begin(9600); Serial3.begin(9600); } void loop() { Serial3.write('z'); delay(1); Serial.println("REQUEST ...
/* * ***** BEGIN GPL LICENSE BLOCK ***** * * 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 (at your option) any later version. * * This program is d...
#include "Game.h" // public Game::Game() { mWireFrame = false; mRained = false; mRenderManager = NULL; mCamera = NULL; mFrustum = NULL; mLight = NULL; mMaterial0 = NULL; mMaterial1 = NULL; mCube = NULL; mSphere = NULL; mSkySphere = NULL; mSkyPlane = NULL; } Game::~Game() { SafeDeletePtr(m...
#ifndef QT_MAIN_CONTENT_H #define QT_MAIN_CONTENT_H #include <memory> #include <QWidget> class QtMainContent : public QWidget { Q_OBJECT public: QtMainContent(); private: void populate(QWidget* parent); }; #endif // QT_MAIN_CONTENT_H
//args.cpp //Aaron Nicanor //anicanor #include <iostream> using namespace std; int main(int argc, char *argv[]){ for(int i = 1; i < argc; i++){ cout<<argv[i]<<endl; } return 0; }
#pragma once #include "plbase/PluginBase.h" #include "CTaskSimple.h" #include "RenderWareTypes.h" #include "CVector.h" #pragma pack(push, 1) class PLUGIN_API CTaskSimpleJetpack : public CTaskSimple { public: __int8 byte8; __int8 byte9; __int8 byteA; __int8 byteB; __int8 byteC; __int8 byteD; __int8 byteE; __in...
/* ID: dhyanes1 LANG: C++ PROG: hotel */ #include <cstdio> #include <algorithm> #include <map> #include <set> #include <queue> using namespace std; int main(void) { FILE *fin,*fout; fin=fopen("hotel.in","r"); fout = fopen("hotel.out","w"); map<int,set<int> > free; int n,m; fscanf(fin, "%d %d", &n ,&m); for...
#include <bits/stdc++.h> long long t,n,x,a[1000001],sum,half,first; using namespace std; // 1 2 3 4 5 6 7 int main() { cin>>t; for(int i = 0; i < t; i++){ cin>>x>>n; a[x] = 2; sum = n*(n+1)/2 - x; if(sum % 2 == 1 || n == 2) ...
#include <unordered_map> #include <iostream> struct T : public std::string { T(const char * s) : std::string(s) { std::cerr << "construct" << std::endl; } ~T(){ std::cerr << "destruct" << std::endl; } }; namespace std { template<> struct hash<T> { size_t operator()(const T& s) const { ...
/// \file NiCfEventAction.cc /// \brief Implementation of the NiCfEventAction class; adapted from /// Geant4 example B5 B5EventAction.cc #include "NiCfEventAction.hh" #include "NiCfTrajectory.hh" #include "NiCfTrackingAction.hh" #include "NiCfConstants.hh" #include "NiCfAnalysis.hh" #include "G4Event.hh" #incl...
/* * @lc app=leetcode.cn id=38 lang=cpp * * [38] 外观数列 */ // @lc code=start #include<iostream> #include<string> #include<sstream> using namespace std; class Solution { public: string countAndSay(int n) { string s="1"; for(int i=0;i<n-1;i++) { string last=s.substr(0,1); ...
#include "SinhVien.h" void SinhVien::Nhap() { /*fflush(stdin); cout << "\nNhap vao ma so: "; getline(cin, MaSo);*/ fflush(stdin); cout << "\nNhap vao ho ten: "; getline(cin, HoTen); int luachon; do{ cout << "\n------------- Menu -------------\n"; cout << "\n1. Nhap thong tin mon hoc"; cout << "\n2. Th...
#ifndef SESSION_H #define SESSION_H #include "ballstate.h" #include "worker.h" #include "render.h" #include <QObject> #include <QThread> #include <QString> class Session : public QObject { Q_OBJECT public: Session(QObject *parent = 0); ~Session(); public slots: void start(); void stop(); v...
#pragma once #include "main.h" #include <utility> template <typename T> static inline void nativePush(T val) { static_assert(sizeof(T) <= sizeof(UINT64), "Type is too large"); UINT64 val64 = 0; *reinterpret_cast<T *>(&val64) = val; nativePush64(val64); } template <typename R> static inline R invoke(U...
// Fill out your copyright notice in the Description page of Project Settings. #include "Stucchi.h" #include "ShipAIController.h" #include "StucchiPawn.h" AShipAIController::AShipAIController(const FObjectInitializer & OI) : Super(OI), possessed(nullptr) { PrimaryActorTick.bCanEverTick = true; } void AShipAIControl...
#pragma once #include "rpc_common.hpp" #include <hash_map> #include <boost/mpl/assert.hpp> #include <boost/mpl/vector.hpp> #include <boost/mpl/at.hpp> #include <boost/mpl/equal.hpp> #include <boost/mpl/front.hpp> #include <boost/mpl/back.hpp> #include <boost/mpl/identity.hpp> #include <boost/function_type...
#include <ros/ros.h> #include <stdio.h> #include <stdlib.h> #include <image_transport/image_transport.h> #include <cv_bridge/cv_bridge.h> #include <sensor_msgs/image_encodings.h> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/video/tracking.hpp> #include <PerFoRoControl/...
#include "Box.h" Box::Box() { velocity = sf::Vector2f(10, 0); scale = 20; } Box::~Box() { } void Box::update(float dt) { changePos = velocity * scale * dt; move(changePos); } void Box::setVelocity(sf::Vector2f vel) { velocity = vel; } void Box::collisionResponse() { velocity = -velocity; }
#include "Poly.h" #include <iostream> Poly::Poly() { m_first = nullptr; } Poly::Poly(int high, int *coeffArray)//应对传入的high和数组进行检查,第一个参数为最高项指数,数组元素个数应为high+1 { m_high = high; m_first = new PolyNode(); PolyNode *p = m_first; for (int i = 0; i < high ; i++)//若为high+1,最后会多申请一个内存空间,里面值默认为0 { p->index = ...
/* * redblacktree.h * * Created on: Apr 27, 2017 * Author: Benjamin Kleinberg * * This is a red black tree structure that inherits from a binary search tree. * A red black tree has the following properties: * 1) All the nodes are red or black * 2) The root node is black * 3) The null leaf nodes are...
/**************************************************************************** Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal...
#include <bandit/bandit.h> #include <rint.hpp> #include <iostream> using namespace rint; using namespace snowhouse; using namespace bandit; template<auto min, auto max, typename E> void expect_value_type() { bool const is_same = std::is_same< typename ranged_int<min, max>::value_type, E>::value; AssertThat(is...
#ifndef __SCENE_MANAGER_H__ #define __SCENE_MANAGER_H__ #include "MainMenu.h" USING_NS_CC; #define TRANSITION_DURATION 1.2f class SceneManager : public CCObject { public: SceneManager(void); ~SceneManager(void); static void goMenu(); static void goPlay(); static void goStop(); static void go(CCLaye...
//******************************************************************************* //* Copyright (c) 2013. Federal University of Para (UFPA), Brazil and * //* University of Bern (UBern), Switzerland * //* Developed by Research Group on Computer Network and Multimedia * //* Communication (GERCOM) of UFPA in coll...
#include<iostream> #include<algorithm> using namespace std; int trans_pt(int arr[],int n) { int beg,end,mid; beg=0;end=n-1; while(beg<=end) { mid=(beg+end)/2; if(arr[mid]==1) { if(mid==0||arr[mid-1]==0&&mid>0) { return mid+1; } } else if(arr[mid]==0) { beg=mid+1; } else end=mid-1;...
// AV TODO: // 1. beatify console behavior if IO disconnected during typing /***C********************************************************************************************* ** ** SRC-FILE : cmd_proc.cpp ** ** PROJECT : BTCAR debug command user interface ** ...
#pragma once #define MEM_SIZE 256*4 class Mem { public: Mem(); ~Mem(); void InitMem(); int ReadMem(int index); std::wstring PrintMem(int page); private: static int m_memory[]; };
#ifndef IFACTORY_H #define IFACTORY_H #include <iostream> #include <map> #include "iproductregister.h" /* * 工厂模板类,用于获取和注册产品对象 * 模板参数 ProductType_t 表示的类是产品抽象类 */ template <class ProductType_t> class IFactory { public: // 获取工厂单例,工厂的实例是唯一的 static IFactory<ProductType_t> &getInstance() { static IFactor...
#include<iostream> using namespace std; //Khai bao struct Ngay { int Ngay; int Thang; int Nam; }; typedef struct Ngay NGAY; void Input_Ngay(NGAY &); void Out_Ngay(NGAY);
/* ------------------------------------------------------------------ * Copyright (C) 1998-2009 PacketVideo * * 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.o...
#ifndef CUSTOMER_H #define CUSTOMER_H #include <iostream> #include <cstdlib> #include <string> #include <regex> #include "full_menu.h" #include "iterator.h" #include "category.h" #include "item.h" using namespace std; class Customer{ public: Customer(string name = "anon"): _name(name){} void OrderMenu(FullMenu fu...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*- * * Copyright (C) 1995-2011 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. */ #ifndef ELEMENTREF_H #define ELEMENTR...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 1995-2006 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. */ #ifndef IRC_IDENTD_H #define IRC_IDENTD_H #include "adjunct/m2/sr...
class Mascot { public: explicit Mascot(int, int, int); //constructor (ID, X, Y) void mascotController(); //Controls animations for mascot sprites void updateHoleState(); //updates currentState to the value of hole[x] (global variable) private: void setSprite(); //Sets the image for the sprite to spawn next vo...
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "CountdownBoard.generated.h" class USceneComponent; class ACountdownTile; UCLASS() class FINALCOUNTDOWN_API ACountdownBoard : public AActor { GENERATED_BODY...
#include <iostream> #include <memory.h> using namespace std; int dx[4] = { 1,-1,0,0 }; int dy[4] = { 0,0,1,-1 }; int map[6][6]; bool candidate[10000000]; int counter = 0; void DFS(int x, int y, int process, int dest,int current_num); int main() { int test_case = 0; cin >> test_case; for (int t = 1; t <= test_ca...
#ifndef JETINFO_HH #define JETINFO_HH class JetInfo { public: int iphi; int ieta; int et; JetInfo() {}; JetInfo(int iphi,int ieta,int et) { this->iphi = iphi; this->ieta = ieta; this->et = et; } }; #endif
#include <iostream> #include <string.h> #include <math.h> #include <cstdlib> #include <ctime> using namespace std; int dice_roll(){ int v; srand(time(NULL)); //ensures true randomness v = rand() % 6 + 1; return v; //returns value between 1 and 6 } class Player{ int position; pu...
#include "tests.hpp" #include "SLAM.hpp" #include "random.hpp" #include <opencv/highgui.h> using namespace std; using namespace cv; typedef Mat_<byte> matim; bool Tester::test_project() { for (int itest = 0; itest < 100; ++itest) { startover: Size imsize(rand() % 1000 + 1, rand() % 1000 + 1); matf K(3,3...
#ifndef _MSG_0X1F_ENTITYRELATIVEMOVE_STC_H_ #define _MSG_0X1F_ENTITYRELATIVEMOVE_STC_H_ #include "mcprotocol_base.h" namespace MC { namespace Protocol { namespace Msg { class EntityRelativeMove : public BaseMessage { public: EntityRelativeMove(); EntityRelativeMove(int32_t _entityId, int8_t _dx, int8_t _dy, int8_t...
#include <colib/co_routine_specific.h> #include "PaxosKVServiceImpl.hpp" struct __PaxosKVServiceImplWrapper{ PaxosKVServiceImpl * pImpl; }; CO_ROUTINE_SPECIFIC(__PaxosKVServiceImplWrapper, g_coPaxosKVServiceImplWrapper) PaxosKVServiceImpl *PaxosKVServiceImpl::GetInstance() { return g_coPaxosKVServiceImplWrapper...
#pragma once using namespace std; #include <vector> #include <sstream> namespace OCScript { // 文字列操作を便利にする機能をまとめたクラスです。 class StringUtility { public: // 区切り文字により文字列をスプリットします。 // 引数: ソース文字列, 区切り文字 static vector<wstring> Split(const wstring &src, wchar_t delimiter) { wstringstream ss(src); vector<ws...
#pragma once #include "plbase/PluginBase.h" #pragma pack(push, 4) class PLUGIN_API LimbOrienation { public: float m_fYaw; float m_fPitch; }; #pragma pack(pop) VALIDATE_SIZE(LimbOrienation, 8);
/*! * \file TriggerEventGroup.h * * \author Shiyang Ao * \date November 2016 * * */ #pragma once #include "IComponent.h" #include "BaseEventGroup.h" namespace Hourglass { class TriggerEventGroup : public BaseEventGroup { DECLARE_COMPONENT_TYPEID public: // Override IComponent functions IComponent* ...
/* ID: stevenh6 TASK: kimbits LANG: C++ */ #include <fstream> #include <string> #include <algorithm> using namespace std; ofstream fout("kimbits.out"); ifstream fin("kimbits.in"); double graph[33][33]; void nextbit(int N, int L, double I) { if (N != 0) { if (graph[N - 1][L] > I) { ...
#include "BTreeNode.h" #include <iostream> #include <cstring> #include <stdio.h> #include <cstdlib> using namespace std; BTLeafNode::BTLeafNode() { memset(buffer, 0, 1024); } /* * Read the content of the node from the page pid in the PageFile pf. * @param pid[IN] the PageId to read * @param pf[IN] PageFile to ...
#include <vector> #include <string> #include <iostream> #include <fstream> #include <sstream> #include <list> #include <algorithm> #include <sstream> #include <set> #include <cmath> #include <map> #include <stack> #include <queue> #include <cstdio> #include <cstdlib> #include <cstring> #include <numeric> #include <bits...
#pragma once #include "residlerParameterFormat.h" #include "sid.h" namespace Steinberg { namespace Vst { namespace residler { struct sidinfo { double clockRate; double sampleRate; }; class sid_wrapper { public: void reset(struct sidinfo *sidinfo_in); #if 0 void start_gen(int frames, float *buf); int run_gen(int ...
// // Created by dylan on 25-5-2020. // #ifndef CPSE2_BOARD_BUILDER_HPP #define CPSE2_BOARD_BUILDER_HPP #include <SFML/Graphics.hpp> class board_builder { private: sf::Vector2f colum1 = {0.0, 205.0}; sf::Vector2f colum2 = {650.0, 20.0}; sf::Vector2f colum3 = {0.0, 430.0}; sf::Vector2f...
#ifndef COMMANDQUEUE_H #define COMMANDQUEUE_H #include "command.h" #include <queue> class CommandQueue { public: CommandQueue(); void push (const Command& command); Command pop (); bool isEmpty (); private: std::queue<Command> mQueue; }; #endif // C...
// chunk_rendering.cpp #include "chunk_rendering.h" #include "oglhelper.h" namespace leap { namespace rendering { uint16_t ChunkMesh::add_vertex(v3i8 position, BlockNormal normal, v2i8 texture) { static_assert(sizeof(BlockVertex) == sizeof(std::byte) * 6, "BlockVertex is expected to be 6 bytes!"); vertices.empla...
/********************************************************************** *Project : EngineTask * *Author : Jorge Cásedas * *Starting date : 24/06/2020 * *Ending date : 03/07/2020 * *Purpose : Creating a 3D engine that can be used later on for developing a playable demo, with the engine as static library * ***...
#include "NumberObject.h" NumberObject::NumberObject() : SDLGameObject() { } void NumberObject::load( const LoaderParams* pParams ) { SDLGameObject::load( pParams ); } void NumberObject::draw() { SDLGameObject::draw(); } void NumberObject::update() { } void NumberObject::clean() { SDLGameObject::clean(); }
//this file do unittesting of function before integrate it into the project #include <iostream> #include <fstream> #include "date.h" #include "time.h" #include"Vector.h" #include "unit.h" using namespace std; //void menuOption2(Vector<WindlogType>& windlog) { // bool found = false; // int year_input, month_count = 1;...
int sonicPin = 3; int incomingByte; long int sensor; long mm, cm, inches; void setup() { Serial.begin(9600); pinMode(sonicPin, INPUT); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } } void readSensor () { sensor = pulseIn(sonicPin, HIGH); cm = sensor/58; } ...
#include<bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned long long #define rep(x,t,n) for(ll x = t; x < n; ++x) #define repe(x,t,n) for(ll x = t; x <= n; ++x) #define dec(x,t,n) for(ll x = t; x >= n; --x) #define iter(it,x) for(auto it : x) #define nl cout<<'\n'; #define pii pair<int,int...
#include "treeface/misc/UniversalValue.h" #include "treeface/misc/StringCast.h" #include <treecore/MPL.h> using namespace treecore; static_assert( mpl_same_type<GLboolean, GLubyte>::value, "GLboolean is GLubyte" ); namespace treeface { bool UniversalValue::operator ==( const UniversalValue& peer ) const { if (...
#ifndef TREE_H_ #define TREE_H_ #include <cstdlib> #include <string> #include <vector> #include <iostream> #include <queue> #include <stack> #include "TreeNode.h" #define SAFE_DELETE(p) {if(p){delete p; p = 0;}} using namespace std; template <class T> class Tree { public: Tree(); ~Tree(); void displayTree(TreeNod...
#include <benchmark/benchmark.h> #include "matrix.hpp" #include "task_3_lib.cpp" static void Rowwise_decomposition(benchmark::State &state) { int size = 5000; for (auto _: state) { state.PauseTiming(); Matrix<int>* M = new Matrix<int>(size); randomizeMatrix(*M); vector<int> V(size); randomize...
//阔别好久,又开始在纸上写了 //想好思路,在纸上写好后,搬到电脑上,改了几个小语法错误,然后通过了152组数据(共300多组) //然后瞬间发现了自己把题考虑简单了 //但是很快又根据忘记考虑的数据,想出了更加严谨的算法. 但是只通过了168组数据 //第二天(清明节第二天)把整个代码抄了一遍,发现还是没有逻辑上的错误,于是开始查看错误的那组数据 //还是没发现有啥错误 最后没办法,只能调试一下了 很快发现了问题所在 修改后就通过了 //通过之后发现,自己的方法其实就能解决知道,但是没考虑的特殊情况. //这又算是浪费了时间吧 严谨性还需加强 最终还是调试了. //不过大思路是没问题的 // 9 ms...
/* 数组 值域 rk[0~n-1] 1~n sa[1~n] 0~n-1 h[2~n] 排名i和排名i-1的后缀的最长公共前缀 h[0~1] 无意义 */ #define rep(i,a,n) for (i=a;i<n;i++) int wa[MAXN],wb[MAXN],wv[MAXN],ws[MAXN]; void da(int *r,int *sa,int n,int m=128){ int i,j,p,*x=wa,*y=wb; rep(i,0,m) ws[i]=0; rep(i,0,n) ws[x[i]=r[i]]++; rep(i,1,m) ws[i]+=ws[i-...
// Example 1_1 : Hello world (sort of) // Created by Oleksiy Grechnyev 2020 // This is a comment /* This is also a comment */ // Include the header file iostream (needed for file Input/Output) // This is NOT called 'import' or 'add library' !!! #include <iostream> /* The main() function is the program entry point ...
#include <iostream> #include <string> const int ArSize = 10; using namespace std; void strcount(const string input); int main() { string input; cout << "Please enter a line:\n"; getline(cin, input); while (input != "") { strcount(input); cout << "Please enter line (empty line to quit): " << endl; getline(cin...
//知识点:拓扑排序,拓扑序DP /* 题目要求: 求 1~n 之间的最长路 由于题目给出的图有向且无环 并且对于1~i的最短路, 有多条路径可以选择 所以可以进行 拓扑序DP 先将 拓扑序在1之前的点去除 并将他们出边上的点的入度-- 再从1开始进行拓扑排序DP */ #include<cstdio> #include<queue> #include<algorithm> #include<ctype.h> #include<cstring> const int MARX = 1510; //==========================================...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*- ** ** Copyright (C) 2002 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 ESUTILS_S...
/***************************************************************************************************************** * File Name : segregateEvenOddNumbers.h * File Location : C:\Users\AVINASH\Desktop\CC++\Programming\src\sites\geeksforgeeks\arrays\page06\segregateEvenOddNumbers.h * Created on : Jan 6, 2014 ...
template<typename T> class MyVector { T *v = nullptr ; int sz = 0; public: MyVector() {} MyVector(int i) : sz{i}, v{new T[i]} {} T &operator[](int i) { return v[i]; } };
// Copyright (c) 2011-2017 The Cryptonote developers // Copyright (c) 2017-2018 The Circle Foundation & Conceal Devs // Copyright (c) 2018-2023 Conceal Network & Conceal Devs // // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php....
#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...
// Datastructures.hh #ifndef DATASTRUCTURES_HH #define DATASTRUCTURES_HH #include <string> #include <vector> #include <utility> #include <limits> #include <set> #include <map> #include <unordered_map> // Type for town IDs using TownID = std::string; struct TownData { TownData() {} TownData(const TownID& nID...
#include "CGuestBinding.h" #include "json/json.h" #include "Logger.h" #include "StrFunc.h" #include "../threadres.h" #include "RedisAccess.h" #include "Helper.h" #include <algorithm> #include "md5.h" #include "threadres.h" #include "RedisLogic.h" #include "SqlLogic.h" namespace { static std::vector<int> errorCode...
class Category_675 { class bulk_17Rnd_9x19_glock17 { type = "trade_items"; buy[] = {2,"ItemGoldBar"}; sell[] = {1,"ItemGoldBar"}; }; class bulk_15Rnd_9x19_M9SD { type = "trade_items"; buy[] = {2,"ItemGoldBar"}; sell[] = {1,"ItemGoldBar"}; }; class bulk_30Rnd_9x19_MP5SD { type = "trade_items"; buy[]...
#include <string> #include "gwmessage/GWSensorDataConfirm.h" using namespace std; using namespace Poco; using namespace BeeeOn; GWSensorDataConfirm::GWSensorDataConfirm(): GWMessage(GWMessageType::SENSOR_DATA_CONFIRM) { } GWSensorDataConfirm::GWSensorDataConfirm(const JSON::Object::Ptr object): GWMessage(object) ...
#include <iostream> #include <sstream> #include <vector> #include <list> #include <queue> #include <algorithm> #include <iomanip> #include <map> #include <unordered_map> #include <unordered_set> #include <string> #include <set> #include <stack> #include <cstdio> #include <cstring> #include <climits> #include <cstdlib> ...
#ifndef ADRESATMENEGER_H #define ADRESATMENEGER_H #include <iostream> #include <vector> #include <windows.h> #include <sstream> #include <fstream> #include <string> #include <algorithm> #include "Adresat.h" #include "UzytkownikMenager.h" #include "PlikiZAdresatami.h" #include "MetodyPomocnicze.h" using namespace std;...
#include "rdtsc_benchmark.h" #include "ut.hpp" #include <random> #include <algorithm> #include <math.h> #include <functional> #include <vector> #include "compute_steering.h" using namespace boost::ut; // provides `expect`, `""_test`, etc using namespace boost::ut::bdd; // provides `given`, `when`, `then` auto da...
#include<iostream> #include"Node.h" #include<math.h> using namespace std; /* * Count nodes in complete binary tree */ int count(Node* root){ int lh=0,rh=0; Node* curr=root; while(curr!=NULL){ lh++; curr=curr->left; } curr=root; while(curr!=NULL){ rh++; curr=cur...
#include <iostream> #include <string> #include <juce_core/juce_core.h> #include <juce_events/juce_events.h> class AsynchronousCommandlineReader : public juce::ActionBroadcaster, private juce::Timer { public: AsynchronousCommandlineReader() { } ~AsynchronousCommandlineReader() override { removeAllActionListene...
#include <stdio.h> #include <iostream> #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgui/highgui.hpp" #include <opencv2/calib3d/calib3d.hpp> #include "opencv2/nonfree/features2d.hpp" #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <s...
namespace iberbar { inline CColor4F::CColor4F() : b( 0.0f ), g( 0.0f ), r( 0.0f ), a( 0.0f ) { } inline CColor4F::CColor4F( const CColor4B& color ) : b( (float)( color.b ) / 255.0f ) , g( (float)( color.g ) / 255.0f ) , r( (float)( color.r ) / 255.0f ) , a( (float)( color.a ) / 255.0f ) { } inlin...
/*! * @copyright © 2017 Universidade Federal do Amazonas. * * @brief Interface da API em C++ da classe mãe I2C. * * @file mkl_I2CPort.h * @version 1.0 * @date 07 Dezembro 2017 * * @section HARDWARES & SOFTWARES * +board FRDM-KL25Z da NXP. * +proc...
#ifndef BASEPAWN_HH #define BASEPAWN_HH #include <QGraphicsPolygonItem> //#include <QGraphicsSceneMouseEvent> class basepawn : public QGraphicsPolygonItem { public: basepawn(int id); void colorPawn(); int playerId; int pawnNumber; }; #endif // BASEPAWN_HH