text
stringlengths
8
6.88M
#include "utils_filesystem.h" #include "utils_logging.h" FILE* Utils_FileOpen(char* path, char* mode, DWORD LOG_FLAG) { FILE* fp = fopen(path, mode); if(!fp && LOG_FLAG == LOG_IF_NOT_EXSIST) Utils_Log(LOG_ERROR, "Cannot find file: %s", path); return fp; } HANDLE Utils_CreateFile(LPCTSTR FileName, DWOR...
#include <map> #include <string> #include <queue> #include <stdlib.h> using namespace std; int* label(int SCC_count, map<string, int> str_to_int, int function_SCC[], int SCC_transitions[]);
#include "MapGui.h" MP::MapGui::MapGui(RiD::AssetManager& aAssetManager) { aAnimation.loadObjectTextures(&aAssetManager.getTexture("mapgui"), 1, 1, 1920); setObjectCoord(sf::Vector2f(0,0)); aAnimation.setOrigin(460, 460); for (int i = 0; i < 12; i++) { _text_array[i].setFont(aAssetManager.getFont("font")); ...
/* * Copyright (c) 2014, Julien Bernard * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DIS...
#ifndef BEZIER_H_ #define BEZIER_H_ #include "Graph.h" class Bezier:public Graph { public: enum CurveStatus { init, ref1, ref2, end, }; Bezier(); void setStartPoint(int x, int y); void setEndPoint(int x, int y); void setRef1Point(int x, int y); void setRef2Point(int x, int y); void draw(); void pr...
#include <iostream> #include "Edge.hpp" using namespace std; Edge::Edge(Vertex * aSource, Vertex * aTarget, Weight * aWeight, double aCredibility) { mCredibility = aCredibility; mIsVisited = false; mWeight = aWeight; mSource = aSource; mTarget = aTarget; } Edge::~Edge() { vector<Ed...
#include "hls_design_meta.h" const Port_Property HLS_Design_Meta::port_props[]={ Port_Property("ap_clk", 1, hls_in, -1, "", "", 1), Port_Property("ap_rst", 1, hls_in, -1, "", "", 1), Port_Property("ap_start", 1, hls_in, -1, "", "", 1), Port_Property("ap_done", 1, hls_out, -1, "", "", 1), Port_Property("ap_idle", 1...
#if(0) //二级指针,也就是指针的指针,用于修改指针指向的一个指针(如果是一级指针,修改的是指向的内容) #include <iostream> using namespace std; void GetMemory2(char **p, int num) // 指针传址,地址指向一个指针, { *p = (char *)malloc(sizeof(char) * num); } void Test(void) { char *str = NULL; GetMemory2(&str, 100); // 注意参数是&str,而不是str st...
#include "MetaMorpheusTask.h" #include "MyTaskResults.h" #include "FileSpecificParameters.h" #include "DbForTask.h" #include "EventArgs/SingleTaskEventArgs.h" #include "../EngineLayer/CommonParameters.h" #include "../EngineLayer/Ms2ScanWithSpecificMass.h" #include "../EngineLayer/MetaMorpheusEngine.h" #include "../En...
#pragma once #include <SFML\Graphics.hpp> #include <SFML\Audio.hpp> #include <iostream> #include "bullet.h" class Grenade : public bullet { public: Grenade(float x = 0, float y = 0, int dir = 1); ~Grenade(); bool Collision(updateable*, sf::Vector2u&, sf::Vector2u&, float& size); bool CollisionRange(u...
#ifndef OPERATEURADDITION_H #define OPERATEURADDITION_H #include "../headers/operateur.h" #include "../headers/pile.h" #include "../headers/entier.h" #include "../headers/expressionmanager.h" /// /// \brief Effectue une Addition sur la Pile /// class OperateurAddition : public Operateur { friend class ExpressionM...
#include <map> #include <string> #include <vector> #include <string> #include <unordered_map> #include <thread> #include <set> #include "platform.h" #define USE_CHRONO 0 #ifdef WIN32 #include <Windows.h> #include <mmsystem.h> #endif #ifdef __APPLE__ #include <mach/mach_time.h> #endif #ifdef __linux__ #include <ti...
#pragma once class BiffReader; class ILoadable { public: virtual bool LoadToken(const int id, BiffReader* pBiffReader) = 0; };
#include <DallasTemperature.h> #include <Homie.h> #include <Arduino.h> #include <OneWire.h> /* Board Type NodeMCU 1.0 (ESP-12E Module) */ #define ONE_WIRE_BUS 5 const uint8_t MAX_TEMPERATURE_SENSORS = 2; const int TEMPERATURE_INTERVAL_SECONDS = 2; // how often to read temperatures. const int TEMPERATURE_REPORT_INT...
/* ============================================================ Copyright (c) 2009 Advanced Micro Devices, Inc. All rights reserved. Redistribution and use of this material is permitted under the following conditions: Redistributions must retain the above copyright notice and all terms of this license. ...
#pragma once #include <iostream> #include <vector> #include "Token.h" class Lexer { public: void setSequence(const std::string sequence); std::vector<Token> tokenize(); private: std::string sequence; int index = 0; bool isNumber(); bool isOperator(); bool isSpace(); Token lex(); };
#ifndef TREE_ITEM_H #define TREE_ITEM_H enum TraversalType { IN, PRE, POST, LEVELS }; template <typename T> struct Node { T data; int count; int height; Node *left; Node *right; Node(const T &data) : data(data), count(0), height(1), left(nullptr), right(nullptr) {} Node(co...
//========================================================================== // HISTOGRAMINSPECTOR.H - part of // // OMNeT++/OMNEST // Discrete System Simulation in C++ // //========================================================================== /*------------------------------------...
class Solution { public: bool combinationSumHelper(vector<vector<int>>& result, vector<int> &resolve, vector<int>& candidates, vector<int>::size_type index, int target) { if(target == 0) { if(resolve.size()) re...
#include <iostream> #include <boost/python.hpp> #include <boost/python/suite/indexing/vector_indexing_suite.hpp> #include <boost/python/suite/indexing/map_indexing_suite.hpp> #include <Eigen/Core> #include "../src_cpp/r1gtoint.hpp" #include "../src_cpp/op_driv.hpp" #include "../src_cpp/opt_alpha.hpp" using namespace...
/*************************************************************************** Copyright (c) 2020 Philip Fortier 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...
#include "stdafx.h" #include "IShader.h" #include "Common/IncludeReplacer.h" #pragma comment(lib, "d3dcompiler.lib") #include <d3dcompiler.h> using namespace Common; using namespace GraphicsEngine; using namespace Microsoft::WRL; using namespace std; ComPtr<ID3DBlob> IShader::CompileFromFile(const wstring& filename...
#include<bits/stdc++.h> using namespace std; typedef struct Coordenadas { double x; double y; }C; bool compara(C a,C b) { if(a.y == b.y) { return a.x < b.x; } return a.y < b.y; } int main() { C v[10]; scanf("%lf %lf",&v[0].x,&v[0].y); scanf("%lf %...
#include "CoubToCircleWidget.h" #include <QScreen> void CoubToCircleWidget::initializeGL() { color.setRgb(255,0,0); initializeOpenGLFunctions(); QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); m_program = new QOpenGLShaderProgram(this); m_program->addShaderFromSour...
#include <iostream> //Mohamed Foda Abdullah; //201302013; using namespace std; const char YES = 'y'; class Odometer { private: double miles_driven; double fuel_efficiency; double odometer; public: Odometer() { miles_driven = 0.0; fuel_efficiency = 0.0; odometer ...
#ifndef BACHERO_GAME_PLAYER #define BACHERO_GAME_PLAYER #include "Game/Components/PlayerMovementComponent.h" #include "Game/Components/PlayerAnimationComponent.h" #include "Engine/Components/TransformComponent.h" #include "Engine/Render/SpriteComponent.h" #include "Engine/Render/TextureManager.h" #include "Engine/Phys...
#include "sdltest2.h" #include <SDL_image.h> #include <SDL_ttf.h> SDLTest2 SDLTest2::Instance; SDLTest2::SDLTest2() { Window = nullptr; PrimarySurface = nullptr; Font = nullptr; Running = true; ValuteEntries.clear(); } int SDLTest2::OnExecute(int argc, char* args[]) { if (OnInit() == false) { return -1; }...
void exhaustCheck(){ float h = dht.readHumidity(); float t = dht.readTemperature(); float tf = ((t*9)/5) + 32; if (h > 60 || tf > 82) //If humidity is above 60% or if the temp is above 82 { digitalWrite(EXHAUST_PIN, LOW); //Run the fan // digitalWrite(humLED, HIGH); //Serial.p...
#include<iostream> #include<conio.h> #include<stdio.h> #include<stdlib.h> using namespace std; /*PRIORITY*/ int initial[10]; int data[10]; int next[10]; int insert(int a) { int key = a%10; if(data[key]==-1) {initial[key]=key; data[key]=a; next[key]=-1; return 0; ...
#include<bits/stdc++.h> using namespace std; int n,cnt; vector<int>p; string s; int main(){ cin >> n; for(int i=0;i<n;i++){ int aux; cin>>aux; p.push_back(aux); } getline(cin,s); for(int i=0;i<n;i++){ cnt=0; getline(cin,s); for(int j=0;j<s.size();j++){ if(s[j]=='a'||s[j]=='e'||s[j]=='i'|| s[j]=='...
/////////////////////////////////////////////////////////////////// //Copyright 2019-2020 Perekupenko Stanislav. All Rights Reserved.// //@Author Perekupenko Stanislav (stanislavperekupenko@gmail.com) // /////////////////////////////////////////////////////////////////// #pragma once #include "CoreMinimal.h" #include ...
#include "ScreenMagic.h" #include "ResMagicChain.h" ScreenMagic::ScreenMagic(ResMagicChain *magicChain, OnItemSelectedListener *l) { mFirstItemIndex = 0; mCurItemIndex = 0; mTextPos.set(10, 77); mBmpCursor = Bitmap::createBitmap(12, 12, ARGB_8888); mBmpMarker = Bitmap::createBitmap(5, 8, ARGB_8888...
#include <iostream> using namespace std; // the rotate function int rotate(int row, int col, int degree){ switch(degree){ case 0: return (row * 4 + col ); case 1: return ( 12 + row - (col*4)); case 2: return ( 15 - (row *4) - col); case 3: return ( 3 - row + (col*4)); }// e...
#include<cstdio> using namespace std; int main() { int n; int cnt=0; int a; while(scanf("%d",&n)!=-1) { for(int i=0;i<n;i++) { cnt=0; scanf("%d",&a); if(a==1){printf("%d\n",1);continue;} int j; for(j=1;j*j<a;j++) if(a%j...
#include "vecOpBase.h"
#ifndef __AP_KF_H__ #define __AP_KF_H__ #include <matrixN.h> #include <LowPassFilter.h> typedef VectorN<float,4> _Vector4f; typedef MatrixN<float,4> _Matrix4f; class AP_KF { public: AP_KF(); ~AP_KF(); void set_dt(const float &dt); void set_var(const float &var_acc, const float &var_gyro); _Vect...
/* type.h -*- C++ -*- Rémi Attab (remi.attab@gmail.com), 08 Mar 2014 FreeBSD-style copyright and disclaimer apply Type of a type. */ #include "reflect.h" #pragma once namespace reflect { /******************************************************************************/ /* TYPE...
/* 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...
#ifndef __FILE_VECN_LOGGING__ #define __FILE_VECN_LOGGING_ #include "vecn_fixed.h" #include "logging.h" #include "vecn_interface_base.h" #define pmatn(x) \ { \ pbegin(); \ ps_impl(#x); \ ps_impl("="); \ pend(); ...
/* Copyright (c) 2011 Andrew Wall 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, copy, modify, merge, publish, distribute, sub...
#include "test.h" #include <QHBoxLayout> #include <QSlider> #include <QSpinBox> #include "finddialog.h" test::test(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); QWidget *window = new QWidget; window->setWindowTitle("Enter Your Age"); QSpinBox *spinBox = new QSpinBox; QSlider *slider = new QSlider(Q...
#include "RParser.h" #include <fstream> #include <assert.h> #include <sstream> #include <iterator> #include <algorithm> std::vector<Question> RParser::getQuestionsCollection(int count) { ifstream input; vector<Question> qCollection; for (int i = 1; i <= count * count; i++) { string path = "Testdata\\" + string("...
// License: Apache 2.0. See LICENSE file in root directory. // Copyright(c) 2020 FRAMOS GmbH. #pragma once #include <memory> namespace librealsense { namespace d400e { using seconds = double; class heartbeat_time { public: static heartbeat_time& get_instance(); ...
// // serverTest.cpp // user // // Created by Vincent on 2020/6/27. // Copyright © 2020 Vincent. All rights reserved. // #include "serverTest.hpp"
#include "handlerTypes.h" /** TODO: -Correctly handle standard smart pointer types, such as auto_ptr, shared_ptr. */ class StateSavingStatementHandler : public StatementReversalHandler { // A collection to avoid this handler calls itself by calling evaluateStatement function for the same statement. std::set<SgStat...
#ifndef TRACK_SIMPLE_H #define TRACK_SIMPLE_H #include <Box2D/Box2D.h> #include <cmath> #include "Track.h" class TrackSimple : public Track{ public: TrackSimple(b2World * world); virtual void create_checkpoints(); virtual void create_track(); virtual void Restart(); }; #endif
#include "graph/aggregate_node.hpp" namespace flow { AggregateNode::AggregateNode(const std::string &name, NodePtr input, const AggregateType agg_type) : UnaryNode(name, input), m_agg_type(agg_type) { } AggregateNode::~AggregateNode() { } void Aggregat...
#include<stdio.h> #include<stdlib.h> #define size 5 int queue[size]; int front=-1,rear=-1; void insert() { if(rear==size-1) { printf("\nqueue is full"); return; } if(front==-1) { rear=front=0; } else rear++; printf("\nenter data"); scanf("\n%d",&queue[rear]); } void deleteelement() { if(front==-1) ...
#include "Globals.h" #include "Application.h" #include "ModuleTextures.h" #include "ModuleInput.h" #include "ModuleParticles.h" #include "ModuleRender.h" #include "ModuleCollision.h" #include "ModuleFadeToBlack.h" #include "ModulePlayer2.h" #include "ModuleAudio.h" #include "SDL_mixer\include\SDL_mixer.h" #include "SDL...
//================================================================= // Given a dictionary of valid words (dictionary), and an input string (input) // containing two wildcard characters ('?'), implement the function 'checkwords' // to fill in the list of valid words in 'dictionary' that can be made from the // letter...
#include <iostream> using namespace std; float pi=3.142; // global var float r; //-----------------------------------function prototypes float Area(float ); float Area(float , float ); double Area(double , double ); //------------------------------------ int main(){ int choice; cout << "#####Welcome to Area ...
#pragma once #include <GL\glew.h> class RenderBuffer { private: GLuint value; public: RenderBuffer(); ~RenderBuffer(); RenderBuffer * bind(); const RenderBuffer * bind() const; RenderBuffer * store(GLenum, GLsizei, GLsizei); RenderBuffer * attachToBoundFramebuffer(GLenum); };
/* printer.cpp -*- C++ -*- Rémi Attab (remi.attab@gmail.com), 15 Apr 2015 FreeBSD-style copyright and disclaimer apply */ namespace reflect { namespace json { /******************************************************************************/ /* GENERIC PRINTERS ...
#ifndef BLOB_DEVICE_HPP #define BLOB_DEVICE_HPP #include <stdio.h> #include <stdlib.h> #include <cuda.h> //#define KERNEL_RADIUS 1 //#define BLOCKSIZE 5 //#define PI 3.141592653f #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif
//This is the implementation file stack.cpp. //This is the implementation of the template class Stack. //The interface for the template class Stack is in the header file stack.h. #include <iostream> #include <cstdlib> #include <cstddef> #include "stack.h" using std::cout; namespace StackSavitch { ...
#include <ros/forwards.h> #include <ros/package.h> #include <ros/ros.h> #include <ros/single_subscriber_publisher.h> #include <unistd.h> #include <yaml-cpp/yaml.h> #include <boost/thread/locks.hpp> #include <boost/thread/shared_mutex.hpp> #include <boost/thread/thread.hpp> #include <csignal> #include <cstdlib> #inclu...
#include "common\Singularity.Common.h" namespace Singularity { class IDelegate : public Singularity::Object { DECLARE_OBJECT_TYPE; }; }
#include <iostream> #include <vector> using namespace std; // Priority Queue is implemented using vector. class PriorityQueues { public: vector<int> pq; PriorityQueues() { } bool isEmpty() { return pq.size() == 0; } int getSize() { return pq.size(); } int ...
// CkDsaProgress.h: interface for the CkDsaProgress class. // ////////////////////////////////////////////////////////////////////// #ifndef _CKDSAPROGRESS_H #define _CKDSAPROGRESS_H #ifndef __sun__ #pragma pack (push, 8) #endif class CkDsaProgress { public: CkDsaProgress() { } virtual ~CkDsaProgress() {...
// Function Overriding program #include <iostream> using namespace std; class Base { public: void display() { cout << "Display of Base" << endl; } }; class Derived: public Base { public: void display() { cout << "Display of Derived" << endl; } }; int main() { Derived d; d.display(); } // Output will be D...
#pragma once #include <GL/glew.h> #include <GLFW/glfw3.h> #include <vector> #include "RawModel.h" #include "Texture.h" #include <iostream> class Loader { private: std::vector<GLuint> VAOs; std::vector<GLuint> VBOs; std::vector<GLuint> textures; GLuint createVAO(); void storeDataInAttributeList(int AttributeNumb...
#include "world_solver.hpp" #include "logic_model/item_source.hpp" #include <landstalker-lib/exceptions.hpp> #include "logic_model/world_node.hpp" WorldSolver::WorldSolver(const RandomizerWorld& world) : _world (world) {} /** * Setup a set of forbidden items in specified quantities that the solver will restrain its...
#include <stdio.h> #include <algorithm> using namespace std; const int maxn = 32768; int heap[maxn]; int n; void downAdjust(int low, int high) { int f = low; int s = f * 2; while (s <= high) { if (s + 1 <= high && heap[s + 1] < heap[s]) s = s + 1; if (heap[s] < heap[f]) ...
/** * * @file Humanoid.hpp * @author Naoki Takahashi * **/ #pragma once #include "RBDLBased.hpp" namespace Kinematics { namespace Model { class Humanoid : public RBDLBased { public : using Ptr = std::shared_ptr<Humanoid>; Humanoid(const std::string &new_model_file_name); virtual ~Humano...
#include "claim.hpp" #include <regex> static const std::regex claim_matcher{ "#(\\d+)\\s+@\\s+(\\d+),(\\d+):\\s+(\\d+)x(\\d+)"}; std::ostream& operator<<(std::ostream& out, Claim const& claim) { return out << "#" << claim.id << " @ " << claim.point.x << "," << claim.point.y << ": " << claim.dimen.w...
#pragma once #include "../MetaMorpheusEngine.h" #include <string> #include <vector> #include <cmath> #include <mutex> #include "exceptionhelper.h" #include "stringhelper.h" #include "stringbuilder.h" #include "../CommonParameters.h" #include "../MetaMorpheusEngineResults.h" #include "Proteomics/Proteomics.h" using ...
#ifndef _HS_SFM_UNIT_TEST_TEST_CAMERA_SHARED_NORMAL_EQUATION_SOLVER_HPP_ #define _HS_SFM_UNIT_TEST_TEST_CAMERA_SHARED_NORMAL_EQUATION_SOLVER_HPP_ #include <iostream> #include <iomanip> #include <limits> #include "test_camera_shared_normal_equation_builder.hpp" #include "hs_sfm/bundle_adjustment/camera_shared_augment...
#include <stdio.h> using namespace std; int main(void) { int MAX = 100000; int N; scanf("%d", &N); if(N > MAX) return 0; for(int i=1; i<=N; i++) printf("%d\n", i); return 0; }
#ifndef __CMANAGER_H_ #define __CMANAGER_H_ #include "CommonHeader.h" /* 매니저 클래스 아이템을 보관하고 내뱉는 용도 list를 안쓰고 list를 쓴 이유는 list가 더 빨라서. */ template <class T> class CManager { protected: list<T*> m_itemList; public: CManager() {} virtual ~CManager() {} public: void AddItem(T* _item); bool DeleteItem(T* _item); ...
#ifndef PORTAL_BOX_H #define PORTAL_BOX_H #define GLEW_STATIC #include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/gtc/type_ptr.hpp> #include "Portal.h" #define NUM_SIDES 4 typedef void(*render_callback)(int, glm::vec3&, glm::vec3&); typedef void(*warp_callback)(int, glm::vec3&, glm::vec3&, glm::vec3&); clas...
#include <vector> using namespace std; class Solution { public: int maximum69Number(int num) { vector<int> ivec; while (num) { ivec.push_back(num % 10); num /= 10; } int res = 0; int flag = true; for (auto iter = ivec.rbegin(); iter != ivec.rend(); ++iter) { if (flag && *i...
#pragma once #include "Texture.h" #include <vector> namespace GraphicsEngine { class TextureArray { public: void Add(ID3D11ShaderResourceView* textureSRV); ID3D11ShaderResourceView* const* GetTextureArray() const; ID3D11ShaderResourceView* GetTexture(size_t index) const; size_t GetSize() const; private...
/* field.tcc -*- C++ -*- Rémi Attab (remi.attab@gmail.com), 04 Apr 2015 FreeBSD-style copyright and disclaimer apply Field template implementation. */ #include "reflect.h" #pragma once namespace reflect { /*********************************************************************...
/** * 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: void levelOrder(TreeNode * root, int level, int &sum, vector<int> &count) { if(int(c...
#pragma once #include <functional> #include <memory> #include <string> #include "../graphics2D.hpp" #include "../utils.hpp" namespace fantom { namespace graphics2D_private { using namespace Graphics2D; class Graphics2DFactory { public: virtual ~Graphics2DFactory(...
#include <pybind11/pybind11.h> #include <pybind11/numpy.h> #include <pybind11/stl.h> #include <cstdio> #include "replay_memory.hpp" #include "client.hpp" #include "server.hpp" #include "proxy.hpp" #include "py_serial.hpp" namespace py = pybind11; using namespace py::literals; #ifdef PRINT_DEBUG namespace backward { ...
//Student Name: Bair Suimaliev //Student email: bsuimaliev@myseneca.ca //Student ID: 159350198 //Date: 10.10.2021 //I have done all the coding by myself and only copied the code //that my professor provided to complete my workshopsand assignments. #ifndef _SDDS_SETSUMMABLE_H_ #define _SDDS_SETSUMMABLE_H_ #i...
#pragma once #include <fstream> #include <iostream> #include <string> using namespace std; class CarregadorDeAssets { public: CarregadorDeAssets(); ~CarregadorDeAssets(); bool carregarRecursos(std::fstream & f_arq_recursos); private: int i_num_assets; };
#include <iostream> using namespace std; bool palcheck(int n) { int a=n ,temp = 0; while(a>0) { temp = temp*10 + (a%10); a=a/10; } return (n==temp); } int main() { cout<<palcheck(1891); return 0; }
/************************************************************* * > File Name : c1084_0.cpp * > Author : Tony * > Created Time : 2019/11/05 12:19:59 * > Algorithm : **************************************************************/ #include <bits/stdc++.h> using namespace std; inline ...
#include<cstdio> #include<algorithm> #include "ModComb-for-EndlessKnight.cpp" using namespace std; const int MOD = 10007; const int MAX_R = 10; typedef pair<int, int> P; // normarize to move horizontal and vertical // return false if unreachable bool normarize(int& x, int& y){ --x; --y; int xx = -x + 2 * y, yy =...
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<conio.h> int rev(int x){ int outpt = 0; while (x != 0) { outpt = outpt * 10; int lastdig = (x % 10); outpt += lastdig; x = x / 10; } return outpt; } int main() { int d, f; scanf("%d", &d); f = rev(d); printf("%d", f); _getch(); }
/* Copyright (c) 2011 Andrew Wall 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, copy, modify, merge, publish, distribute, sub...
class Solution { public: int findCircleNum(vector<vector<int>>& isConnected) { int n = isConnected.size(), res = 0; vector<bool> visited(n, false); for (int i = 0; i < n; i++) { if (!visited[i]) { res++; helper(isConnected, visited, i); ...
#include "Sequencer.h" // CONSTRUCTOR - INITIALIZE Sequencer::Sequencer() { resetCounters(); } // DESTRUCTOR Sequencer::~Sequencer() {} // RESET TIMING COUNTERS AND EVENT COUNTERS void Sequencer::resetCounters() { pulsesElapsed = 0; beatsElapsed = 0; barsElapsed = 0; beatsElapsed_withinBar = 0...
// A O(n) solution to find LCA of two given values n1 and n2 #include <iostream> #include <algorithm> #include <time.h> #include <vector> using namespace std; int treeSize = 100; //NOTE: For baseline, to get CPI & Latency, the treesize is 100 // to Show impact of treesize on runtime, Tree Size will be changed...
#include <bits/stdc++.h> using namespace std; int main() { int s, n, m; cin>>s>>n>>m; int a[n], b[m], ans = 0; for(int i=0; i<n; i++) cin>>a[i]; for(int i=0; i<m; i++) cin>>b[i]; sort(a, a+n); sort(b, b+m); if(a[0]+b[0]>s) cout<<-1<<endl; else { for(int i=0; i<n; i++) { for(int j=0; j<m; j++) ans = m...
/* current_sense_bridge example code This code demonstrates how to read data from ADS1015 ADC on the current_sense_bridge board. You need to install ADS1X15 Arduino library written by Adafruit Industries https://github.com/adafruit/Adafruit_ADS1X15 Significant portion of this code was taken from the example included ...
//Problem link:- https://www.hackerrank.com/challenges/mandragora #include<bits/stdc++.h> using namespace std; typedef long long ll; ll arr[1000005]; int main(){ int t; scanf("%d",&t); while(t--){ int n; ll sum=0; //memset(sum,0,sizeof(sum)); scanf("%d",&n); for(int i=0;i<n;i++) scanf("%lld",&arr[i])...
#include<bits/stdc++.h> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution { public: void Util(TreeNode *root, int &sum) { if (!root) return; if (root->val % 2 == 0)...
#include<iostream> #include<list> #include<GL/glut.h> using namespace std; list <int>newaxis; int a=-1,b=-1,c=-1,d=-1,e=-1,f=-1; int r=0; float color[3] = {1,1,1}; void inti() { glPointSize(2); glClearColor(0.5f,0.5,0,1); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); gluOrth...
#include "particles\Singularity.Particles.h" namespace Singularity { namespace Particles { struct ParticleState { public: #pragma region Variables float ElapsedTime; float Speed; #pragma endregion #pragma region Constructors and Finalizers ParticleState(float elapsedTim...
#pragma once #include "ResursaEconomica.h" #include "IE.h" class ResursaFinanciara :public ResursaEconomica, public IE { private: string moneda; void print(ostream& os, ResursaFinanciara&) const; void read(istream& is, ResursaFinanciara&) const; public: ResursaFinanciara(); ResursaFinanciara(ResursaFina...
// // Created by dn on 12/28/17. // #ifndef TESTINGAREA_DECK_H #define TESTINGAREA_DECK_H #include <array> #include "Card.h" class Deck { private: static std::array<Card, 52> m_deck; // lma t3ml static variable lazem t3rfo fe el cpp //tmam la7za kida //ha3rfo ezay a static int m_cardIndex; sta...
#include "Patcher_BlockEndingAds.h" #include "../Addr.h" #include "../FileSystem.h" //----------------------------------------------------------------------------- // Constructor CPatcher_BlockEndingAds::CPatcher_BlockEndingAds( void ) { patchname = "Block Ending Ads"; LPBYTE addrCleanUp = CAddr::Addr(CPleione_Cle...
#ifndef ARCO_H #define ARCO_H #include <iostream> #include <string> #include <sstream> #include "NodeGraph.h" template <class T> class NodeGraph; template <class T> class Arco { private: int Distancia; NodeGraph<T> *Destino; public: Arco(NodeGraph<T> *&pDestino,int pDistancia){ Destino = pDestino; Distanc...
#ifndef __P013_PHOTO_H__ #define __P013_PHOTO_H__ #include "PBase.h" #include "ScrollLayer.h" USING_NS_CC; class DottedSprite : public WJSprite { private: bool m_adsIsVisible; CC_SYNTHESIZE(int, m_itemIndex, ItemIndex); CC_SYNTHESIZE(bool, m_havingPhoto, HavingPhoto); WJSprite *m_havingPhotoSprite; virtual vo...
// 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.RemoteDesktop.0.h" WINRT_EXPORT namespace winrt { namespace ABI::Windows::System::RemoteDesktop { struct __declspec(uuid("60884631-dd3a-4576-9c8...
namespace Hoge { class Hoge { // interface public: static const int hige = 0; int value; Hoge(); Hoge(char ch); void huga(); }; }
main() { int *p,*q,i; i=&i; p=(int *)malloc(6*sizeof(int)); clrscr(); q=p; for( i=0;i<6;i++) scanf("%d",p+i); for(i=0;i<6;i++) printf("%d\t",*(p+i)); p=&p; free(q); for(i=0;i<6;i++) printf("%d\t",*(p+i)); getch(); }