text
stringlengths
8
6.88M
int search(int dataArray[], int arraySize, int start, int target) { if (start < arraySize) { if(dataArray[start] == target) return start; else { if (dataArray[start] > target) return -1; else search(dataArray, arraySize,...
#include <iostream> using namespace std; #include "solution.h" int main() { Solution sol; cout << sol.mySqrt(0) << endl; cout << sol.mySqrt(1) << endl; cout << sol.mySqrt(2) << endl; cout << sol.mySqrt(3) << endl; cout << sol.mySqrt(4) << endl; cout << sol.mySqrt(5) << endl; cout << sol.mySqrt(6) << ...
#include "graphics\Singularity.Graphics.h" using namespace Singularity::Graphics; namespace Singularity { namespace Graphics { namespace Devices { class BufferedDrawingContext : public DrawingContext { private: #pragma region Nested Classes struct BLENDSTATE { D3D1...
#include <bits/stdc++.h> using namespace std; using ll = long long int; int const LOG = 31; ll inv[LOG][3]; int what_is_here(ll val, int bit){ return ( val & (1LL << bit)) != 0 ; } void dq(vector < ll >& v, int bit){ if(bit < 0) return ; vector < ll > down[2], seen(2, 0); ll one = 0, zero = 0; for(...
#ifndef _HS_SFM_BUNDLE_ADJUSTMENT_CAMERA_SHARED_GRADIENT_INFINITE_NORM_CALCULATOR_HPP_ #define _HS_SFM_BUNDLE_ADJUSTMENT_CAMERA_SHARED_GRADIENT_INFINITE_NORM_CALCULATOR_HPP_ #include <algorithm> #include <limits> #include <cmath> #include "hs_math/linear_algebra/eigen_macro.hpp" #include "hs_sfm/bundle_adjustment/c...
#include "BlockOrientedDataMapper.h" namespace Utilities { }
// github.com/andy489 // https://www.hackerrank.com/contests/practice-3-sda/challenges/monster-trucks #include <iostream> using namespace std; typedef long long ll; ll powNeeded(ll *trucks, ll *powers, ll n, ll distance) { ll power(0); int i(0); for (; i < n; ++i) power += (abs(distance - trucks...
#ifndef _GRID_H_INCLUDED #define _GRID_H_INCLUDED #include "tile.h" #include <vector> class Grid { public: int rows; int x; int y; int gridSize; std::vector<std::vector<Tile>> tiles; Grid(int arows, int ax,int ay, int agridSize); void initGrid(); }; void drawGrid(Grid* grid); #endif
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. Redistribution and use in source and binary forms...
#include "FusionReactor.hpp" FusionReactor::FusionReactor(SDL_Renderer *renderer, Texture *texture, int level) : Building(renderer, texture, "Fusion Reactor", level) { spriteClip = { 290 * level, 1470, 290, 260 }; }
#pragma once #include <vector> #include <map> #include <math.h> using namespace std; class Hermite { private: vector<pair<double, double> > points; vector<double> d; public: double hermit_esti(double x); void init_1(); };
#include<iostream> #include<string.h> using namespace std; void swap(char *a , char *b){ char temp = *a; *a= *b; *b=temp; } void permute(char *str, int l, int r){ int i; if(l == r) cout << str<<endl; else{ for(i=l;i<=r;i++){ swap((str+l),(str+i)); permu...
/* ** EPITECH PROJECT, 2019 ** Write.cpp ** File description: ** ${FILEDESCRIPTION} */ #include "Write.hpp" #include <unistd.h> Write::Write() { } void Write::my_write(int fd, const char *str, int i) { write(fd, str, i); }
class Single { public: static Single *create() { if (m_Pisngle != nullptr) { m_Pisngle = new Single(); } return m_Pisngle; } void tes() //这种定义是合法的,而作为类的成员 定义 Single a会报 不完整的类型 { Single a = Single(); } private: Single() { } static Single* m_Pisngle; };
// This file has been generated by Py++. #include "boost/python.hpp" #include "generators/include/python_CEGUI.h" #include "UnifiedDim.pypp.hpp" namespace bp = boost::python; struct UnifiedDim_wrapper : CEGUI::UnifiedDim, bp::wrapper< CEGUI::UnifiedDim > { UnifiedDim_wrapper(CEGUI::UnifiedDim const & arg ) ...
/* WORD CLOCK - 8x8 Rainbowduino Desktop Edition Hacked up by Russ Hughes Adapted and Remixed from: WORD CLOCK - 8x8 NeoPixel Desktop Edition by Andy Doro Hardware: - Rainbowduino - Tripple Color RGB common Anode Display - DS3231 RTC breakout - Two pcb mount push buttons & tiny PC board Software...
/* * Copyright 2016-2017 Flatiron Institute, Simons Foundation * * 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 ...
class Solution { public: typedef unsigned int uint; unsigned int* longestPalindrome(string &s) { unsigned int i = 0; string temp = "$"; unsigned int* record; unsigned int c_index = 2, i_mirror = 2, right_margin = 2; unsigned int max_length = 0, res_index = 0; unsign...
#include <iostream> #include <stdlib.h> #include <string.h> #include "processor.h" extern int yylex(); extern int yylineno; extern char* yytext; using namespace std; /* this function is to print the error in variable declaration */ void print_specification_var(int &uppercase, int &int_start, int &underscore, int &...
#include<bits/stdc++.h> using namespace std; #define INF 1000000000 long long a[100100], b[100100]; int n, melhorI, melhorJ; long long bruta(){ long long m = INF; for(int i = 0; i < 100; i++){ for(int j = 0; j < 100; j++){ long long dis = 0; for(int k = 0; k<n; k++){ dis+= abs(a[k] - i)+a...
#include<iostream.h> #include<conio.h> #include<string.h> class stud { public: int no; char name[20]; public : void get() { cout<<"enter the no:"; cin>>no; cout<<"enter the name:"; cin>>name; } }; class stud1 : public stud { public : void disp() { cout<<"\nstudent n...
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <cstring> using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int testCases, k, m; bool correct; string s, rs; char str[10000]; cin >> t...
/* * A sample prefetcher which does sequential one-block lookahead. * This means that the prefetcher fetches the next block _after_ the one that * was just accessed. It also ignores requests to blocks already in the cache. */ #include "interface.hh" const unsigned int MISS_MEMORY = 50; Addr miss_list[MISS_MEMORY]...
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "CyLandSplineProxies.h" #include "CyLandSplineSegment.h" CYLAND_API void HCyLandSplineProxy_Tangent::Serialize(FArchive& Ar) { Ar << SplineSegment; }
//#include <cstdio> //#include <cstring> //#include <algorithm> //#include <ctime> #include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; int a[100][100]; queue<pii> q; int main() { //freopen("..\\file\\input.txt","r",stdin); //freopen("..\\file\\output.txt","w",stdout); /*clock_t start_c,...
#pragma once #include <vector> #include <tudocomp/ds/IntVector.hpp> #include <tudocomp/Algorithm.hpp> #include <tudocomp/ds/DSDef.hpp> #include <tudocomp/compressors/lzss/FactorBuffer.hpp> #include <tudocomp_stat/StatPhase.hpp> namespace tdc { namespace lcpcomp { /** * the lex-parse compression strategy from th...
#include <iostream> #include "TinyCLexer.hpp" #include "TinyCParser.hpp" int main() { try { TinyCLexer lexer(std::cin); TinyCParser parser(lexer); parser.program(); } catch(std::exception& e) { std::cerr << "exception: " << e.what() << std::endl; } return 0; }
#ifndef __boardPractice__Menu__ #define __boardPractice__Menu__ #include <string> class Menu { private: int selection; public: Menu(); void displayMainMenu(); int getSelection(); //~Menu(); }; #endif /* defined(__boardPractice__Menu__) */
#include <cstdlib> #include <cstring> #include <iostream> #include <memory> #include "evaluators/shannon_evaluator.h" #include "position.h" #include "search/searcher.h" using apollo::Position; using apollo::evaluators::ShannonEvaluator; using apollo::search::Searcher; using apollo::search::SearchResult; namespace { ...
#include <FastIO.h> #include <I2CIO.h> #include <LCD.h> #include <LiquidCrystal.h> #include <LiquidCrystal_I2C.h> #include <LiquidCrystal_SR.h> #include <LiquidCrystal_SR2W.h> #include <LiquidCrystal_SR3W.h> #include <stdio.h> #include <string.h> #include <DS1302.h> /* Set the appropriate digital I/O pin connections...
// // StringUtil.cpp // SMFrameWork // // Created by KimSteve on 2016. 11. 3.. // // #include "StringUtil.h" #define BUFF_SIZE 1024 class comma_numpunct : public std::numpunct<char> { public: comma_numpunct() : decimalChar('.'), groupChar(','), groupingCnt("\03") { }; ~comma_numpunct(){};...
/* Prob. 110:Write a subfunction that finds the minimum and maximum values in a one-dimensional array of integers, and makes those two values available to a calling function. Assume that the calling function will pass a pointer to the array and a count of the number of values in the array. */ #include <fstream.h> ...
// // man.hpp // vk_graphs // // Created by Даниил on 29/03/2019. // Copyright © 2019 kyoshee. All rights reserved. // #ifndef man_hpp #define man_hpp #include <string> #include <vector> #include <map> #include <stdio.h> struct Person { int m_id; bool m_closed; std::string m_fn, m_ln, m_bd, m_ph, m_...
#pragma once #include "../interface/Image.h" DILIGENT_BEGIN_NAMESPACE(Diligent) /// TGA image decoding result. DILIGENT_TYPED_ENUM(DECODE_TGA_RESULT, Uint32) { /// JPEG image was decoded successfully. DECODE_TGA_RESULT_OK = 0, /// Invalid arguments (e.g. null pointer). DECODE_TGA_RESULT_INVALID_ARGUMENTS,...
#include <list> #include <iostream> #include <iterator> void PrintList(std::list<int> list) { std::list<int>::iterator iter; for (iter = list.begin(); iter != list.end(); iter++) { std::cout << *iter << " -> "; } std::cout << "NULL\n"; } int main() { std::list<int> g_list; // Declares a list of integer...
#ifndef VALIDATORTEST_H #define VALIDATORTEST_H #include <QTest> #include <QObject> #include <QHostInfo> #include <QUuid> #include <QJsonArray> #include <QJsonObject> #include <QJsonDocument> #include <QCryptographicHash> #include <QUrlQuery> #include <QStringList> #include <QRegularExpression> #include <QLocale> #in...
#include <iostream> #include <cmath> int main() { const double PI = 3.141593 int n; cin >> n; switch(n) { case 1: cout << "I love Luogu"; break; case 2: cout << 2 + 4 << " " << 10-2-4; break; case 3: cout << 14/4 << " " << 14-14%4 << " " << 14%4; ...
#include <bits/stdc++.h> using namespace std; /*Let dp[i] be optimal cost to rach (i,0) then we have 2 cases: if i is even: then we can either reach it from i-1 or from i/2 (Note that going a step back from i+1 wont lead to optimal cost as reaching i+1 involves reaching i/2 or i first) dp[i]= minimum(dp[i/2]+B,dp[i...
#include "oglwidget.h" #include "iostream" #include <QtOpenGL/qgl.h> #include <QtOpenGL/QtOpenGL> #include <GL/glu.h> #include <GL/gl.h> //#include <Utils/sout.h> OGLWidget::OGLWidget(QWidget *parent) : QOpenGLWidget(parent) { } OGLWidget::~OGLWidget() { } void OGLWidget::initializeGL() { //glfwWindowHint(...
#include<iostream> #include<string> using namespace std; int main(){ string s; int map[256]={0}; char cur = ' '; for(int i=0;i<s.size();i++){ if(map[s[i]]==0) cur = s[i]; map[s[i]]++; } if(map[cur]==1) cout<<cur; return 0; }
#ifndef TASKCOMMIT_H #define TASKCOMMIT_H #include <QString> #include "TaskCommitPlugin.h" #include "NonCopyable.h" #include "GlobalSetting.hpp" #include "ParaTask.h" /** * @brief The TaskCommitMgr class * 任务提交管理类.超算及数据库操作入口 * */ class TaskCommitMgr : public NonCopyable { public: TaskCommitMgr(); ~TaskCommi...
#pragma once /* Enable Name Coloring * Enable coloring of ALT names based on character type. * PATCHES: Pleione.dll */ #include "../Main.h" #include "../Singleton.h" #include "GenericPatcher.h" class CPatcher_EnableNameColoring : public IGenericPatcher { public: CPatcher_EnableNameColoring(); bool ReadINI( void...
/* * SQLiteConnector.cpp * * Created on: 23/09/2008 * Author: ecarrara */ #include "SQLiteConnector.h" #include "Logging.h" SQLiteConnector::SQLiteConnector(std::string strNomeDB) { this->m_strNomeDB = strNomeDB; criarBase(); } SQLiteConnector::~SQLiteConnector() { } int SQLiteConne...
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while( t --){ int n, k; cin >> n >> k; string s; cin >> s; vector<int>ones; for(int i = 0; i < n; i ++){ if(s[i] == '1'){ ones.push_back(i); } } int ans = 0; ...
#include<iostream.h> #include<conio.h> class maximum { public: void max(int a,int b) { if(a>b) { cout<<"\n A is max:"; } else { cout<<"\n B is max:"; } } void max(int x,int y,int z) { if(x>y && x>z) { cout<<"\n X is max:"; } else if(y>x && y>z) { cout<<"\n Y...
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. Redistribution and use in source and binary forms...
#pragma once #include "BackGround.h" #include "Snake.h" #include "Food.h" class Manager { static const int timeInterval; private: BackGround *background; Snake *snake; Food *food; bool isFoodInvalid(Food *food, Snake *snake); bool isGetFood(Food *food, Snake *snake); BFSPOSITION **pBFSArr; int directionArr[4...
class Solution { public: bool isRobotBounded(string instructions) { int face = 0; // 0-north, 1-east, 2-south, 3-west vector<vector<int>> dirs = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // 0-north, 1-east, 2-south, 3-west vector<int> cur = {0, 0}; for (char c : instructions) { ...
#pragma once #include "LoadActivity.h" #if defined(__WIN__) #include <Windows.h> #elif defined(__LIN__) #include <unistd.h> #include <pthread.h> #endif class CLoadRunner { protected: bool m_bRunning; unsigned long m_ulProcAffinity; CLoadActivity *m_sWorker; #if defined(__WIN__) HANDLE m_hThr...
void temperature(){ // Convert the data to actual temperature // because the result is a 16 bit signed integer, it should // be stored to an "int16_t" type, which is always 16 bits // even when compiled on a 32 bit processor. int16_t raw = (data[1] << 8) | data[0]; if (type_s) { raw = raw << 3; // 9 bi...
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. Redistribution and use in source and binary forms...
/** * @brief Lab3: Geometry (part 3) * * In this lab we do some basic geometry stuff. * * @author Romain Maffina * @date 26.02.2016 * @file main.cpp */ #include "point.h" #include "segment.h" #include "triangle.h" #include "geometrydrawing.h" #include "bmp.h" #include <iostream> using namespace std; int mai...
/* ROTATE AN ARRAY BY 90 DEGREE */ #include<iostream> using namespace std; int arr[][2]={1,2,3,4}; void rotate(int sr,int er) { if(sr>=er) return; int n=er+1-sr; int temp[n]; int t=0; for(int i=er;i>=sr;i--) { temp[t++]=arr[i][er]; arr[i][er]=arr[sr][i]; } /* for(int i...
#include<iostream> #include<conio.h> using namespace std; class Node{ private: int object; Node *nextnode; public: void set(int object){ this->object=object;} int get(){return object;} Node * getnext(){return nextnode; } void setnext(Node *nextnode){this->nextnode=nextnode;} }; class List{ private ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int s=0,w=0; while(t--){ int x,y; cin >> x >> y; if(x == y){ cout << "Sherlock's Shot" << "\n"; s++; } double_t c = (double_t)3/2; if(x == (c*y) || y == (c*x)){ cout << "Watson's Shot" << "\n"; w++; } } if(s == w...
// // UserTracker.cpp // earthQuakeProject // // Created by Allan Yong on 12-07-07. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #include <iostream> #include "UserTracker.h" UserTracker::UserTracker() { g_pTexMap = NULL; g_nTexMapX = 0; g_nTexMapY = 0; g_nViewState = DISPLAY_...
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* addTwoNumbe...
// Copyright 2019 Google LLC // // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. // // Auto-generated file. Do not edit! // Specification: test/f32-vmulc.yaml // Generator: tools/generate-vbinary-test.py #include <gtest/gtest.h> #...
//question-4 #include<iostream> using namespace std; class Rectangle { private: double length; double width; public: Rectangle(double len, double wid) { if(len>=0.0&&len<=20.0) { length=len; } if(wid>=0.0&&wid<=20.0) { width=wid; ...
#include "IpmtConfiguration.h" IpmtConfiguration::IpmtConfiguration() { indexType = "suffixtree"; compression="lzw"; countFlag = 0; wb = 1024; wl = 16; interrupt = -1; compressionLevel = 1; isCompressionLevelSet = false; } CompressionAlgorithm IpmtConfiguration::getCompressionAlgorithm() { if(compression ==...
inline qm_real livedata::get_mid() const { return m_last; } inline void blbcon::SecurityConnection() { Display* disp = 0; bb_identify(disp,m_id); bb_setuser(m_connection,m_id); } /// Return codes /// 1 already disconnected, do nothing /// 0 disconnected ok /// -1 failed to discon...
#include "physics\Singularity.Physics.h" namespace Singularity { namespace Physics { namespace Core { class World : public Singularity::Object { DECLARE_OBJECT_TYPE; private: #pragma region Variables DynamicSet<Colliders*> m_pDirtyColliders; Singularity::Octree<Collid...
/********************************************************************* Matt Marchant 2014 - 2016 http://trederia.blogspot.com xygine - Zlib license. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this soft...
/* * main.cpp * * Created on: Nov 15, 2016 * Author: silence */ /* #include <iostream> #include <boost/shared_ptr.hpp> class Base { public: Base():n(0) {}; virtual ~Base() {}; virtual void toString() { std::cout << "Base " << n << std::endl; } private: double n; }; class Driver : public Bas...
#include<bits/stdc++.h> using namespace std; bool compare(pair<int,int> p1,pair<int,int> p2) { return p1.first < p2.first;// increasing order of first element } int solve_(vector<int> start,vector<int> end) { vector< pair<int,int> > v; for(int i=0;i<start.size();i++) { v.push_back(make_pair(...
// 人员类.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> #include <string> using namespace std; class Date //日期子类 { private: int year; int month; int day; public: Date(){} //默认构造 Date(int y,int m,int d) //带参构造 { year=y; month=m; day=d; } void...
/* NO WARRANTY * * BECAUSE THE PROGRAM IS IN THE PUBLIC DOMAIN, THERE IS NO * WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE * LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE AUTHORS * AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT * WARRANTY OF ANY KIND, EITHER E...
// @copyright 2017 - 2018 Shaun Ostoic // Distributed under the MIT License. // (See accompanying file LICENSE.md or copy at https://opensource.org/licenses/MIT) #pragma once #include <distant/memory/virtual_ptr.hpp> namespace distant { namespace memory { template <typename Element, typename AddressT, process_ri...
#include <iostream> #include <string> using namespace std; class Rectangle{ std::string shape; int height, width; public: Rectangle(std::string shape="Rectangle"): shape(shape), height(0), width(0){} Rectangle(int h, int w): height(h), width(w){} Rectangle(std::str...
#include <cassert> #include <cmath> #include <mathtoolbox/bfgs.hpp> #include <mathtoolbox/strong-wolfe-conditions-line-search.hpp> // Algorithm 6.1: BFGS Method void mathtoolbox::optimization::RunBfgs(const Eigen::VectorXd& x_init, const st...
float ADC_movingAverage(int adc_val, int battery_cell){ // cell 1 if(battery_cell == 0){ firstCell_ADCreading[0] = adc_val; ADCsum = 0; for(int counter = 0; counter < ADCsample; counter++){ // sum all values in array ADCsum += firstCell_ADCreading[counter]; } float ADCreference = ADCsum / ...
/* Author: Градобоева Елизавета Group: СБС-001-о-01 Task#: 4.11 */ #include <iostream> #include <cmath> using namespace std; double put_matrix[2][2]; double checking_matrix_elements(); void matrix(); void calculating_the_determinant(double put_matrix[2][2]); int main() { cout << "The program calculates the de...
#include "monte_carlo.h" #include "TRandom3.h" #include <cmath> generation generate_mc::simulation(){ generation result; TRandom3* gen_p = new TRandom3(seed); //generatore causale momento TRandom3* gen_cos = new TRandom3(seed + rand()); //generatore causale angoli double p = gen_p->Uniform(0,10); ...
#ifndef DE_KEYBOARDINPUT_H #define DE_KEYBOARDINPUT_H #include "export.h" #include "io/AInput.h" #include <list> namespace de { namespace io { class DE_EXPORT KeyboardInput: public AInput { protected: struct SpecialKey { std::string name; int ID; }; std::list<SpecialKey> mSpecialKeys; ...
#ifndef MaterialReader_hpp #define MaterialReader_hpp #include <stdio.h> #include <string> #include <fstream> #include <iostream> #include <sstream> #include "Material.h" #include <vector> class MaterialReader { private: ifstream file; string filename; bool success; public: MaterialReader(string filename); vect...
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; char res[t]; int x[t],y[t],a[t],b[t]; for(int i=0;i<t;i++){ cin>>x[i]>>y[i]>>a[i]>>b[i]; } for(int i=0;i<t;i++){ if(__gcd(x[i],y[i])==__gcd(a[i],b[i])){ cout<<"YES"<<endl; }else{ cout<<"NO"...
//19 write a program to calculate area of circle using concept of function definition outside the class illustrate concept of constructor overloading #include<iostream> using namespace std; class circle { float radius, area; public: circle() { cout<<"\n Enter the value of R...
#pragma once #include "..\Core\DeviceResources.hpp" #include "ShaderStructures.hpp" #include "..\Core\StepTimer.hpp" #include "..\Core\d3dx12.hpp" #include "..\Core\DescriptorHeap.hpp" #include "..\Core\InputCapture.hpp" #include "..\Core\Math.hpp" #include "..\Core\TextRenderer.hpp" #include "..\Core\ConstantBuffer....
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: vector<int> rightSideView(TreeNode* root) { vector<int> res; vector<vector<int>...
#include "TerminalFunctionalityTestCore.hpp" TEST_F(TerminalFunctionalityFixture, isTrueisTrue) { EXPECT_TRUE(true); }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair <int,int> PII; int const MOD = 1e9 + 7; ll bigmod(ll a,ll b){ if(!b) return 1; ll x = bigmod(a,b/2);x = (x*x)% MOD; if(b&1) x = (x*a)%MOD; return x; } ll d,m; ll dp[50] ; ll msb; ll DP(int pos){ //if(pos = =0) ...
/* * ===================================================================================== * * Filename: Knuth-Morris-Pratt.h * * Description: * * Version: 1.0 * Created: 10/05/2013 11:20:33 PM * Revision: none * Compiler: gcc * * Author: Shuai YUAN (galois...
#include<stdio.h> #include<stdlib.h> int main(){ int a[8] = {1, -2, 3, 10, -4, 7, 2, -5}; int sum = 0; int max = - (1 << 31); for(int i = 0; i < 8; i++){ sum += a[i]; if( max < sum ){ max = sum ; } else if( sum < 0 ){ sum = 0; } } printf("%d", max); return 0; }
#include "Ftdc.hpp" #include "iconvpp.hpp" #include <string.h> #include <iostream> using namespace std; int main() { cerr << "Simnow starting..." << endl; Ftdc* pFtdc = Ftdc::CreateFtdc(); pFtdc->Run(); delete pFtdc; return 0; }
#pragma once #pragma comment(lib, "LinearMath.lib") #pragma comment(lib, "BulletCollision.lib") #pragma comment(lib, "BulletDynamics.lib") #include <math.h> #include "physics\Singularity.Physics.Defines.h" //dependencies #include "common\Singularity.Common.h" #include "core\Singularity.Core.h" #include...
#include "StickGraphic.h" StickGrafic::StickGrafic() { } QRectF StickGrafic::boundingRect() const { return boundingRect(); } QPainterPath StickGrafic::shape() const { return shape(); } void StickGrafic::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(painter...
// $Id: LeftValue.h,v 1.3 2013-04-14 20:59:23 ist164787 Exp $ #ifndef __MAYFLY_NODE_EXPRESSION_LEFTVALUE_H__ #define __MAYFLY_NODE_EXPRESSION_LEFTVALUE_H__ #include <cdk/nodes/expressions/Simple.h> #include <string> #include "SemanticProcessor.h" namespace mayfly { namespace node { namespace expression { ...
#include <apt-pkg/fileutl.h> #include <apt-pkg/acquire-method.h> #include "connect.h" #include "rfc2553emu.h" #include "s3.h" #include <iostream> #include <fstream> #include <unistd.h> using namespace std; int main() { setlocale(LC_ALL, ""); HttpMethod Mth; return Mth.Loop(); }
#ifndef DATABASEHANDLER_H #define DATABASEHANDLER_H #include <QObject> #include <QNetworkAccessManager> #include <QNetworkReply> #include <QNetworkRequest> #include <QDebug> class databaseHandler : public QObject { Q_OBJECT public: explicit databaseHandler(QObject *parent = nullptr); ~databaseHandler(); ...
// -*- C++ -*- // // Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory, // Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC // // This file is part of FreePOOMA. // // FreePOOMA is free software; you can redistribute it and/or modify it // under the terms of the Expat license. // // This progr...
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <GL/glew.h> #include <GL/freeglut.h> #include "../common/shader_utils.h" GLuint vbo_triangle, vbo_triangle_color; GLuint program; GLint attribute_coord2d, attribute_v_color; GLint uniform_fade; struct attribute { GLfloat coord2d[2]; GLfloat v_co...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "../base.h" #include "Windows.System.Diagnostics.0.h" #include "Windows.Foundation.0.h" #include "Windows.Foundation.Collections.1.h" WINRT_EXPORT namespace winrt { namespace ABI::Wi...
#ifndef SCENE_TREE_CHANGER_H #define SCENE_TREE_CHANGER_H #include <core/reference.h> class SceneTreeManager : public Reference { OBJ_TYPE(SceneTreeManager, Reference); protected: static void _bind_methods(); public: Error restart_scene_tree() const; Error open_project(const String& p_path) const; Error load_gl...
// // Created by wqy on 20-1-7. // #ifndef VERIFIER_PROVERIFFUNC_H #define VERIFIER_PROVERIFFUNC_H #include "ProverifReduc.h" #include "ProverifDeclaration.h" #include <string> #include <list> using std::string; using std::list; namespace esc { class ProverifFunc : public ProverifDeclaration { private: ...
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ScavTrap.hpp :+: :+: :+: ...
#include <bits/stdc++.h> #include <string> using namespace std; template <typename T> class Treenode{ public: T data; vector <Treenode<T>*> children; Treenode(T data){ this->data=data; } }; void printtree(Treenode<int>*root){ cout<<root->data<<endl; for(int i=0;i<root->children.size();i++){ printtree(...
#include<bits/stdc++.h> using namespace std; void solve(){ int n, q; cin >> n >> q; int a[n]; for(int i = 0; i < n; i ++){ cin >> a[i]; } int cnt = 1; for(int i = 1; i < n; i ++){ if(a[i] == a[i - 1]) continue; cnt ++; } for(int i = 0; i < q; i ++){ in...
#ifndef CGAME_H #define CGAME_H #include "CLogicEntity.h" #include "gui/CLabel.h" class CGame: public CLogicEntity{ public: void init(); void spawn(); void think(); bool isBackground; void endGameSuccess(CBaseEntity* originator); void endGameFailure(CBaseEntity* originator); ...
#pragma once #include "ex9.h" class ex10 { public: static void Run(); static void MirrorHorizontal(Mat img, Mat& dst); static void MirrorVertical(Mat img, Mat& dst); static void RotationPoint(Mat img, Mat& dst, Point pt, double dgree); };
#include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> #include <sys/time.h> #include "CLapWatch.h" #include <wiringPi.h> static volatile int nRising = 0; static volatile int nFalling = 0; static int nMin500 = 799; static int nMax500 = 200; CLapWatch oLapWatch(10000); bool bRising[10000]; //st...