text
stringlengths
8
6.88M
#include <opencv2/opencv.hpp> using namespace cv; using namespace std; void make_trainData(Mat trainData, Mat group[2], Mat& classLable); void draw_points(Mat& image, Mat group[2]); int main() { int Nsample = 100; Mat trainData(Nsample, 2, CV_32FC1, Scalar(0)); // 학습데이터 Mat classLable(Nsample, 1, CV...
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef NAVCOIN_RANDOM_H #define NAVCOIN_RANDOM_H #include <crypto/chacha20.h> #...
/** * CS5008 Spr 2021 * Northeastern University, Seattle * Assignment 6: Hashtables * * Author: Shefali Khatri (03/12/2021); */ #include "gtest/gtest.h" extern "C" { #include "Hashtable.h" #include "LinkedList.h" } const char* first = "first"; const char* second="second"; const char* third = "third...
#include "_pch.h" #include "VActPanel.h" #include "PGClsPid.h" using namespace wh; using namespace wh::view; //----------------------------------------------------------------------------- //--------------------------------------------------------------------------- //VActPanel //------------------------------------...
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: s; c-basic-offset: 2 -*- ** ** Copyright (C) 2012 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** */ #ifndef NETWORK_IMPL_H # define NETWORK_IMPL_H # include "adjunct/a...
#include <iostream> #include <ctype.h> using namespace std; int main() { int n,m; char str[10]; cout<<"Enter the number of characters in string"; cin>>n; cout<<"\nEnter the number of operations"; cin>>m; cout<<"\nEnter string"; cin>>str; cout<<"\nEnter operations in the form of 1 K...
#include <ffw/utils/any.h> #define CATCH_CONFIG_MAIN #include "catch.hpp" TEST_CASE("Testing Any") { ffw::Any var[8]; var[0] = 123; var[1] = 123.4f; var[2] = 123.4; var[3] = 'A'; var[4] = (const char*)"Abc"; var[5] = true; var[6] = false; var[7] = std::string("Abc"); REQUIRE(v...
#include <iostream> #include<conio.h> using namespace std; /* 5. Sa se implementeze o coada de numere intregi, cu urmatoarele operatii: (a) void push(a, coada) care adauga elementul a in coada; (b) int pop(coada) care scoate primul element din coada, si il intoarce ca rezultat al functiei; (c) int peek(coada) care ī...
#include<bits/stdc++.h> using namespace std; int A; int n,k; int M=1e9+7; long long powM(int n , int k) { if(k==0) return 1; long long x=powM(n,k/2); if(k%2==0) return x*x%M; else return (x*x%M)*n%M; } int main() { int t; cin>>t; while (t--) { cin>>n>>k; A=powM(n,k); cout<<...
#pragma once #include "plbase/PluginBase.h" #include "CPed.h" class PLUGIN_API CCivilianPed : public CPed { public: }; VALIDATE_SIZE(CCivilianPed, 0x79C);
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #ifndef _CONTENT_FILTER_H_INCLUDED_ #define _CONTENT_FILTER_H_INC...
#include<cstdio> #include<algorithm> #include<cstring> #include<list> #include<iostream> #include<cstdlib> #include<map> #include<vector> #include<cmath> using namespace std; struct node{ int v; list<node>::iterator it; }; map<int,list<node> > xl,yl; int main(){ int N,M; while(scanf...
#pragma once #include "Inconstructible.h" #include "VirtualMethod.h" enum class WeaponId : short; struct WeaponInfo; class WeaponSystem { public: INCONSTRUCTIBLE(WeaponSystem) VIRTUAL_METHOD(WeaponInfo*, getWeaponInfo, 2, (WeaponId weaponId), (this, weaponId)) };
#ifndef __ModulePlayer_2_H__ #define __ModulePlayer_2_H__ #include "Module.h" #include "Animation.h" #include "p2Point.h" struct SDL_Texture; struct Collider; struct Mix_Chunk; class ModulePlayer2 : public Module { public: ModulePlayer2(); ~ModulePlayer2(); bool Start(); update_status Update(); bool CleanUp(); ...
#include <stdio.h> #include "SDL2_ttf.h" using namespace SDL2; struct Application : public EventHandler<Application> { SDL *sdl; Window window; Surface text; Application(SDL *s, Window &w, Surface &t) { sdl = s; window = w; text = t; draw(); } void onKeyDown(SDL_Keycode sym, Uint16 mod) { if (sym == ...
#include "StdAfx.h" #include "MT4ServerEmulator.h" MT4ServerEmulator::MT4ServerEmulator(CServerInterface *mt4) { this->mt4 = mt4; if(mt4 == NULL) { Start(); //Start emulation } } MT4ServerEmulator::~MT4ServerEmulator(void) { if(mt4 != NULL) { Stop(); } } void MT4ServerEmulator::InitiateHook(Hook* hook) ...
#include <iostream> #include <stdlib.h> using namespace std; typedef struct myTree { char element; struct myTree *lTree, *rTree; }myTree,*pMyTree; int pos = -1; void createTree(pMyTree *p, string str) { pos++; if(pos < str.size()) { //cout << pos << endl; //cout << str[pos]<<endl; ...
#ifndef FENPRINCIPALE_H #define FENPRINCIPALE_H #include<QtWidgets> #include<QString> #include"projetManager.h" #include"tacheajout.h" #include"projetajout.h" #include"treeview.h" #include"activiteajout.h" class FenetrePrincipale : public QWidget { Q_OBJECT public: FenetrePrincipale(); public slots: void...
#include "tetrispiece.h" TetrisPiece::TetrisPiece( const TetrisCoordinate& centerCoordinate, int orientation, std::vector<TetrisCoordinate>&& coordinates) : m_centerCoordinate(centerCoordinate), m_orientation(orientation), m_coordinates(std::move(coordinates)) { } const TetrisCoor...
#include <systemc.h> #include "shiftReg8.h" void ShiftReg8::shifter() { if (!reset.read()) { reg = 0; } else if(enable.read()) { reg = reg<<1; reg[0] = in; } out.write(reg); }
//Phoenix_RK /* https://leetcode.com/problems/find-duplicate-subtrees/ Given the root of a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one of them. Two trees are duplicate if they have the same structure with the same node values. ...
/***************************************************************************************** * * * owl * * ...
#include "evenement.h" // EvtTache* EvtTache::programmer(const QDate& da, const Horaire& h, const Duree& d){ //Vérification du respect des contraintes : précédence + échéance + dispo if(da<tache->getDispo()) throw CalendarException("La tâche n'est pas encore disponible"); if(tache->getEcheance()<da...
#include <iostream> //#include <windows.h> //#include <ctime> //#include <Wininet.h> // //#include <afxwin.h> //#pragma comment(lib, "wininet.lib") // using namespace std; //int main() //{ // cout<<"begin..."<<endl; // // HINTERNET Hnet = InternetOpen("MYREAD",INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); ...
#include <iostream> #include <vector> #include <queue> #include <map> #include <algorithm> // And even better approach than binary serach is to move left and down only. using namespace std; class Solution { public: vector<vector<int>> intervalIntersection(vector<vector<int>>& A, vector<vector<int>>& B) { ...
#include <bits/stdc++.h> using namespace std ; int vis[1111],pre[1111],m,n; int find(int x ) { if(x!=pre[x]) return pre[x]=find(pre[x]); return x ; } void mix(int x , int y) { int dx = find(x); int dy = find(y); if(dx!=dy) { pre[dy]=dx; } } int main() { while(cin>>n>>m&&n!=0) { int ans ; for(int i = 1 ...
#include <iostream> using namespace std; int main() { int i,j,n(0); char str[80]; i=0; while((str[i]=cin.get())!='\n') i++; str[i]='\0'; for(j=0;j<i;j++) { if(str[j]>='0'&&str[j]<='9') n=n*10+(str[j]-'0'); } cout<<n<<endl; return 0; }
#include "core/pch.h" #include "modules/libgogi/mde.h" #ifdef MDE_SUPPORT_TOUCH void MDE_View::TrigTouchDown(int id, int x, int y, int radius, ShiftKeyState modifiers, void* user_data) { OP_ASSERT(id >= 0 && id < LIBGOGI_MULTI_TOUCH_LIMIT); MDE_Screen::TouchState* state = &m_screen->m_touch[id]; state->m_x = x; ...
#include "utils.h" #include "games.h" #include "all_players.h" #include <iostream> RandomGuesser randomGuesser; DummyGuesser dummyGuesser; ValidGuesser validGuesser; GreedyGuesser greedyGuesser; LookaheadGuesser lookaheadGuesser; UserGuesser userGuesser; RandomThinker randomThinker; ValidThinker validThinker; GreedyT...
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> class QPushButton; class QLineEdit; class QTextEdit; class QDateTimeEdit; class QDoubleSpinBox; class QTableWidget; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slo...
#pragma once #include "GlobalHeader.h" // fa::OStream #include <utility> // std::move #include "NutrientImpl.h" namespace fa { template <class Target> class NutrientStaticDelegator final { public: using this_type = NutrientStaticDelegator; using value_type = Target; ...
#ifndef AISPRITE_H_ #define AISPRITE_H_ #include <SDL.h> #include "sprite.h" #include "spriteaiengine.h" #include "vertexlist.h" #include "observerlist.h" #include "vertexinterface.h" #include "position.h" #include "spriteaistate.h" class AISprite : public Sprite, public SpriteAIState { public: explicit AISprite(...
#include <iostream> #include <stdio.h> int fun(int n) { if(n == 1) return 1; else if(n==2) return 2; else return fun(n - 1) + fun(n -2); } int main() { int n; while(~scanf("%d", &n)) { printf("%d\n", fun(n)); } return 0; }
//本题使用dijkstra算法的堆优化+邻接表,才避免了超时 /* 基本思想与普通的dj相同,但在寻找最小的距离值时使用了优先队列 这样就可以删去一层循环, 变为直接区队首元素. 为了使用优先队列,定义一个结构体p来存编号与距离最小值 并按照 距离最小值升序排列 即可大大降低时间复杂度. 在求最小积值时,直接%9987即可 最后秩序输出余数 */ #include<cstdio> #include<cstring> #include<algorithm> #include<queue> const int MAXX=9987;//最大值 using namespace std; struc...
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*- * * Copyright (C) 2003-2008 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. * It may not be distributed under any circumstances. * * Espen Sand */ #ifndef __X11_OPBITMAP_H__ #define __X11_OPBITMAP_H__ #include "platf...
/** * @author:divyakhetan * @date: 30/12/2018 */ #include<bits/stdc++.h> using namespace std; int main(){ string s1; cin >> s1; int count = 0; for(int i = 0; i < s1.length(); i++){ if(s1[i] == 'a' || s1[i] == 'e' ||s1[i] == 'i' || s1[i] == 'o' ||s1[i] == 'u') count++; } cout << "Vowels are:" << count; ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2009 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 SVG_SUPPORT #include "modules/svg...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #ifndef MVFST_USE_LIBEV #include <quic/api/QuicBatchWriter.h> namespace quic { class GSOPacketBatchWriter : publi...
// Created on: 1993-07-08 // Created by: Isabelle GRIGNON // Copyright (c) 1993-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the G...
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int gcd(int a,int b) { if(!b) return a; else return gcd(b,a%b); } int lcm(int a,int b){ return a/gcd(a,b)*b; } class Fraction{ public: int a,b; int sign(int x){ return x>0?1:-1; } Fraction():a(0),b(1){} Fraction(int x):a(x),b(1){} Frac...
#define CATCH_CONFIG_MAIN /* * To compile get the latest version of catch2 from * https://github.com/catchorg/Catch2 * $ wget https://github.com/catchorg/Catch2/releases/download/v2.2.3/catch.hpp * $ g++ -g -std=c++11 -Wall -Wextra -Werror test.cpp anyoption.cpp -o test * */ #include "anyoption.h" #include <catch...
#include<bits/stdc++.h> using namespace std; main() { char str[5000]; while(cin>>str) { int i, up=0, lo=0; for(i=0; str[i]!='\0'; i++) { if(str[i]>='A' && str[i]<='Z')up++; else lo++; } if(up>lo) { for(i=0; s...
#pragma once #include <Poco/SharedPtr.h> #include <Poco/Timespan.h> #include <Poco/JSON/Object.h> #include "gwmessage/GWRequest.h" namespace BeeeOn { /** * @brief Represents a message sent by the server to the gateway, intended * to start 'listening mode' on the gateway. In this mode, gateway can discover * new ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2007 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" #include "modules/img/src/imagedecodergif.h"...
// // C++ Implementation: Command // // Description: // // // Author: Jally <jallyx@163.com>, (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "Command.h" #include "ProgramData.h" #include "CoreThread.h" #include "wrapper.h" #include "support.h" #include "utils.h" extern Progr...
#include <iostream> #define INT_MIN (1 << (sizeof(int)*8 - 1)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define print(msg) { \ if (argc == 2 && **(argv + 1) == 'p') \ cout << msg; \ } int main(int argc, char **argv) { using namespace std; ...
#include "Vector2i.h" namespace platformer { Vector2i::Vector2i() = default; Vector2i::Vector2i(int x, int y) : x(x), y(y) {} Vector2i &Vector2i::set(int x, int y) { Vector2i::x = x; Vector2i::y = y; return *this; } Vector2i &Vector2i::add(int x, int y) { Vector2...
// // Created by 송지원 on 2020/05/21. // #include <iostream> #include <deque> using namespace std; //void print_dq(deque<int> input) { // // printf("<"); // for (int i=0; i<input.size(); i++) { // printf("%d", input[i]); // } // printf(">\n"); // return; //} int main() { deque<int> dq; d...
// MFCApplication2View.cpp : реализация класса CMFCApplication2View // #include "stdafx.h" // SHARED_HANDLERS можно определить в обработчиках фильтров просмотра реализации проекта ATL, эскизов // и поиска; позволяет совместно использовать код документа в данным проекте. #ifndef SHARED_HANDLERS #include "MFCAp...
#ifndef VNAPAUSESWEEPSTEST_H #define VNAPAUSESWEEPSTEST_H // RsaToolbox #include "VnaTestClass.h" // Qt #include <QObject> class VnaPauseSweepsTest : public RsaToolbox::VnaTestClass { Q_OBJECT public: explicit VnaPauseSweepsTest(QObject *parent = 0); explicit VnaPauseSweepsTest(RsaToolbox::ConnectionTy...
/* * FB.cpp * * Created on: 15.12.2016 * Author: FruehwF */ #include "FB.h" namespace std { FB::FB() { GetFibonacci[0] = 1; GetFibonacci[1] = 1; for (int i = 2;i<90;i++){ GetFibonacci[i] = GetFibonacci[i-1] + GetFibonacci[i-2]; } } FB::~FB() { // TODO Auto-generated destructor stub } // Abbildun...
// // main.cpp -> tutorialQUAD.cpp // environmentsetup // // Created by Apple on 2019/8/24. // Copyright © 2019 NEEMO. All rights reserved. // #include <iostream> #include <GL/glew.h> #include <GLFW/glfw3.h> // init useful variables const GLuint width = 800, height = 600; int main( void ) { GLFWwindow *wi...
#include <iostream> #include <algorithm> #include <vector> #include <cmath> #include <cstring> #define MAX_V 100000000000 typedef long long ll; int n, m; ll pos[1001], w[1001], dp[1001][1001][2]; ll solve(int s, int e, int way) { if(s == 1 && e == n) { return 0; } ll &ret = dp[s][e][way]; ...
/** *The class defines the questions and the variables that are to be used as a diagnosis tool within *this code. * *@author Laura Goudy <goudy-l@ulster.ac.uk> *@license Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * https://www.boost.org/LICENSE...
#ifndef _GUARD_PROFILE_RUN_H #define _GUARD_PROFILE_RUN_H #include <cstdlib> #include <stdexcept> #include <string> #include <type_traits> #include "profile_timer.h" #include "profile_util.h" std::string run_gap(std::string const &script, bool hide_output, bool hide_errors, ...
/* * Copyright: Netease.Inc * * Author: Jacky Tao * * Date: 2016-11-11 * * Description: Dragon Audio&Video Transport Server [Main] */ #include <iostream> #include <stdio.h> #include "server/dragserver.h" #include "server/dragserverEvent.h" #include "common.h" using namespace std; int main(int argc, char ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 1995-2010 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 WIDGET_RUNTIME_SUPPORT #include "...
#include <iostream> #include <climits> using namespace std; // Maximum Subarray Sum int main() { int n; int a[n]; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int maxi = INT_MIN; // Brute force Approach for (int i = 0; i < n; i++) { for (int j = i; j ...
#pragma once #include <cinttypes> #include <string> namespace sg_constructor { enum sg_map : uint16_t { RANDOM = 0, GRIND_ROLLER = 57, CROSS_LINK = 59, GRIND_CROSS = 61, TRIESTE_EASY = 119, ROLLER_STADIUM = 67, FORBIDDEN_CITY = 107, STAR_TRACK = 63, MIRACLE_EASY = 120, PARAKA_EASY = 121, TRIANG...
#include <Robot.h> #include "commands/TestMotor1Com.h" TestMotor1Com::TestMotor1Com() { //Causes testMotor to be needed for the command to run Requires(&Robot::testMotor); } // Called just before this Command runs the first time void TestMotor1Com::Initialize() { } // Called repeatedly when this Command is ...
// Created on: 1993-11-05 // Created by: Jean Marc LACHAUME // Copyright (c) 1993-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the...
#include "box.h" box::box ( ) { } box::box ( int l , int t , int r , int b ) { left = l ; top = t ; right = r ; bottom = b ; } box::~box ( ) { }
/* @author Aytaç Kahveci */ #ifndef KUKA_HARDWARE_INTERFACE_H #define KUKA_HARDWARE_INTERFACE_H #include <vector> #include <string> //ROS #include <ros/ros.h> //ros_control #include <hardware_interface/joint_command_interface.h> #include <hardware_interface/joint_state_interface.h> #include <hardware_interface/robot...
/** InsanePixels ************************************************************************************/ /* */ /* SOLUTION: InsaneWare */ /* PROJECT: Runtime */ /* FOLDER: Core/Windows */ /* FILE: InpixWindowsWindow.cpp */ /* A...
#ifndef GNRENDERVIEW_H #define GNRENDERVIEW_H #include "GnRenderObjectArray.h" #include "GnListManager.h" class GNMAIN_ENTRY GnRenderView : public GnListManager<GnObjectForm, GnObjectFormPtr> { GnDeclareFlags(guint8); enum flags { ACTIVE_MASK = 0x01, }; protected: GnRenderObjectArray mCollactRenderObject; p...
// Autopilot class // Copyright (c) 2008 by Lars Huttar #ifndef AUTOPILOT_H #define AUTOPILOT_H #include "Maze3D.h" #include "glCamera.h" class Autopilot { public: enum APMove { None, Forward, Reverse, TurnUp, TurnDown, TurnLeft, TurnRight }; private: const static int qMaxSize = Maze3D::wMax + Maze3...
#include <iostream> #include <utility> #include <queue> using namespace std; int n, m, h; // 세로, 가로 int matrix[300][11]; int testMatrix[300][11]; void initMatrix(){ for(int i = 1; i <= h; i++){ for(int j = 1; j <= n; j++){ testMatrix[i][j] = matrix[i][j]; } } } int goDown(int star...
#pragma once #include "GcPropertyEntity.h" class Gn2DTextureAni; class GcTextureAnimationPropEntity : public GcPropertyEntity { GtDeclareEntity(GcTextureAnimationPropEntity); public: enum eMessage { MSG_ANIINDEX = 100, MSG_FILENAME, MSG_STARTTIME, MSG_ENDTIME, }; enum { PROP_ANIINDEX, //PROP_FILENA...
#include "ImmovableObject.h" using namespace std; ImmovableObject::ImmovableObject():SelectGravityObject() { } ImmovableObject::ImmovableObject(int weight, Vector* position, Vector* speed, Vector* acceleration):SelectGravityObject(weight, position, speed, acceleration) { } ImmovableObject::ImmovableObject(const I...
#define runEvery(t) for (static long _lasttime;\ (uint16_t)((uint16_t)millis() - _lasttime) >= (t);\ _lasttime += (t)) uint32_t timer; double rollAngle; void setup() { initMotors(); initSensor(); } void loop() { runEvery(10){ RollAngle = 0.98 * (RollAngl...
// Created on: 1993-07-22 // Created by: Remi LEQUETTE // Copyright (c) 1993-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU ...
// Tester.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <conio.h> #include <Windows.h> #include <iostream> using namespace std; typedef HRESULT (*ptrFun) (const wchar_t* processIdOrName, wchar_t* resultAsXml, int& required); int _tmain(int argc, _TCHAR* argv[]) { HRESUL...
#include <iostream> using namespace std; void fun1(int& m, int& n) { int a, b, c, d, e; a = m / 10; b = m % 10; c = n % 10; d = n / 10; e = a * 1000 + b + c * 10 + d * 100; cout << "合并后的数: " << e << endl; } int main() { int a; int b; cout << "请输入两个两位数a,b:"; ...
#include <curl/curl.h> #include <jsoncpp/json/json.h> #include <sstream> #include <unistd.h> #include <iostream> #include <boost/algorithm/string.hpp> #include <cassert> #include "server_metrics.hh" #include "server_utils.hh" #include <string> #include <fstream> #include <iostream> #include <iomanip> #include <fstream>...
// // main.cpp // contains-duplicate // // Created by xiedeping01 on 15/11/9. // Copyright (c) 2015年 xiedeping01. All rights reserved. // #include <iostream> #include <vector> #include <unordered_set> using namespace std; class Solution { public: bool containsDuplicate(vector<int>& nums) { unordered_...
#ifndef KMINT_UFO_HUMAN_HPP #define KMINT_UFO_HUMAN_HPP #include "kmint/play.hpp" #include <tuple> #include <vector> namespace kmint::ufo { class human : public kmint::play::free_roaming_actor { public: human(); const ui::drawable& drawable() const override { return drawable_; } // participates in collisions ...
#include <iostream> #include <vector> #include <string> using namespace std; class PenguinTiles { public: int minMoves(vector<string> tiles) { int maxY = (int)tiles.size(); int maxX = (int)tiles.at(0).size(); if(tiles.at(maxY-1).at(maxX-1) == '.') return 0; for (int i=0; i<tiles.at(maxY-1).size(); ...
#pragma once template<typename T> struct px_deleter { void operator()(T* t) { if (t) t->release(); } }; template<typename T> using px_unique_ptr = std::unique_ptr<T, px_deleter<T>>; template<typename T> struct px_shared_ptr : public std::shared_ptr<T> { px_shared_ptr(T* _Px) : std::shared_ptr(_Px, px_dele...
#include <iostream> int main(void){ int i; int total = 0; while(std::cin >> i) { total += i; } std::cout << total << std::endl; }
/** * author: rasel kibria * created: 10.07.2020 **/ #include<bits/stdc++.h> using namespace std; int main() { int m, n; string action; cin>>n>>m; while(m--) { cin>>action; if(action=="fechou") { n++; } else if(action=="clicou") {...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <quic/QuicConstants.h> #include <quic/codec/QuicPacketBuilder.h> #include <quic/codec/Types.h> #include <q...
#include<bits/stdc++.h> #define rep(i,n) for (int i =0; i <(n); i++) using namespace std; using ll = long long; int main(){ int K, X; cin >> K >> X; for(int i = X - K; i < X+K; i++){ cout << i << " "; } cout << endl; return 0; }
class L110A1_DZ { weight = 6.5; }; class L110A1_CCO_DZ { weight = 6.7; }; class BAF_L110A1_Aim { weight = 6.7; }; class BAF_L110A1_Aim_Small { weight = 6.7; }; class L110A1_Holo_DZ { weight = 6.7; }; class BAF_L110A1_Aim_DZE { weight = 6.7; }; class M249_EP1 { weight = 6.5; }; class M249_TWS_EP1 { weight = 11;...
/* Write a C++ program to create class which contain single dimensional integer array of given size. Write a member function to display even and odd numbers from given array. Use Dynamic Constructor to Allocate and Destructor to free the memory. */ #include<iostream> #include<stdlib.h> using namespace std; c...
#include <SPI.h> #include <WiFi.h> //Connect to WiFi Network #include <string.h> //used for some string handling and processing. #include <mpu6050_esp32.h> // you should have the improved dat #include <math.h> #include <WifiLocation.h> #define IDLE 0 #define CHECK_FALL 1 #define WAIT 2 #define FUNNY 3 #de...
/***************************************************************************************************************** * File Name : DeleteATree.h * File Location : C:\Users\AVINASH\Desktop\CC++\Programming\src\sites\geeksforgeeks\trees\page07\DeleteATree.h * Created on : Dec 13, 2013 :: 2:05:02 AM * Author...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<vector<int> > vvi; typedef vector<ll> vll; typedef vector<vll> vvl; typedef vector<bool> vb; typedef vector<string> vs; typedef vector<pair<int, int> > vp; typedef pair<int, int> pr; type...
/*========================================================================= */ // CRIM : Centre de recherche en informatique de Montréal // Équipe Télédetection pour les catastrophes majeures (TCM). // Programme : Extraction des rivières à partir des images Radar. // Auteur : Moslem Ouled Sghaier // Version : 0 /...
#include "gtest/gtest.h" #include "PrologInterface.h" #include <sstream> static int glob_argc; static char **glob_argv; namespace { class PrologFunctorTest : public ::testing::Test { virtual void SetUp() { PrologLifetime::begin(glob_argc, glob_argv); } virtual void TearDown() { PrologLifetime::end()...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*- ** ** Copyright (C) 1995-2007 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** */ #ifndef OPFOLDERLISTER_H #define OP...
class Solution { public: int largestRectangleArea(vector<int>& heights) { if(heights.size() == 0) return 0; stack<int> h_stack; int maxArea = 0; for(int i=0; i<heights.size(); ++i){ while(!h_stack.empty() && heights[i] <= heights[h_stack.top()]){ int j = h...
#include<iostream> #include<string> #include<ctime> #include<conio.h> #include<Windows.h> #include<stdlib.h> #include"E1_259_Snake_Ladders_Header.h" //All fuctions are in this header file(must remeber to include) using namespace std; /*===================================================================================...
#include <bits/stdc++.h> using namespace std; char maze[51][51]; int main(){ int h, w; cin >> h >> w; for(int i=0; i<h; i++){ for(int j=0; j<w; j++) cin >> maze[i][j]; } int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; for(int i=0; i<h; i++){ for(int ...
#include "mesh.h" #include <Windows.h> #include <GLFW/glfw3.h> #include <algorithm> #include <functional> namespace { struct MeshMaker : public Mesh { MeshMaker(const std::vector<Quad>& quads) :Mesh(quads) {} }; } Mesh::Builder& Mesh::Builder::push_back(const Quad& q) { _quads.push_back(q); return *thi...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*- ** ** Copyright (C) 2003-2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** ** Espen Sand */ #ifndef __X11_MDEBUF...
#include "helpers.h" #include <utility> glm::mat4 convertHMDmat3ToGLMMat4( const vr::HmdMatrix34_t& matrix ) { return glm::mat4( matrix.m[0][0], matrix.m[1][0], matrix.m[2][0], 0.0, matrix.m[0][1], matrix.m[1][1], matrix.m[2][1], 0.0, matrix.m[0][2], matrix.m[1][2], matrix.m[2][2], 0.0, matrix.m[0][3], matrix...
#ifndef _FISH_H #define _FISH_H #include "Enemy.h" #include "Path.h" class Fish : public Enemy { private: iPoint original_pos; Path path; Animation fly; Animation forward; Animation backward; public: Fish(int x, int y, int type); void Move(); }; #endif
/******************************************************************************* The MIT License (MIT) Copyright (c) 2017 Dmitry "Dima" Korolev <dmitry.korolev@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), ...
#include <bits/stdc++.h> #define rep(i,n,m) for(int (i)=0;(i)<(m);(i)++) using namespace std; typedef long long ll; int main(){ int n; cin >> n; vector<int> v(n); rep(i, 0, n) cin >> v[i]; sort(v.begin(), v.end()); int sum = 0; rep(i, 0, n-1) sum += v[i]; if(sum > v[n-1]) c...
// // nehe09.h // NeheGL // // Created by Andong Li on 9/6/13. // Copyright (c) 2013 Andong Li. All rights reserved. // #ifndef __NeheGL__nehe09__ #define __NeheGL__nehe09__ #include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <GLUT/glut.h> #include "utils.h" #include "SOIL.h" #include <iostream> #include <s...