text
stringlengths
8
6.88M
#ifdef DEBUG #define _GLIBCXX_DEBUG #endif #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>...
#ifndef PROFILER_H #define PROFILER_H #include <vector> #include <string> #include <map> #include <unordered_map> #include <time.h> class Profiler { // TIMING // implemented with QPC. // http://stackoverflow.com/questions/1739259/how-to-use-queryperformancecounter // https://msdn.microsoft.com/en-us/library/windows/d...
#pragma once #include "shader.h" #include "gui.h" #include <sdl2/SDL.h> class Window { SDL_Window* window = nullptr; SDL_GLContext glcontext = nullptr; bool open = false; bool fullscreen = false; glm::uvec2 size = { 800, 600 }; GUI gui; void LoadSDL(); void LoadOpenGL(); void ProcessEvents(); void Proce...
// Created on: 1992-02-14 // Created by: Jean Claude VAUTHIER // Copyright (c) 1992-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 t...
#include<iostream> using namespace std; int main() { int x,y,temp; cout<<"Enter values of x and y:"; cin>>x>>y; temp=x; x=y; y=temp; cout<<"\nThe value of x is:"<<x; cout<<"\nThe value of y is:"<<y; return 0; }
#include <unistd.h> #include <sys/shm.h> #include <exception> #include <stdio.h> #include <string.h> #include <tools.h> #include <sysv_shm.h> sysv_shm::sysv_shm() :_id(-1) ,_base(0) { } char*sysv_shm::ptr() { return (char*)_base; } int sysv_shm::open(const char*name,size_t size) { key_t key=hash(name,strlen(na...
#ifndef PLAYER_H #define PLAYER_H #include "overview.h" #include "suit.h" #include <string> using namespace std; const int NUM_SUITS = 3; class Player { public: void setName( const string name ); string getName(); void printName(); void printOverview(); void printSuits(); ...
#include "UtilityPanelWidget.h" #include "UtilitiesDraw.h" #include "UtilitiesFurniture.h" #include "UtilitiesLabel.h" #include "UtilitiesGrid.h" #include <QPushButton> #include "GlobalStats.h" UtilityPanelWidget::UtilityPanelWidget():QStackedWidget() { this->setStyleSheet("border: 1px solid black"); this->setFixedWi...
/* -*- Mode: c++; tab-width: 4; 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 Adam Minchinton */ #include "core/pch.h" #ifdef AUTO_UPDATE_SUPPORT #ifdef...
#include "InputSequenceGenerator.hpp" #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <getopt.h> #include <iostream> #include <list> #include <map> #include <string> #include <vector> using namespace SVParser; using std::cout; using std::endl; ex...
#include "header.h" void goToXY(SHORT posX, SHORT posY) { HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); COORD Position; Position.X = posX; Position.Y = posY; SetConsoleCursorPosition(hStdout, Position); } //string void verify(int& option, int number, int startRow) { while (option < 1 || option > number) { ...
#include "catch.hpp" #include "../BagOfWords.h" TEST_CASE("Constructor") { SECTION("Blank/meaningless reviews") { BagOfWords reviewBlank(""); BagOfWords reviewOnlySpaces(" "); BagOfWords reviewNoAlphabets(".3.3...1#@#!@"); REQUIRE(reviewBlank == reviewOnlySpaces); REQUIRE(reviewOnlySpaces == reviewNoAlph...
// This file was generated based on /Users/r0xstation/18app/src/.uno/ux13/ButtonIcon.g.uno. // WARNING: Changes might be lost if you edit this file directly. #include <_root.app18_accessor_ButtonIcon_TextColor.h> #include <_root.app18_accessor_ButtonIcon_Value.h> #include <_root.app18_FuseControlsTextControl_Color_Pro...
#include <Arduino.h> #include "TankRobot.h" Tank_Robot robot; void setup() { Serial.begin(115200); robot = Tank_Robot(); } void loop() { robot.task(); }
#include "Menu.hpp" Menu::Menu() { } Menu::~Menu() { } void Menu::init(const int &idScene, const sf::Vector2f &sizeView, const sf::Vector2i & posWindow, const sf::Time &timerScene) { //Inherance init _info.init(idScene, sizeView, posWindow, timerScene); std::string pathFileBack("backMenu.png"...
#ifndef __VIVADO_SYNTH__ #include <fstream> using namespace std; // Debug utility ofstream* global_debug_handle; #endif //__VIVADO_SYNTH__ #include "sobel_16_unrolled_1_opt_compute_units.h" #include "hw_classes.h" struct img_img_update_0_write0_merged_banks_12_cache { // RAM Box: {[-1, 1920], [-1, 1080]} // C...
#include "dimmanuel.h" #include "ui_dimmanuel.h" #include "clienttcp.h" DimManuel::DimManuel(QWidget *parent) : QWidget(parent), ui(new Ui::DimManuel) { ui->setupUi(this); QDoubleValidator* validator = new QDoubleValidator(); validator->setRange(0,9999,2); ui->lineEdit_parametre1->setValidator(...
/** * created: 2013-4-6 23:07 * filename: FKLogger * author: FreeKnight * Copyright (C): * purpose: */ //------------------------------------------------------------------------ #pragma once //------------------------------------------------------------------------ #include "FKSyncObjLock.h" #include <string...
#include "CalGroupsModel.h" using namespace RsaToolbox; #include <QDebug> CalGroupsModel::CalGroupsModel(QObject *parent) : QAbstractListModel(parent) { _vna = NULL; _vnaModel = NULL; _calGroups = 0; } void CalGroupsModel::setVnaModel(VnaModel *model) { if (_vnaModel == model) return; ...
/* -*- 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. ** */ #include "core/pch.h" #if defined(DOM_GEOLOCATION_SUPPORT) && ...
#ifndef MIX_SIGN_H #define MIX_SIGN_H namespace mix { enum class Sign : char { Positive = 0, Negative = 1 }; Sign flip_sign(Sign sign); char to_char(Sign sign); template <typename T> Sign get_sign(T value) { return value < 0 ? Sign::Negative : Sign::Positive; } } // namespace mix #endif // MIX_SIGN_H
// Created on: 1992-08-26 // Created by: Remi GILET // Copyright (c) 1992-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 GNU Les...
/* BEGIN LICENSE */ /***************************************************************************** * SKCore : the SK core library * Copyright (C) 1995-2005 IDM <skcontact @at@ idm .dot. fr> * $Id: binary.cpp,v 1.6.2.6 2005/02/17 15:29:20 krys Exp $ * * Authors: Mathieu Poumeyrol <poumeyrol @at@ idm .dot. fr> * ...
// major scales // jonathan.mayer@gmail.com #include "bytebear.h" #include <math.h> ByteBear::ByteBear() {} ByteBear::~ByteBear() {} const double fsamp = 44100.0; const double C = 110.0; const double ratio = pow(2.0, 1.0/12.0); inline double period_in_samples(int ord) { double freq = C * pow(ratio, ord); // samp...
#pragma once class TestScene2 : public GameObject { public: TestScene2(); ~TestScene2(); bool Start() override; void Update() override; private: GameCamera* m_camera = nullptr; SkinModelRender* m_model = nullptr; };
#ifndef _EVENTS__H_ #define _EVENTS__H_ extern _ATL_FUNC_INFO INFO_Connecting; extern _ATL_FUNC_INFO INFO_LoginPassword; extern _ATL_FUNC_INFO INFO_Disconnected; extern _ATL_FUNC_INFO INFO_StateChanged; extern _ATL_FUNC_INFO INFO_Received; extern _ATL_FUNC_INFO INFO_ServiceRequest; extern _ATL_FUNC_INFO INFO_...
// University of Arizona // Center for Gamma-Ray Imaging // // // // // // // // // Author and Revision Date // Garrett Hinton Jun 12 2017 // // // Description of File // This is a worker class that takes a .cine file and turns it into an array of frames. // It also has the ability to turn a .cine...
#ifndef ASYNCEMULATIONDECODERFACTORY_H #define ASYNCEMULATIONDECODERFACTORY_H #ifdef ASYNC_IMAGE_DECODERS_EMULATION #include "modules/img/imagedecoderfactory.h" class AsyncEmulationDecoderFactory : public AsyncImageDecoderFactory { public: ImageDecoder* CreateImageDecoder(ImageDecoderListener* listener, int type); ...
// // Created by seadream on 2018/12/16. // /* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } }; */ struct ListNode { int val; struct ListNode *next; }; class Solution { public: ListNode* EntryNodeOfLoop(ListNode* pHead) { } ...
/**************************************************************************** * * * Author : lukasz.iwaszkiewicz@gmail.com * * ~~~~~~~~ * * Lice...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2011-12 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" #if defined(X11API) && defined(NS4P_COMPONE...
#ifndef _LIVE_STREAM_MEDIA_SOURCE_HH #define _LIVE_STREAM_MEDIA_SOURCE_HH #include <list> #include <MediaSink.hh> #include "CircularQueue.h" #include "BufferManager.h" typedef void(*callback_func)(void *ptr, int streamid); #define DEFAULT_MAX_VEDIOFRAME_RATE 60 #define DEFAULT_MAX_VEDIOFRAME_SIZE (512 * 1024) #defin...
#include "Light.h" #include <glm/ext.hpp> const vec3 up(0, 1, 0); constexpr float margin = 1.2f; void DirectionalLight::calcViewTransform(const AABB& bbox) { vec3 position = bbox.getCenter(); vec3 target = position + m_direction; m_view = glm::lookAt(position, target, up); } void DirectionalLight::calcProjection...
// Example 7.5 : std::filesystem // Created by Oleksiy Grechnyev 2020 // Note : filesystem crashes on uuntu gcc 8.x, try gcc 9.x instead ! #include <iostream> #include <filesystem> //============================== int main(){ using namespace std; // Create a path filesystem::path p("."); // Current dire...
// Created on: 1996-03-26 // Created by: Christian CAILLET // Copyright (c) 1996-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; c-file-style:"stroustrup" -*- * * Copyright (C) 1995-2012 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 SELFTEST...
#include <iostream> #include <WS2tcpip.h> #pragma comment (lib, "ws2_32.lib") using namespace std; #define DEFAULT_PORT "27015" static const int SERVER_BUFFER_SIZE = 1024; static const int CLIENT_INFO_BUFFER_SIZE = 256; static const int SERVER_ACCEPT_MSG_BUFFER = 128; int main(int argc, char* argv[]) { //Startup ...
// Copyright (c) 2012-2017 The Cryptonote developers // 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. #pragma once #include "Chaingen.h" struct gen_upgrade : public t...
#include <ionir/llvm/llvm_emitted_entities.h> namespace ionir { LlvmEmittedEntities::LlvmEmittedEntities() : entities() { // } void LlvmEmittedEntities::set(const ionshared::Ptr<Construct> &construct, llvm::Value *llvmValue) { this->entities.set(construct, llvmValue, true); } ...
// // Created by micky on 15. 5. 22. // #include "SemaphoreObejct.h"
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*- * * Copyright (C) 1995-2007 Opera Software ASA. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. * * @file * @author Owner: Karianne Ekern (karie) * */ #include "core/pch.h" #inc...
#include "Render/DrawSubPass/GuiSubPass.h" #include "Module/GraphicsManager.h" #include <imgui.h> //#include <glfw/glfw3.h> using namespace Rocket; void GuiSubPass::Draw(Frame& frame) { if (ImGui::GetCurrentContext()) { ImGui::NewFrame(); // // // Count FPS // { // double...
#include "HashMap.h" #include "logging.h" #include "util/get_heap_size_of.h" namespace credb { namespace trusted { inline PageHandle<HashMap::node_t> duplicate(PageHandle<HashMap::node_t> &hdl) { if(!hdl) { return PageHandle<HashMap::node_t>(); } else { auto &page = *hdl; a...
#ifndef SOCKETCLIENT_H #define SOCKETCLIENT_H #include <QObject> #include <QtWebSockets/QWebSocket> #include <QUrl> #include <QString> #include <QList> #include <QSslError> #include <QAbstractSocket> #include <QJsonObject> struct CoinData { int bid; double bidSize; int ask; double askSize; double ...
// 折线分割平面.cpp : 定义控制台应用程序的入口点。 // //n条直线最多分平面问题 //n-1条直线将平面分为f(n-1)块,第n条直线要将平面分为最多份数,与n-1条直线的交点最多可以有n-1个 //n-1个交点会产生最多2条射线和n-2条线段,每条射线或者线段将原来的区域一分为二,则在f(n-1)的基础上增加了n-2+2个区域 //f(n)=f(n-1)+(n-2)+2=f(n-1)+n //n条折线最多分平面问题 //n-1条折线将平面分为f(n-1)块,第n条折线要将平面分为最多分数,则第n条折线的两条边与前n-1条折线的两条边相交 //产生2*2*(n-1)个交点,这些交点会产生4*(n-1)条线段和2条射线...
// // This file contains the C++ code from Program 11.3 of // "Data Structures and Algorithms // with Object-Oriented Design Patterns in C++" // by Bruno R. Preiss. // // Copyright (c) 1998 by Bruno R. Preiss, P.Eng. All rights reserved. // // http://www.pads.uwaterloo.ca/Bruno.Preiss/books/opus4/program...
#include <stdio.h> #include <ctime> #include <stdlib.h> #define N 10 int main() { int array[N]; srand(time(NULL)); int max=0, min=0, sum = 0; for (int i = 0; i < N; i++) { array[i] = rand() % 200 - 100; printf("Array[%d]=%d\n", i, array[i]); } for (int i = 0; i < N; i++) ...
#include "drag_pixmap.h" #include <QMap> #include <QPainter> #include <QPixmap> #include <QDebug> #include <QFontMetricsF> #include <algorithm> #include <QLineF> using namespace std; using pixmap_maker = void (*) (QPainter*, qreal, qreal); //定义函数指针 static void raw_material_maker(QPainter* painter,qreal width, qreal...
#include "../interface/metanalyzer.hh" #include "TLorentzVector.h" #include "TFile.h" #include "TTree.h" metanalyzer::metanalyzer(std::string iFile) { fNVars = 30; for(int i0 = 0; i0 < fNVars; i0++) fVar[i0] = 0; fFile = new TFile(iFile.c_str(),"RECREATE"); fTree = new TTree("met","met"); fTree->Branch("m_z"...
#ifndef __SNAKENODE_H__ #define __SNAKENODE_H__ #include "cocos2d.h" USING_NS_CC; enum class ENUM_DIR { DIR_UP, DIR_DOWN, DIR_LEFT, DIR_RIGHT, DIR_STOP }; enum class ENUM_TYPE { TYPE_HEAD = 1, TYPE_BODY, TYPE_FOOD }; class SnakeNode :public Sprite { public: Sprite * node; ENUM_DIR m_dir; ENUM_DIR m_last_di...
// 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....
class Category_686 { duplicate = 630; }; class Category_580 { duplicate = 630; }; class Category_634 { duplicate = 630; };
#include "ShoeManagerNetworkConfig.hpp" ShoeManagerNetworkConfig *ShoeManagerNetworkConfig::getInstance() { static ShoeManagerNetworkConfig oInstance; return &oInstance; } ShoeManagerNetworkConfig::ShoeManagerNetworkConfig() { //#define LoaclServer #ifdef LoaclServer mServer = "http://127.0.0...
#pragma once #include <GL/glut.h> #include <iostream> #include <stdlib.h> #include <string> #include <string.h> #include <vector> #include <math.h> #include <array> #include "colors.h" // #include "line.h" const int SCR_WIDTH = 800; const int SCR_HEIGHT = 600; const int CUBE_HEIGHT = 500; //dimensions.. const int n...
/*Unit test for stream socket library.*/ #include "cc/shared/stream_socket.h" #include "gtest/gtest.h" #include <iostream> #include <boost/atomic.hpp> #include <boost/bind.hpp> #include <boost/thread/thread.hpp> #include <unistd.h> namespace cc_shared { static const char kTestBuffer[] = "Mary had a little lamb."; ...
class Solution1 { public: bool isValidSudoku(vector<vector<char>>& board) { if(board.size() < 9) return false; set<char> char_set; for(int i=0; i<3; ++i){ //检查行 for(int r=i*3; r<3*i+3; ++r){ char_set.clear(); for(int k=0; k<9; ++k){ ...
/* * File: coordsystem.cpp * Author: daniale * * Created on June 25, 2014, 4:09 PM */ #include "coordsystem.hpp" #include "stepper.hpp" /* Cartesian coordinate declarations */ Cartesian::Cartesian() { // we'll fix these later when we home axes distanceX = 0; distanceY = 0; distanceZ = 0; ...
#include "stack.hpp" void isValue(int& number) { while (std::cin.fail()) { std::cin.clear(); std::cin.ignore(256,'\n'); std::cout << "Please enter the intager number: "; std::cin >> number; } } void chooseFunction(const int function, Stack& stack) { int index = 0; ...
#include <gtest/gtest.h> #include <span> #include "shoc/otp/hotp.h" #include "shoc/hash/sha1.h" using namespace shoc; TEST(Hotp, Sha1) { const char *key = "12345678901234567890"; const uint32_t exp[] = { 755224, 287082, 359152, 969429, 338314, 254676, 287922, 162583, 399871, 520489 }; for (uint64_t i = 0...
/* * Copyright 2019 LogMeIn * * 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 w...
#include <iostream> #include <fstream> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <ncurses.h> #include <string> using namespace std; void doPrint(int n, char sChar) { for (int i = 0; i < n; i++) { printf("%C", sChar); } } int main() { int h, count; freopen("labiec28.i...
#include "terrainblock.h" TerrainBlock::TerrainBlock(QList<Qt3D::QAbstractMesh *> *meshes, QList<Qt3D::QMaterial *> *materials, int x, int y, QNode *parent) : Qt3D::QEntity(parent), m_iBlockX(x), m_iBlockY(y), m_iTypeIndex(0), m_pMeshes(meshes), m_pMaterials(materials) { Q_ASSERT(m_pMaterials); Q_ASSERT(m_...
#include "eudaq/AidaFileWriter.hh" #include "eudaq/FileNamer.hh" #include "eudaq/FileSerializer.hh" #include "eudaq/BufferSerializer.hh" #include "eudaq/Exception.hh" #include "eudaq/config.h" #include "jsoncons/json.hpp" using std::string; using jsoncons::null_type; using jsoncons::json; namespace eudaq { AidaF...
// Test program for server infrastructure #include <iostream> #include <fstream> #include <thread> #include <mutex> #include <condition_variable> #include <chrono> #include <string> #include <vector> #include <atomic> #include <cmath> #include <cstdint> #include <xmmintrin.h> std::string pretty(uint64_t u) { if (u ...
//知识点: 二分答案,单调队列,DP /* 假设g = 花费金币数 分析题意: 1.可以发现 , 每个点只能由 区间[i点距离-(d+g),i点距离-(d-g)] 转移而来 转移第i+1个点时, 转移区间可由上个转移区间 整体右移得到 满足滑动窗口问题的性质 故可以,使用单调队列, 进行DP优化 2.对于要确定的变量g的值: 可以发现, 当g取一个较大的值的时候, 所能转移的范围 包括,比此时g小的值的转移范围 满足单调性, 可以进行二分答案 算法实现: 故,使用二分答案,枚举变量g的...
#include <cstdio> #include <iostream> using namespace std; int main() { int input, sum = 0; for(int i=0; i<5; i++) { scanf("%d", &input); sum += max(input, 40); } printf("%d\n", sum / 5); return 0; }
#ifndef COMISION_H #define COMISION_H #include <string> class EmpleadoPorComision{ public: EmpleadoPorComision(const std::string &, const std::string &, const std::string &, double =0.0, double = 0.0); void setPrimerNombre(const std::string); std::string getPrimerNombre() const; ...
#include <stdio.h> #include <iostream> #include <fstream> using namespace std; class troad { public: float Length; int Width; troad(); troad(float Length0,int Width0); void fileinput(); }; troad::troad() { Length=0.0; Width=0; } troad::troad(float Length0,int Width0) { if(Length0>0)Length=Length0;else Length=1; if(W...
#include "stdafx.h" #include "SubIsoMap.h" SubIsoMap::SubIsoMap() { } SubIsoMap::~SubIsoMap() { } HRESULT SubIsoMap::Init() { for (int i = 0; i < TILE_SIZE_X; i++) { for (int j = 0; j < TILE_SIZE_Y; j++) { rc[i][j] = RectMake( SUBWINSIZEX / TILE_SIZE_X * i, 300 / TILE_SIZE_Y * j + 200, SUBWINSIZEX...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 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 NS4P_HOOKED_H #define NS4P_HOOKED_H #include "modules/otl/li...
/******************************************************************************** ** Form generated from reading UI file 'chekinadmin.ui' ** ** Created: Thu 26. Apr 15:46:39 2012 ** by: Qt User Interface Compiler version 4.8.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file...
/* Arduino EuroRack Kit #1 Dual LFO 1.0 I/O Usage: Pot: Frequency Dig In: reset CV In: Frequency Dig Out: Square wave out CV Out: Wave Out created May 22, 2014 Tim Ressel This example code is in the public domain. */ // These constants won't change. They're used to give names // to the pins used...
#include <bits/stdc++.h> using namespace std; #define TESTC "" #define PROBLEM "10921" #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) #define MAXN 100 string change(string str){ for(int i = 0 ; i < str.size() ; i++ ){ if( 'A' <= str[i] && str[i] <= 'C' ) str[i] = '2'; if( 'D' <= str[i] && str...
#include <iostream> using namespace std; int main(){ int size; cin >> size; int sum = 0; string input; cin >> input; for(int i = 0; i < size; i++){ sum += input[i] - '0'; } cout << sum << endl; return 0; }
#ifndef TREEFACE_MAT2_H #define TREEFACE_MAT2_H #include "treeface/math/Vec2.h" #include <treecore/SimdObject.h> #include <cmath> namespace treeface { template<typename T> struct Mat2 { typedef treecore::SimdObject<T, 4> DataType; Mat2() noexcept: data(T(1), T(0), T(0), T(1)) { } Mat2(const D...
#include<iostream> #include<cstdio> using namespace std; #define ull unsigned long long #define ll long long #define ul unsigned long #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define pi acos(-1.0) #define mod 10000000007 int main() { ios_base::sync_with_stdio(...
#include "sandbox-finalize-worker.h" #include "sandbox.h" #include <iostream> SandboxFinalizeWorker::SandboxFinalizeWorker(Nan::Callback *callback, SandboxWrap *sandbox) : AsyncWorker(callback), sandbox_(sandbox) {} SandboxFinalizeWorker::~SandboxFinalizeWorker() {} void SandboxFinalizeWorker::Execute() { ...
/* * @Description: 实时显示,主要是点云 * @Author: Ren Qian * @Date: 2020-02-29 03:19:45 */ #ifndef LIDAR_LOCALIZATION_MAPPING_VIEWER_VIEWER_HPP_ #define LIDAR_LOCALIZATION_MAPPING_VIEWER_VIEWER_HPP_ #include <string> #include <Eigen/Dense> #include <yaml-cpp/yaml.h> #include "lidar_localization/sensor_data/cloud_data.hpp"...
#include "stdafx.h" #include "CallsignTests.h" #include "StringUtils.h" #include "Callsign.h" #include "Qso.h" CallsignTests::CallsignTests() : TestBase("CallsignTests") { } CallsignTests::~CallsignTests() { } bool CallsignTests::Setup() { if (SetupComplete()) return SetupStatus(); if (!TestBase::S...
#include <iostream> #include <set> using namespace std; int main(){ int n; cin >> n; int a[n]; for(int i = 0; i < n; ++i){ cin >> a[i]; } int x; cin >> x; int l = 0,r = n - 1; int m = (l + r )/2; bool found = false; if(x <= r){ while(l<r){ ...
#include <iostream> #include <vector> using namespace std; vector<int > v; int memo[2005]; int suma134(int n) { if(n <= 2) return 1; if(n == 3) return 2; if(memo[n] != 0) return memo[n]; memo[n] = suma134(n-1) + suma134(n-3) + suma134(n-1); return memo[n]; } int main()...
// // Created by nadya on 10.12.2018. // #include "utils.h" bool isPrime(int x) { bool is_prime = true; for (int i = 2; i < x; i++) { int factor = x/i; if (factor * i == x) { cout << "Find factor " << factor << endl; is_prime = false; break; ...
#ifndef LIBREACTOR_DISTRIBUTION_DEBUG_H #define LIBREACTOR_DISTRIBUTION_DEBUG_H #include <string.h> #include <stdio.h> #include <string> #define LOG_DEBUG(format, ...) do { fprintf(stdout, "[DEBUG] [%s:%d] " format "\n", strrchr(__FILE__, '/') + 1, __LINE__, ##__VA_ARGS__); } while(0) #endif //LIBREACTOR_DISTRIBUTI...
#include <vector> #include <iostream> using namespace std; typedef vector<int> vi; int binarySearchIndex(vi& A, int l, int r, int x){ if(r>=l){ int mid = l + (r-l)/2; if(A[mid]==x) return mid; if((r-l)/2 == 0){ if(mid == 0 && A[mid] > x) return mid; if(A[mid] > x) return mid; else return mid+1; }...
// NodesTree.hpp #ifndef PARSER_NODESTREE_NODES_TREE_HPP #define PARSER_NODESTREE_NODES_TREE_HPP #include <nodestree/Node.hpp> #include <nodestree/UniversalNode.hpp> #include <stdexcept> namespace parser { template< class T > class NodesTree : public Node< T > { protected : class Iterator...
#ifndef PROG_H #define PROG_H #include <string> #include <map> #include <vector> #include "sem.h" #include "expr.h" #include "instr.h" #include "../Term.h" #include "Function.h" class Prog { public: Prog(LTerm* ); function::Function* getFunction(std::string ); private: void analyse_block(LTerm*); void...
// // Created by davelinux on 23.2.19. // #include "Network.h" #include <dlib/opencv.h> #include "../utils/Utils.h" #include <iostream> #include <dlib/dnn.h> #include <dlib/image_io.h> #include <dlib/image_processing.h> #include <dlib/data_io.h> #include <ctime> #include "opencv2/opencv.hpp" using namespace std; usi...
class Solution { public: void reOrderArray(vector<int> &array) { if(array.size() < 2){ return; } //方法1.空间换时间 vector<int> odd; vector<int> even; for(int i=0; i<array.size(); ++i){ if(array[i] % 2 == 0){ even.push_back(array[i]);...
#include "stdafx.h" #include "Prof-UIS.h" extern "C" __declspec(dllexport) HWND WINAPI UISalPropertyGridCreate(HWND parentWindow, UINT controlID, int x, int y, int width, int height, DWORD windowStyle, DWORD windowExStyle) { // access parent window CWnd* parentWindowClass = NULL; if (parentWindow != NULL) { pare...
// Created on: 2014-03-12 // 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 <iostream> #include <vector> #include <cstring> #include <queue> typedef long long ll; std::vector<std::pair<int, ll>> link[100001]; int parent[100001][17], level[100001]; ll dist[100001][17]; void bfs() { bool visited[100001]; std::queue<std::pair<int, int>> q; std::memset(visited, 0, sizeof(vi...
#include <bits/stdc++.h> using namespace std; #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) #define MAXN 100 #define INF 0x3f3f3f3f #define DEVIATION 0.00000005 int main(int argc, char const *argv[]) { long long num; string str; vector <long long> coe; while( ~scanf("%lld\n", &num) ){ getline...
#include <stdio.h> #include <stdlib.h> #include "03-hanoi01.h" /** * Add plate to pole */ void Pole::add(Plate plate) { plates[plate_size] = plate; plate_size++; } /** * Remove top plate and return that */ Plate Pole::pop() { if(plate_size <= 0){ printf("Can't pop!"); } plate_size--; Plate tmp = plates[...
#include <iostream> #include <fstream> #include <string> using namespace std; #include "pbaf_protocol_service.h" int main(int argc, char** args) { if(argc < 3) { cout << "Usage: db_download <host> <port>" << endl; return 1; } pbaf_server serv; serv.address = string(args[1]); serv.port = atoi(args[2]); pb...
#include "treedelegate.h" TreeDelegate::TreeDelegate(QObject *parent) { } QWidget *TreeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { } bool TreeDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QSt...
#include "stdafx.h" #include "CocosTool.h" #include "GcActorTemplateDockable.h" #include "GcNewObjectDlg.h" #include "ActorMacro.h" GcActorTemplateDockable::GcActorTemplateDockable(void) { } GcActorTemplateDockable::~GcActorTemplateDockable(void) { } void GcActorTemplateDockable::ReciveNotiyfiMessage(WPARAM wPara...
#include "square.h" using namespace std; Square::Square(float side) : Rectangle(side, side){ set_name("Square"); set_colour("Purple"); }
//Accepted. Time-0.060s. #include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> string s, ans, t; string getString(char x) { string s(1, x); return s; } void backtrack(ll m, string ans) { if(m==s.size()) { cout<<ans<<"\n"; return; } f...
#include <errno.h> #include <unistd.h> #include <signal.h> #include <sys/epoll.h> #include <sys/signalfd.h> #include <sys/timerfd.h> #include <sys/socket.h> #include <netinet/in.h> #include <array> #include <iostream> #include "unique_handle.h" #include <experimental/coroutine> struct epoll_event_awaiter { ep...
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- // // Copyright (C) 2010 Opera Software AS. All rights reserved. // // This file is part of the Opera web browser. It may not be distributed // under any circumstances. // // Adam Minchinton // #ifndef __DOWNLOAD_MANAGER_MANAGER_H__ #define _...