text
stringlengths
8
6.88M
#include "SpaceMappedDataPersistenceHandler.h" namespace Utilities { }
#include<bits/stdc++.h> using namespace std; #define ll long long #define fr(i,n) for (ll i=0;i<n;i++) #define fr1(i,n) for(ll i=1;i<=n;i++) map<ll, ll> mp, mp1; int main() { ll m,n,i,j,k,l,x,y,ans=0; cin>>n; fr(i,n) { cin>>x>>y; ans+=mp[x+y]++, ans+=mp1[x-y]++; ...
#include <iostream> #include <vector> #include <map> using namespace std; void Solve() { int N; cin >> N; if (N == 1) { cout << 2 << "\n"; return; } if (N == 2) { cout << 16 << "\n"; return; } if (N == 3) { cout << 32 << "\n"; return; } ...
#include "SDL2DemoFramework.h" #include "DemoUtils/DrawModel.h" void SDL2DemoFramework::Input() { SDL_Event Event; while(SDL_PollEvent(&Event)) { if(Event.type == SDL_QUIT) { Running = false; } if(Event.type == SDL_KEYDOWN) { if(Event.key.keysym.sym == SDLK_w) {CameraForward = true;} if(E...
#include "proto_printer_source.h" #include <CORE/BASE/checks.h> #include <CORE/BASE/logging.h> #include <CORE/HASH/crc32.h> #include <CORE/UTIL/stringutil.h> #include <fstream> #include <set> #include <string> using core::base::BlobSink; using core::memory::Blob; using core::types::EnumDef; using core::types::FieldD...
/* pxCore Copyright 2005-2021 John Robinson 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...
#include "bob.h" namespace bob { std::string hey(std::string line) { line.erase(std::remove_if(line.begin(), line.end(), isspace), line.end()); int upperCase = 0, lowerCase = 0, digitCase = 0; for (auto c : line) { if (isupper(c)) upperCase++; if (islower(c)) lowerCase++; if (isdigit(c)) digitCase++; ...
#include "HashingFunctions.h" /* - A high load factor is making the searching slow - While a low load factor is using too much memory The perfect load factor for a hashtable is around ~log 2 (~0.7), because of reasons I won't go into in this comment.. :p In the linear probing table, I'm using 20, because it's...
#include "system/pr2_eih_mapping.h" #include "sqp/pr2_eih_sqp.h" #include "../util/logging.h" #include <boost/program_options.hpp> namespace po = boost::program_options; const int T = TIMESTEPS; class PR2EihMappingNBV : public PR2EihMapping { public: PR2EihMappingNBV(int max_occluded_regions, double max_travel_dist...
#include "Const.h" #include "Box.h" #include "Game.h" /** * @param type 類型 * @param x, y 左上角座標 * @param bitmap 遊戲區域圖 * @param back 背面圖像 */ Box::Box(Type type, int x, int y, QPixmap* bitmap, Spirit* back) : Spirit(type, x, y, bitmap),m_currentImage(&m_imageDown1),m_back(back) { ...
#include "GLExt.h" PFNGLGENBUFFERSPROC glGenBuffers; PFNGLBINDBUFFERPROC glBindBuffer; PFNGLBUFFERDATAPROC glBufferData; PFNGLDELETEBUFFERSPROC glDeleteBuffers; PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; PFNGLBINDVERTEXARRAYPROC glBindVertexArray; PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray; PFNGLVER...
#include <iostream> int main() { char* text = "Hello world!"; // Is error with /permissive- but is not with /permissive std::cout << text << std::endl; return 0; }
namespace AST_Graph{ template<typename Functional1, typename Functional2> DataMemberPointersToIR<Functional1,Functional2>::DataMemberPointersToIR(const Functional1& addNodeFunctional, const Functional2& addEdgeFunctional,traversalType tT, pointerHandling graphEmpty) : DOTRepresentation<SgNode*>(), nodeFunctio...
/*--------------------------------------------------------*/ /* */ /* Author: Farhan Tariq Janjua */ /* Fiverr: https://www.fiverr.com/users/a1_developers/ */ /* */ /*--------...
#include <iostream> using namespace std; /* Проверить истинность высказывания: «Среди трех данных целых чисел есть хотя бы одна пара взаимно противоположных». */ int main () { int a,b,c; cout<<"Введите первое число : "; cin>>a; cout<<"Введите второе число : "; cin>>b; cout<<"Введите треть...
#include <iostream> using namespace std; double max(double x, double y) { if (x > y) return x; return y; } double min(double x, double y) { if (x > y) return y; return x; } double add(double x, double y) { return x + y; } double multiply(double x, double y) { return x * y; } double diff(double x, double y) {...
#include "Principal.h" #include "Customs.h" int *MAP_CHECK = (int*)0x0067198C; int *MAIN_STATE = (int*)0x0067AC98; ptr_glEnable glEnable_Real = (ptr_glEnable)&glEnable; ptr_glClearColor glClearColor_Real = (ptr_glClearColor)&glClearColor; unsigned int Textures[5]; RGBAStruct FogMapColor(int Map) { RGBAStr...
/* MedianFilter.cpp - Median Filter for the Arduino platform. Copyright (c) 2013 Phillip Schmidt. All right reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either versi...
// // Copyright Jason Rice 2016 // 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) // #ifndef NBDL_CONCEPT_STRING_HPP #define NBDL_CONCEPT_STRING_HPP #include <nbdl/concept/DynamicBuffer.hpp> #include <type_traits>...
#include "pushButtonMagazine.h" #include "config.h" //byte sendData[PACKET_SIZE]; void setupMagazineButton() { pinMode(pushBtnMagazine, INPUT); } int updateMagazineButton() { int value = 0; if(digitalRead(pushBtnMagazine) == LOW){ value = 1; // bitSafety bitSafety bitMagazine(32 or 0) bitFree bitFree b...
/* * SPDX-FileCopyrightText: 2017 Rolf Eike Beer <eike@sf-mail.de> * * SPDX-License-Identifier: GPL-3.0-or-later */ #pragma once #include <libxml/tree.h> #include <memory> #include <osm2go_stl.h> #include <osm2go_platform.h> struct xmlDelete { inline void operator()(xmlChar *s) { xmlFree(s); } }; clas...
#pragma once namespace KoalaComponent { enum NotificationConst { UNUSED_TAG = 0 }; inline int getUniqueId() { static int id = NotificationConst::UNUSED_TAG + 1; return ++id; } template<typename... Args> class Notification { public: Notification( int dummyInt ): //dummyInt used only for prevent creating unuse...
#ifndef PIPE_H #define PIPE_H class Pipe { }; #endif // PIPE_H
#include <iostream> #include<vector> #include <algorithm> #include <string> using namespace std; string i2s(int n){ if(n == 0) return "0"; string s = ""; while(n != 0){ s += (char)(n%10 + '0'); n /= 10; } reverse(s.begin(), s.end()); return s; } static bool cmp(string a, string ...
class Solution { public: bool isPalindrome(int x) { if(x < 0) return 0; int a = x, b = 0; while(x > 0) {b = 10*b + x % 10; x /= 10;} return (a == b); } };
#ifndef __CONDITION_H #define __CONDITION_H #include "file.h" // that's the condition interface; A condtion have just to be met class Condition { public: virtual bool isMet(File*) = 0; }; class FileExtensionIs : public Condition { string _str; public: FileExtensionIs(string); bool isMet(File*...
#pragma once #include <boost/interprocess/managed_mapped_file.hpp> #include <boost/interprocess/sync/file_lock.hpp> #include <boost/filesystem.hpp> #include <boost/asio/io_service.hpp> namespace chainbase { namespace bip = boost::interprocess; namespace bfs = boost::filesystem; class pinnable_mapped_file { publi...
#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <networktables/NetworkTable.h> #include <stdlib.h> #include <stdio.h> using namespace cv; using namespace std; using namespace nt; Mat hsvImg; Mat binaryImg; // color filter params int minColor_h...
#ifndef _GPIO_H_ #define _GPIO_H_ #include "stm32f0xx.h" #include "System.h" #include "delay.h" class C_GPIO { public: C_GPIO(){}; C_GPIO(GPIO_TypeDef * port, U16 pin){init_pin(port, pin);}; void init_pin(GPIO_TypeDef * port, U16 pin); void set_as_input(GPIOPuPd_TypeDef type = GPIO_PuPd_NOPULL); v...
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ClapTrap.cpp :+: :+: :+: ...
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ClassAbstractVM.cpp :+: :+: :+: ...
// Created by wangwenjie on 2013/04 #ifndef __SPLASH_SCENE_H__ #define __SPLASH_SCENE_H__ #include "cocos2d.h" class Splash : public cocos2d::Layer { private: long long m_startTime; cocos2d::Scene *m_nextScene; void onCreateNextScene(float delay); void onGotoNextScene(float t); public: // Here's a differe...
#include "unManaged_USB.h" #include <time.h> #include <windows.h> static int parseRaw(unsigned char *datain, unsigned char *data_buffer, int *start_address, int *end_address, size_t size); static void printProgress(float progress); static void printText(int code,int data1, int data2); unsigned char dataBuffer[65792]; ...
/* * The Akafugu Nixie Clock * (C) 2012-13 Akafugu Corporation * * 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. ...
#include<bits/stdc++.h> using namespace std; bool check(vector<stack<int>>& arr1,vector<queue<int>>& arr2,int n,int e) { for(int i=0;i<=n;i++) { stack<int> s = arr1[i]; queue<int> q = arr2[i]; while(!s.empty() && !q.empty()) { if(s.top() != q.front()) { return false; } s.pop(); q.pop(); ...
#include "ccmviewcontrols.h" #include "dtccmtest.h" CCMLogBar::CCMLogBar(QWidget *parent) : QDockWidget(parent) { setFeatures(QDockWidget::DockWidgetMovable); setWindowTitle(tr("System Output Log")); m_pEditBar = new QTextEdit(); m_pEditBar->setReadOnly(true); setWidget(m_pEditBar); } CCMLogBar::~CCMLogBar() {...
#include "waveview.h" Waveview::Waveview(QWidget* parent) : QChartView(parent) { quint8 number=0; while(number < WAVENUMBER){ _series_AP[number] = new QLineSeries; number++; } _series = new QLineSeries; wave_init(); } void Waveview::wave_init() { WAVE wave_name = INS_YAW; w...
#include<cstdio> #include<iostream> #include<algorithm> #include<vector> using namespace std; int father[210]; //查找祖先节点,当节点记录的祖先是自己,则表示查找到祖先了 int findFather(int x) { while(x!=father[x]) { x = father[x]; } return x; } //合并节点:设置共同祖先 void Union(int a,int b) { int fa = findFather(a); int fb ...
#include "Rasterizer.h" #include <thread> static Vector3 sFog = Vector3(1.0f, 1.0f, 0.95f); static float fogDecal = -0.6f; Rasterizer::Rasterizer(uint width, uint startHeight, uint endHeight, BufferData* bufferData) { m_startHeight = startHeight; m_bufferData = bufferData; m_height = endHeight; m_width = width; ...
/* Copyright 2017-2018 All Rights Reserved. * Gyeonghwan Hong (redcarrottt@gmail.com) * Eunsoo Park (esevan.park@gmail.com) * Injung Hwang (sinban04@gmail.com) * * [Contact] * Gyeonghwan Hong (redcarrottt@gmail.com) * * Licensed under the Apache License, Version 2.0(the "License"); * you may not use this f...
#pragma once #include <array> #include <exception> #include "base_types.hpp" #include "simd.hpp" namespace simd { #if SIMD_SUPPORTS(SIMD_AVX) using float64x4 = vector<double, 4>; template <> class vector<double, 4> : public vector_base<double, 4> { public: static constexpr int required_version = native_vector...
#include "type.h" #include <iostream> using namespace std; Type::Type() { type = " "; index = 0; } Type::Type(string type_, uint64_t index_) { type = type_; index = index_; } void Type::insertCharacter(Character newchar) { for (int i = 0; i < chars.size(); i++) //See if character is already in the vector if ...
#include <cstdio> #include <math.h> #include <iostream> using namespace std; int main() { int t=1,r,n; while(scanf("%d %d",&r,&n)!=EOF) { float v=r-n; if(r==0 && n==0) break; if(r<n) { printf("Case %d: 0\n",t++); } else if(v/n>26) ...
// github.com/andy489 #include <iostream> #include <string> #include <climits> using namespace std; struct Stone { Stone *prev, *next; string color; int number; Stone(string color, int number, Stone *prev = nullptr, Stone *next = nullptr); //constructor with two default arguments }; struc...
#include "LogManager.h" #include <iostream> LogManager::LogManager() { m_flag = NULL_AIM; } void LogManager::Init(std::string &logFileName) { this->m_logFile = logFileName; if (m_logFile.empty()) { m_flag = CONSOLE; } else { m_flag = FILE; // TODO: file opening } } void LogManager::SetFlag(LogManage...
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <dshow.h> #include "qedit.h" // for SampleGrabber #include <Windows.h> #include <atlconv.h> #include <Wincodec.h> #include <stdio.h> #include <fstream> #include <vector> #pragma comment(lib, "Ole32.lib") #pragma comment(lib, "Windowscodecs.lib") using nam...
#include <iostream> #include "Engine/game.h" int main() { std::cout << "Controls: X = SHOW / HIDE MENU, Y = CHANGE SIMULATION SPEED\n\n"; Game app({640, 480}, "WireWorld"); while(!app.getWindow()->IsDone()) { app.HandleInput(); app.Update(); app.Render(); app.Restart...
#ifndef BUW_LIST_HPP #define BUW_LIST_HPP #include <cstddef> #include <utility> template <typename T> class List; template <typename T> struct ListNode { ListNode() : m_value {}, m_prev {nullptr}, m_next {nullptr} {} ListNode(T const& v, ListNode* prev, ListNode* next) : m_value{v}, m_prev{prev}, m_next{...
/* * Shape.cpp * */ #include "Shape.h" namespace rt {} // namespace rt
#ifndef _BFS_H_INCLUDED #define _BFS_H_INCLUDED #include <cstring> #include <iostream> #include <queue> #include <GL/glut.h> #include <deque> #include "../GameManager.h" // Check if it is possible to go to (x, y) from current position. The // function returns false if the cell has value 0 or already visited bool i...
int Led = 13; // LED on Arduino board int Shock = 3; // sensor signal int val; // numeric variable to store sensor status void setup() { pinMode(Led, OUTPUT); // define LED as output interface pinMode(Shock, INPUT); // define input for sensor signal } void loop() { val = digitalRead(Shock); // read and ...
#include <iostream> #include <iomanip> #include <windows.h> #include <stdio.h> using namespace std; int g = 0, k = 0, range = 0, counte = 0; char** mass1 = new char* [5]; char** mass2 = new char* [5]; char** mass3 = new char* [5]; void prog1(char **massi, ...) { char ***mass = &massi; SetConsoleCP(1251); SetCons...
// // hwGLLight.cpp // HamsterWheel // // Created by OilyFing3r on 2014. 9. 2.. // Copyright (c) 2014년 OilyFing3rWorks. All rights reserved. // #include "hwGLLight.h" const glm::vec4 & GLLight::getPosition (void) const { return position; } const glm::vec4 & GLLight::getAmbient (void) const { return ambient; ...
#define TYPE_WHEEL 0x02 #define TYPE_DOOR 0x04 #define TYPE_BUMPER 0x06 bool saving = 0, opening = 0; void savescene(){ saving = 1; SDL_WM_SetCaption("SAVING FILE...",NULL); int ib;//integer buffer float fb;//float buffer //creating file std::ofstream file_out("models/out.hmdl"); file_out.cl...
#include <list> #include <map> #include <stack> #include <stdlib.h> using namespace std; int* condense(list<int> * cg_stripped, int count, int &SCC_count);
//$Id$ //------------------------------------------------------------------------------ // TestAbsoluteDate //------------------------------------------------------------------------------ // GMAT: General Mission Analysis Tool // // Author: Wendy Shoan // Created: 2016.05.11 // /** * Uni...
class Solution { public: int pivotIx(vector<int>& dict, int s, int e, int pivot){ /* return the first index larger than pivot smaller on the left and larger on the right */ int i = s, j = e-1; while (i <= j){ if (dict[i] < pivot){ i += 1;...
// $Id: UnaryExpression.h,v 1.9 2013/02/09 19:00:34 david Exp $ -*- c++ -*- #ifndef __CDK8_NODE_EXPRESSION_UNARYEXPRESSION_H__ #define __CDK8_NODE_EXPRESSION_UNARYEXPRESSION_H__ #include <cdk/nodes/expressions/Expression.h> #include "SemanticProcessor.h" namespace cdk { namespace node { namespace expression { ...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) #define ok() puts(ok?"Yes":"No"); using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<vi> vvi; typedef vector<ii> vii; typedef vector<bool> vb; typedef vector<vb> vvb; typedef set<int> si; ty...
// // Created by artim on 15.06.2020. // #include "Server.h" #include "Client.h" #include <smmintrin.h> #include <iostream> using std::cout; Server::Server() : listeningThread(this), receiveThread(this) { this->socket.bind(5000); this->exit_flag = true; listeningThread.init_passed = true;...
#include "Line.h" Line::Line() : origin(Vector2D(0, 0)), destiny(Vector2D(0, 0)) { CalculateVectorArrows(); setColor(255, 255, 255); } Line::Line(const Vector2D& orig, const Vector2D& dest) : origin(orig), destiny(dest) { setColor(255, 255, 255); CalculateVectorArrows(); } Line::~Line() {...
class Solution { public: vector<string> generateParenthesis(int n) { vector<string> result; string curstr = ""; genpar(n, 0, 0, result, curstr); return result; } void genpar(int n, int left, int right, vector<string>& result, string curstr) { if(left == n) { ...
#include "Array.hpp" template<typename T> Array<T>::Array(): _length(0), _array(nullptr) {} template<typename T> Array<T>::Array(unsigned int n): _length(n) { this->_array = new T[n](); } template<typename T> Array<T>::Array(const Array& copy): _length(copy._length) { if (copy._length > 0) { t...
#ifndef DIALOGSAVEAS_H #define DIALOGSAVEAS_H #include <QDialog> namespace Ui { class dialogsaveas; } class dialogsaveas : public QDialog { Q_OBJECT public: explicit dialogsaveas(QWidget *parent = 0); ~dialogsaveas(); private slots: void on_buttonBox_accepted(); private: Ui::dialogsaveas *ui; ...
#pragma once #include<string> using namespace std; class Fahrzeug { public: Fahrzeug(); Fahrzeug(string namestr); Fahrzeug(string namestr, double MaxGeschwindigkeit); Fahrzeug(const Fahrzeug& fahrzeug); virtual ~Fahrzeug(); void virtual vostreamAusgabe(ostream &out); void virtual vAusgabe(); void virtual vAb...
#ifndef VIEWERS_EMPTY_VIEWER_HEADER #define VIEWERS_EMPTY_VIEWER_HEADER #include "Viewer.h" namespace solar { //Does nothing class EmptyViewer :public Viewer { public: void operator()() override final {} }; } #endif
// // document_collection.cpp // TextRetrieval // // Created by Joseph Canero on 11/15/15. // Copyright © 2015 jcanero. All rights reserved. // #include "document_collection.hpp" size_t DocumentCollection::get_avg_doc_length() { if (shouldComputeDocLengths()) { size_t res = accumulate(m_Documents.begi...
#include <stdio.h> int main(const int argc, const char* const argv[]) { printf_s("hello"); return 0; }
/* * Copyright (c) 2009-2012 André Tupinambá (andrelrt@gmail.com) * * 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 limitation the rights * to use...
#ifndef INPUT_BUFFER_H #define INPUT_BUFFER_H #include "Global.h" class InputBuffer { public: InputBuffer(FILE* inputFile); int getNextBit(); ull getBunchOfBits(int howMany); void close(); private: ull* buffer; int maxSize; int size; int curPos; ull nextBit; int nextBitPos; FILE* file; void fillBuffer...
#include<bits/stdc++.h> using namespace std; // refer notes int main() { int t; cin >> t; int arr[8] = {0,1,1,2,0,2,2,1}; int sum_arr[8] = {0,1,2,4,4,6,8,9}; int sum = 9; while(t--) { int n; cin >> n; int total = 0; // total = previous groups sum + current fibonacci number // to get the previous g...
#include <iostream> #include "calc.h" extern int yylex(); extern int yylineno; extern char* yytext; int main(void) { int ntoken; ntoken = yylex(); while(ntoken) { printf("\nToken : %d Value : %s Line : %d",ntoken,yytext,yylineno); ntoken = yylex(); } /*while(ntoken) { printf("\nToken : %d",ntoken); i...
#include <bits/stdc++.h> using namespace std; const int MAX_INT = std::numeric_limits<int>::max(); const int MIN_INT = std::numeric_limits<int>::min(); const int INF = 1000000000; const int NEG_INF = -1000000000; #define max(a,b)(a>b?a:b) #define min(a,b)(a<b?a:b) #define MEM(arr,val)memset(arr,val, sizeof arr) #defi...
// // CCEditboxLoader.cpp // cocos2d_libs // // Created by xuruoji on 14-4-12. // // #include "CCEditboxLoader.h" namespace cocosbuilder { cocos2d::ui::EditBox * EditBoxLoader::createNode(cocos2d::Node * pParent, cocosbuilder::CCBReader * ccbReader) { cocos2d::ui::EditBox* pNode = cocos2d::ui:...
/* * 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/Singleton> #include <flux/Process> #include <flux/Bundle> #include "LogPrototype.h" #include "NodeConfigProtocol.h" namespace fluxnode { class NodeP...
/* Multi-neighborhood tabu search for the maximum weight clique problem * * 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 versio...
/* Name : Toroid Calculator Author: Ben Rockhold Date: 02/20/15 Description: Calculate the volume and surface area for each toroid in a given set. Expected input is a text file "toroids.txt," each line of which contains a pair of decimal numbers representing first the radius of the tube, ...
/** * Copyright (C) Mellanox Technologies Ltd. 2017. ALL RIGHTS RESERVED. * * See file LICENSE for terms. */ #include <common/test.h> #include <uct/uct_test.h> extern "C" { #include <uct/api/uct.h> #include <ucs/sys/sys.h> #include <ucs/sys/string.h> #include <ucs/arch/atomic.h> } #include <queue> class test_uct_s...
//#include "names.hpp" #include "world.hpp" unsigned Identifiable::nextID = 0; void connectIslands(Island* a, Island* b) { a->addNeighbour(b); b->addNeighbour(a); } BattleSide* getBattleSideFromFaction(std::list<BattleSide>& sides, Faction* faction) { if(faction == NULL) { std::cerr << "Error in ...
#include "CDateTime.h" #include "CAutoLock.h" #include "CInterval.h" #include <stdio.h> #include <stdlib.h> #include <memory.h> using namespace Util; int CDateTime::_localTimeZone = -8; CDateTime CDateTime::_lastDt(0); bool parseYMD(struct tm* time, unsigned long* millis, const char ch, con...
/*! * Modifications Copyright 2017-2018 H2O.ai, Inc. */ // original code from https://github.com/NVIDIA/kmeans (Apache V2.0 License) #pragma once #include <cublas_v2.h> #include <thrust/device_allocator.h> #include <thrust/device_malloc_allocator.h> #include <thrust/device_vector.h> #include <thrust/fill.h> #include ...
#ifndef DIELECTRIC_H #define DIELECTRIC_H #include "Material.h" class Dielectric : public Material { public: Dielectric(float ri) : ref_idx(ri) {} virtual bool scatter(const Ray &rayIn, const hit_record &rec, vec3 &attenuation, Ray &scattered) const { vec3 outward_normal; vec3 reflected = Reflect(rayIn...
//#include <iostream> #include <bits/stdc++.h> using namespace std; int used[8],L[15],R[15]; int in[8][8]; vector<int> locate[8]; void Queens(int n){ if(n >= 8){ for(int i=0;i<8;++i){ locate[i].push_back(used[i]); } return; } for(int i=0;i<8;++i){ if(used[i] =...
// Copyright ⓒ 2020 Valentyn Bondarenko. All rights reserved. #pragma once #include <IEngine.hpp> namespace be::script { // SOL2 throws exceptions through error class derived from std::exception. // And so we use it to provide high-level error description. class ScriptSystem : public IEngine, ...
#include <string> #include <vector> #include <fstream> #include <unistd.h> #include <cstdio> /* Width of each line in the table file, in bytes. */ const int TABLE_ENTRY_WIDTH = 5; /** * The Log class implements a generic, 1-indexed log that backs up to a file * and can be recovered from a file. Individual log entri...
#include <iostream> #include "Instruction.hpp" Instruction::Instruction() {} FaceInstruction::FaceInstruction(FaceType face, bool clockwise) : face(face), clockwise(clockwise) {} void FaceInstruction::print() const { char faceLetter{}; switch (face) { case FaceType::FRONT: faceLetter = 'F'; break; case Fac...
#ifndef __TIME_HH__ #define __TIME_HH__ #include <string> #include <time.h> using Clock = double; inline std::string ClockToString(const Clock& clock) { return std::to_string(clock); } namespace Time { static clock_t __lapTime; static constexpr Clock clockPerSec = (Clock)CLOCKS_PER_SEC; static constexpr Clock cl...
/* * Simon written by liamsdomain for arduino * This code is public domain and free use */ //define button pins #define butRed 8 #define butYel 9 #define butWhi 10 #define butGre 11 //define LED pins #define ledRed 2 #define ledYel 3 #define ledWhi 4 #define ledGre 5 //variables used for button logic //sta...
#include "incu8ator.h" inline void incu8ator::clearSS(std::stringstream& ss) { if(ss) { ss.str(""); ss.clear(); } } void incu8ator::sdt(std::string& s) { time_t now = time(0); struct tm tstruct; char buf[80]; tstruct = *localtime(&now); strftime(buf, sizeof(buf), "%Y.%m.%d %X", &tstruct); ...
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; while(scanf("%lld %lld",&a,&b) != EOF) { a >= b ? printf("%lld\n",a - b) : printf("%lld\n",b - a); } return 0; }
#pragma once //RightArrowKey.h #ifndef _RIGHTARROWKEY_H #define _RIGHTARROWKEY_H #include "KeyAction.h" class RightArrowKey :public KeyAction { public: RightArrowKey(Form *form = 0); RightArrowKey(const RightArrowKey& source); ~RightArrowKey(); RightArrowKey& operator=(const RightArrowKey& source); virtual void...
#include "../include/eih_system.h" /** * EihSystem constructors and initializers */ EihSystem::EihSystem(rave::EnvironmentBasePtr e, Manipulator *m, KinectSensor *k) : env(e), manip(m), kinect(k) { mat uMin, uMax; manip->get_limits(uMin, uMax); init(uMin, uMax); } EihSystem::EihSystem(rave::EnvironmentBasePtr e...
/********************************** * FILE NAME: MP2Node.cpp * * DESCRIPTION: MP2Node class definition **********************************/ #include "MP2Node.h" /** * constructor */ MP2Node::MP2Node(Member *memberNode, Params *par, EmulNet * emulNet, Log * log, Address * address) { this->memberNode = memberNode; ...
#include "Hello.h" Hello::Hello(const std::string &message) { m_message = message; } std::shared_ptr<Prototype> Hello::clone() const { return std::make_shared<Hello>(""); } void Hello::setMessage(const std::string &message) { m_message = message; } std::string Hello::getMessage() const { return m_me...
/************************************************* * Publicly released by Rhoban System, August 2012 * www.rhoban-system.fr * * Freely usable for non-commercial purposes * * Licence Creative Commons *CC BY-NC-SA * http://creativecommons.org/licenses/by-nc-sa/3.0 *************************************...
#pragma once #include "data/allocator.h" #include "data/rawrecord.h" namespace data { //////////////////////////////////////////////////////////////////////// struct raw_info { raw_info(int id, double time=0.0, raw_type_t type=CR_NONE, std::string string=std::string()); public: int id_; double ...
// 338. Counting Bits // Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. // Example 1: // Input: 2 // Output: [0,1,1] // Example 2: // Input: 5 // Output: [0,1,1,2,1,2] // Follow up: // It is...
#include <iostream> using namespace std; int main() { double array[] = {1, 3, 6, 89}; cout << array[1] << endl; }
// ***************************************************************** // This file is part of the CYBERMED Libraries // // Copyright (C) 2007 LabTEVE (http://www.de.ufpb.br/~labteve), // Federal University of Paraiba and University of São Paulo. // All rights reserved. // // This program is free software; you can redist...
// This file is subject to the terms and conditions defined in 'LICENSE' included in the source code package #include <gtest/gtest.h> #include "proto/assembly_machine.h" namespace jactorio::data { TEST(UniqueDataManager, AssignId) { UniqueDataManager unique; proto::AssemblyMachineData data_1; ...