text
stringlengths
8
6.88M
#include<iostream> #include<vector> #include<chrono> #include<cmath> #include<set> using namespace std; set<int64_t> getPrimeSet(int64_t N){ set<int64_t> ordered_set; ordered_set.insert(2); for (int64_t n = 3; n <= N; n += 2){ bool flag = true; for (auto x: ordered_set){ if (n % x == 0){ ...
/* Use Back tracking * I used network flow */ #include <cstdio> #include <algorithm> #include <vector> using namespace std; int main(void){ int n; scanf("%d", &n); return 0; }
#define DllDemoAPI _declspec(dllexport) #include "DllDemo.h" #include <stdio.h> DllDemoAPI int add(int a, int b) { return a + b; } DllDemoAPI void Point::Print(int x, int y) { printf("x=%d, y=%d", x, y); }
#include "DeviceBuzzer.h" #include "ESPDevice.h" namespace ART { DeviceBuzzer::DeviceBuzzer(ESPDevice* espDevice) { _espDevice = espDevice; } DeviceBuzzer::~DeviceBuzzer() { delete (_espDevice); } void DeviceBuzzer::create(DeviceBuzzer *(&deviceBuzzer), ESPDevice * espDevice) { deviceBuzzer = new Devic...
/* Listas enlazadas INSERTAR NODOS AL FINAL DE LA LISTA (First In - First On) fifo */ #include <iostream> using namespace std; //Declaración de estructura Nodo /* *i: Nodo inicial *f: Nodo final */ struct nodo{ int dato; nodo *apuntador; } *i, *f; //Se encarga de insertar nodos void insertarDatos(){ nodo *...
#include<iostream> #include<stdio.h> #include<algorithm> #include<cstring> #include<cmath> #include<cstdlib> #include<queue> using namespace std; struct node { int sign,vip,num; char msg[400]; bool friend operator < (node a,node b) { if (a.vip == b.vip) return a.sign > b.sign; ...
#ifndef PIPELINE_SIM_H #define PIPELINE_SIM_H #include "elf_reader.h" #include "reg_def.h" #include "if.h" #include "id.h" #include "ex.h" #include "ex2.h" #include "mem.h" #include "wb.h" #include "memory.h" #include "cache.h" #include <cstdio> #include <iostream> #define USE_CACHE #define FS_MAX_MEMORY (4 * 1024 *...
// cpp-test6.2.Task1.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. // #include <iostream> #include "Header.h" void printDeck(std::array<Card, static_cast<int>(CardRank::ENUM_END)* static_cast<int>(CardSuit::ENUM_END)>* deck) { for (auto card : *deck) { std::string...
/* 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...
/* * leverage from turtlebot2i_block_manipulation pkg * created by caixi@utrc.utc.com */ #include <ros/ros.h> #include <tf/tf.h> #include <actionlib/server/simple_action_server.h> #include <turtlebot2i_block_moving/MovingBlockAction.h> #include <moveit/move_group_interface/move_group_interface.h> #include <geom...
#ifndef INTERPROCEDURAL_CFG_H #define INTERPROCEDURAL_CFG_H #include "staticCFG.h" #include "CallGraph.h" #include <map> #include <set> #include <string> class SgIncidenceDirectedGraph; class SgGraphNode; class SgDirectedGraphEdge; namespace StaticCFG { using VirtualCFG::CFGNode; using VirtualCFG::CFGEdge; c...
/*====================================================================* - Copyright (C) 2001 Leptonica. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source c...
#include <assert.h> #include <stdio.h> void assertSorted(int* a,int length) { //Check that the entire array is in sorted order for(int i=0;i<length-1;i++) { assert(a[i]<=a[i+1]); } } void display(int* a,int length) { //Check that the entire array is in sorted order for(int i=0;i<length-1;i++) { printf("%d ",...
// // Created by 邓岩 on 2018/11/5. // #include "gotocelldialog.h" GoToCellDialog::GoToCellDialog(QWidget *parent) : QDialog(parent) { setupUi(this); QRegExp regExp("[1-9][0-9]{3,8}@[A-Za-z]{2,5}\.com"); lineEdit->setValidator(new QRegExpValidator(regExp, this)); //connect(okButton, SIGNAL(clicked()), ...
#ifndef STATIC_CFG_H #define STATIC_CFG_H #include <sage3basic.h> #include "AstAttributeMechanism.h" #include "virtualCFG.h" #include <map> #include <set> #include <string> class SgIncidenceDirectedGraph; class SgGraphNode; class SgDirectedGraphEdge; namespace StaticCFG { using VirtualCFG::CFGNode; using Virtu...
#ifndef DEFERRED_RENDERING_APPLICATION_H #define DEFERRED_RENDERING_APPLICATION_H #include <FastCG/Platform/Application.h> class DeferredRenderingApplication : public FastCG::Application { public: DeferredRenderingApplication(); protected: void OnStart() override; }; #endif
#include <catch.hpp> #include <embr/observer.h> static int expected; struct event_1 { int data; }; struct event_2 { int data; }; struct event_3 { int data; int output = 0; }; struct id_event { int id; }; struct sequence_event : id_event {}; struct noop_event {}; static int counter = 0; c...
#ifndef SOCKET_H #define SOCKET_H #include <string> /** * @brief Module Socket * @file Socket.h * * Cette classe permet de mettre en place un socket client ou serveur * * @version 1.0 * @date 2018/04/27 */ class Socket{ private: int m_socket; /**< Donnée membre m_socket qui contient le file descriptor */ unsigne...
// // Copyright Jason Rice 2015 // 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) // #include<nbdl/detail/concept_pred.hpp> #include<boost/hana.hpp> namespace hana = boost::hana; template <typename T> struct Te...
//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2006-2010 MStar Semiconductor, Inc. // All rights reserved. // // Unless otherwise stipulated in writing, any and all information contained // herein regardless in any format shall remain the sole proprietary of ...
/************************************************************************* > File Name : SecStoreKeyPair.cpp > Author : YangShuai > Created Time: 2016年08月03日 星期三 18时43分14秒 > Description :暂时没有搞清楚怎么检验密钥对是否合法,出现问题直接返回FAILURE 参数algorithm没有用到 *********************************************...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "../base.h" #include "Windows.Networking.NetworkOperators.0.h" #include "Windows.Data.Xml.Dom.0.h" #include "Windows.Devices.Sms.0.h" #include "Windows.Foundation.0.h" #include "Window...
/************************************************************* * > File Name : P3803_NTT.cpp * > Author : Tony * > Created Time : 2019/12/11 12:30:08 * > Algorithm : **************************************************************/ #include <bits/stdc++.h> using namespace std; typede...
#include "Game_Over.h" Game_Over::Game_Over(sf::RenderWindow& w) : w(w) { fondo.loadFromFile("game_over.jpg"); fuente.loadFromFile("letra.ttf"); //ctor } void Game_Over::game_o(Juego j){ t.setPosition(400,700); t.setCharacterSize(50); t.setString("RESTART --PRECIONE SPACE--")...
node* getTail(struct node* head) { while(head && head->next) head=head->next; return head; } node* partition(node* head,node* end,node*& newhead,node*&newend) { node *pivot=end; node *prev=NULL,*curr=head,*tail=end; while(curr!=pivot) { if(curr->data<pivot->data) { ...
#include <iostream> #include <vector> using namespace std; vector<int> findDisappearedNumbers(vector<int> &given) { int n = given.size(); vector<int> solution(n, -1); for (int i = 0; i < n; i++) solution[given[i] - 1] = 1; int size = 0; for (int i = 0; i < n; i++) if (solution[i] ...
#ifndef PROCESSOR_H #define PROCESSOR_H #include <vector> #include <string> class Processor { public: float Utilization(); Processor(); private: // previous total cpu time since boot = // user+nice+system+idle+iowait+irq+softirq+steal long prevNonIdle; // previous idle time since boot = idle + iowait...
// // Copyright (C) 2018 Ruslan Manaev (manavrion@yandex.com) // This file is part of the Modern Expert System // #include "item.h" #include "gtest/gtest.h" using namespace mes_core; using namespace nlohmann; const Item a{"item_name1", {{1, 2}}, "desc1", "img1", 1}; const Item b{"item_name2", {{1, 2}}, "desc1", "img...
#include "../../graphics.h" #include "light.h" DXPLIGHT::DXPLIGHT() { Type = GU_POINTLIGHT; Component = GU_DIFFUSE_AND_SPECULAR; Position.z = Position.y = Position.x = 0.0f; Direction.z = Direction.y = Direction.x = 0.0f; Attenuation[0] = 1.0f; Attenuation[1] = 0.0f; Attenuation[2] = 0.0f; AmbientC...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) 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; typedef map<string, int> msi; typede...
//============================================== // Name : AKSHAY MUKESHBHAI KATRODIYA // Email : amkatrodiya@myseneca.ca // Student ID : 125298208 // Section : NAA // Date : 06/16/2021(wednesday) // I have done all the coding by myself and only copied the code that my professor ...
#include "SPI_slave.h" void CSlaveSPI::init( SPI_TypeDef * hard_spi, const hard_SPI_slave_config * config, spi_data_handler handler ) { assert_param(handler != NULL); _handler = handler; SPI_InitTypeDef SPI_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannelPriority = 1; NVI...
//Tacuma Solomon //Computer Science III //Famous and Infamous - Computer guesses player's famous or infamous person //Node definition - represents node that stores a question in a binary tree #include<iostream> #include<fstream> #include<string> #include<sstream> #include"Game.h" using namespace std; void DisplayInst...
SinglyLinkedListNode* reverse(SinglyLinkedListNode* head) { if(!head||!head->next) return head; SinglyLinkedListNode* remaining=reverse(head->next); head->next->next=head; head->next=nullptr; return remaining; }
/* Problem Description Find the contiguous subarray within an array, A of length N which has the largest sum. Problem Constraints 1 <= N <= 1e6 -1000 <= A[i] <= 1000 Input Format The first and the only argument contains an integer array, A. Output Format Return an integer representing the maximum possible su...
/////////////////////////////////////////////////////////////////////////////// // File: BigNumber.cc // Author: 671643387@qq.com // Date: 2015年12月29日 下午1:37:28 // Description: /////////////////////////////////////////////////////////////////////////////// #include <memory.h> #include <openssl/bn.h...
#include "auraOfPower.h" AuraOfPower:: AuraOfPower(Player *o):{ name = "AuraOfPower"; cost = 1; description = "Whenever a minion enter a play under your control, it gains +1/+1" owner = o; ability = new Ability(); ability.subscriptionType::minionBirth; // ???? activationCost = 1; char...
#include<bits/stdc++.h> #define ll long long #define MAX 1000003 #define V vector<int> #define pii pair<int,int> #define VP vector< pii > #define MOD 1000000007 #define mp make_pair #define pb push_back #define rep(i,a,b) for(int (i) = (a); (i) < (b); (i)++) #define all(v) (v).begin(),(v).end() #define S(x) scanf("%d"...
#include <iostream> #include <vector> #include <algorithm> #include <fstream> using namespace std; int main() { // fstream cin("a.txt"); int a, b; vector<long long> nc; vector<long long> np; cin>>a; long long tmp; for(int i = 0; i < a; i++) { cin>>tmp; nc.push_back(tmp); } cin>>b; for(int i = 0; i < b; i...
//variaveis da led const int vermelho = 5; const int verde = 6; const int azul = 7; bool estadoLedVermelho = false; //adiçao de um botao const int botao1 = 2; const int botao2 = 3; unsigned long lastDebounceTime1 = 0; unsigned long lastDebounceTime2 = 0; const int botaoDelay = 100; void setup() { pinM...
#ifndef TREE_DEMO_H #define TREE_DEMO_H #include "Demo3D.h" #include <Data/TreeHypergraph.h> #include <Data/MultiMesh.h> class TreeDemo : public Demo3D { protected: TreeNode *TreeSkeleton = nullptr; TreeHypergraph *Hypergraph = nullptr; MultiMesh *Mesh = nullptr; /* * TODO: Át kell majd írnu GLuintre! ...
#include <ros/ros.h> #include <tf2_ros/transform_listener.h> #include <std_msgs/String.h> #include <pepper_head_manager_msgs/PrioritizedPoint.h> #include <resource_management_msgs/MessagePriority.h> class HumanFollower { public: HumanFollower(ros::NodeHandle& nh): tfListener(tfBuffer){ subscriber_ = nh.subscri...
/** * Copyright 2017 * * This file is part of On-line POMDP Planning Toolkit (OPPT). * OPPT is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License published by the Free Software Foundation, * either version 2 of the License, or (at your option) any l...
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; const int maxn = 100005; int visit[maxn]; int main() { int n,m,k,id; while(~scanf("%d",&n)){ memset(visit,0,sizeof(visit)); for(int i=0;i<n;i++){ scanf("%d",&k); for(int j=0;j<k;j++){ ...
/*************************************************************************** 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...
// // Created by lin-k on 01.10.2016. // #include "../include/ROM.h" void ROM::init(std::string filename) { std::ifstream in(filename.c_str(), std::ios::binary); if (!in.is_open()) { std::cout << "ROM::Can\'t Open File\n"; in.close(); exit(0); } in.read((char *) &header, sizeof...
#include "Stack.hpp" bool CheckBalancedParanthesis(std::string str); bool checkMatchingBrace(char OpeningBrace, char ClosingBrace); int main(){ std::string str; std::cout << "Enter string:" << std::endl; std::cin >> str; if(CheckBalancedParanthesis(str)){ std::cout << "string has balanced parantheses" << ...
// // Created by daniil on 01.05.19. // #include <iostream> #include "hello.h" void hello(const std::string& name) { std::cout << "Hi, " << name << std::endl; }
// Klasa okna głównego aplikacji. Zazwyczaj będzie nadpisywana #ifndef SMAINWINDOW_H #define SMAINWINDOW_H class SMainWindow : public SWindow { public: SMainWindow(SApp * sApp, UINT style = WS_OVERLAPPEDWINDOW, UINT exStyle = 0); virtual ~SMainWindow(); virtual BOOL CALLBACK OnClo...
namespace conditional{ template<typename T, typename First> bool equals_any( const T &a, const First &b ){ return ( a == b ); } template<typename T, typename First, typename... Rest> bool equals_any( const T &a, const First &b, const Rest... r ){ if( a == b ) return true; return equals_any( a, r... ); } } // ...
#ifndef FUZZYCORE_DB_CONNECTION_H #define FUZZYCORE_DB_CONNECTION_H #include <vector> #include <map> #include <sqlite/sqlite3.h> #include "../logger/Logger.h" #include "../../exceptions/Headers.h" class DbConnection final { private: sqlite3 *db_handle; DbConnection(); ~DbConnection(); static DbCon...
#ifndef WINDOW_H #define WINDOW_H #include <QWidget> class QComboBox; class QPushButton; class QGroupBox; class QLabel; #include "drawpolycanvas.h" class Window : public QWidget { Q_OBJECT public: explicit Window(QWidget *parent = 0); private: void createGroupBoxInput(); void cr...
/// \file /// \brief Tests multiple readers and writers on the same instance of RakPeer. Define _RAKNET_THREADSAFE in RakNetDefines.h before running this. /// /// This file is part of RakNet Copyright 2003 Jenkins Software LLC /// /// Usage of RakNet is subject to the appropriate license agreement. #include ...
//请设计一个算法完成两个超长正整数的加法。 #if 0 #include<iostream> #include<string> #include<algorithm> using namespace std; string AddStr(string& s1, string& s2) { int len1 = s1.size() - 1; int len2 = s2.size() - 1; int carry = 0; string res; while (len1 >= 0 || len2 >= 0) { if (len1 >= 0) carry += s1[len1]-'0'; if (len2...
#ifndef EXECUTE_PATH #define EXECUTE_PATH #include <vector> //#include <cmath> #include <math.h> #include <limits.h> //#include <set> //#include "node.h" using namespace std; const double pi = 3.14159265358979323846264338328 ; double generateGaussianNoise(double mu, double sigma) { const double epsilon = std::numer...
#include "EmitterParameter.h" EmitterParameter::EmitterParameter(void) { Quantity = Range(1); Speed = RangeF(-1.0f,1.0f); SDL_Color c = { 0,255,0 }; SDL_Color c2 = { 255,0,255 }; Color = RangeColor(c,c2); Opacity = RangeF(1.0f,1.0f); Scale = RangeF(1.0f, 10.0f); Rotation = RangeF(-(floa...
#ifndef _PHOTON_JET_TRACK_TREE_H #define _PHOTON_JET_TRACK_TREE_H #include "TTree.h" #include <vector> const int nEventsToMix = 60; class photonJetTrackTree { public: photonJetTrackTree() { isPP = 0; run = 0; evt = 0; lumi = 0; hiBin = -1; vz = -99; weig...
/*********************************************************************** created: 11th August 2013 author: Lukas Meindl *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2013 Pa...
#ifndef __MODULE_IMPORT_BONE_H__ #define __MODULE_IMPORT_BONE_H__ #include "Module.h" struct aiBone; class ResourceBone; class ModuleImportBone : public Module { public: ModuleImportBone(const char *name); ResourceBone * ImportBone(aiBone * assimp_bone, UID uid, const char * asset_path); }; #endif
#ifndef __PANEL_IMPORT_H__ #define __PANEL_IMPORT_H__ #include "Panel.h" struct ModelImportOptionsAux { bool calcTangentSpace = false; bool joinIdenticalVertices = false; bool makeLeftHanded = false; }; //Panel that lets you change file import options class PanelImport : public Panel { public: PanelImport(std::s...
/*************************************************************************** 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 "LedCubeStills.h" // private bool LedCubeStills::inBounds(int x, int y, int z) { return (x >= 0 && x <= 7 && y >= 0 && y <= 7 && z >= 0 && z <= 7); } //public // ===================================================================================================== // happyFace() // D...
#include<stdio.h> #include<algorithm> #include<list> #include<vector> #include<unordered_map> #include<algorithm> using namespace std; int idcnt; struct Value { int id, value; }; unordered_map<int, Value> htab(200000); int main() { freopen("input.txt", "r", stdin); int q, key, value; scanf("%d", &q); while (q--) ...
#include<iostream> #include<math.h> using namespace std; long long int power(long long int x, long long int y) { long long int temp; if( y == 0) return 1; temp = power(x, y/2); if (y%2 == 0) return (temp*temp)%1000000007; else return (x*temp*temp)%1000000007; } int main() { long long int t,n,ans = 1,i; cin>>t; ...
#ifndef NEW_STRATEGY_1_PROJECT_INCLUDE_ITEM_HPP #define NEW_STRATEGY_1_PROJECT_INCLUDE_ITEM_HPP #include "object.hpp" #include "misting.hpp" #include "mistborn.hpp" #include "soldier.hpp" #include "metal.hpp" #include "button.hpp" #include "store_definitions.hpp" #include "definitions.hpp" class Item { private: ...
#include<cstdio> #include<iostream> using namespace std; long long num[100005]; long long n,k; int main() { int t,x = 1; scanf("%d",&t); while(t--) { long long sum = 0,res = 0; scanf("%lld%lld",&n,&k); for(int i = 0; i < n; i++) { scanf("%lld",&num[i]); ...
#pragma once #include <vtkRenderer.h> #include <vtkSmartPointer.h> class CSplitView{ public: CSplitView(); ~CSplitView(); private: vtkSmartPointer<vtkRenderer> CreateVtkRender(); vtkSmartPointer<vtkRenderer> m_render_left_down ; vtkSmartPointer<vtkRenderer> m_render_left_up ; vtkSmartPointer...
#ifndef WINDOWSCALE_H #define WINDOWSCALE_H #include "DoubleXY.h" class WindowScale { private: static const int SCALESIZE = 11; const double scalefactors[SCALESIZE] = {1.0, 1.4, 2.0, 2.8, 4.0, 5.6, 8.0, 11.3, 16.0, 22.6, 32.0}; unsigned scalefactor_i{0}; void stay...
#ifndef _HS_SFM_BUNDLE_ADJUSTMENT_CAMERA_SHARED_NLLSO_META_LEVENBERG_MARQUARDT_HPP_ #define _HS_SFM_BUNDLE_ADJUSTMENT_CAMERA_SHARED_NLLSO_META_LEVENBERG_MARQUARDT_HPP_ #include "hs_math/linear_algebra/eigen_macro.hpp" #include "hs_optimizor/nllso/meta_forward_declare.hpp" #include "hs_optimizor/nllso/meta_eigen_resid...
#ifndef LIBRARIES_H #define LIBRARIES_H #define SIZE_LIMIT 50000 #define BAD_FILE 1 #define BAD_SIZE 2 #define BAD_LENGTH 3 #define BAD_MAXMIN 4 #include <iostream> #include <fstream> #include <sstream> #include <string> #include <QMainWindow> #include <QGraphicsItem> #include <QGraphicsView> #include <QGraphicsEffe...
#include <SoftwareSerial.h> SoftwareSerial Serial1(2, 3); // RX, TX void setup() { Serial.begin( 9600 ); Serial1.begin( 115200 ); delay( 500 ); Serial.println( "Starting..." ); } void loop() { // If a data arrives from debug Serial, perform a readings per seconds test. if ( Serial.avai...
// License: Apache 2.0. See LICENSE file in root directory. // Copyright(c) 2019 FRAMOS GmbH. #ifndef LIBREALSENSE2_CS_TIMESTAMP_H #define LIBREALSENSE2_CS_TIMESTAMP_H #include "sensor.h" namespace librealsense { class cs_timestamp_reader_from_metadata : public frame_timestamp_reader { std::unique_pt...
// merge sort // _ ____ __ _ _ __ // (_/_(_(_(_)(__ / (_(_/_(_(_(_/__(/_/ (_ // /( .-/ .-/ // (_) (_/ (_/ #include "../_library_sort_.h" // Độ phức tạp: // Best: O(nlogn) | Avarage: O(nlogn) | Worst: O(nlogn) | Memory: O(n) | Stable // Di...
/* -*- c++ -*- */ /* * Copyright 2018 <+YOU OR YOUR COMPANY+>. * * This 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 3, or (at your option) * any later version. * * This software i...
/* Copyright(c) 2016-2019 Panos Karabelas 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, distrib...
// A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’ or ‘v’ is in vertex cover. // Although the name is Vertex Cover, the set covers all edges of the given graph. // The problem to find minimum size vertex cover of a graph is NP complete. // But...
#pragma once class GamePhysics { public: float gravity; int groundHeight; GamePhysics(float g, int gH); };
#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; } int main(){ ios::sync_with_stdio(0); cin.tie(0); int t; ...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define endl '\n' #define int long long #define print(v) for(auto x:v){cout<<x<<" ";}cout<<endl; int mod=1000000007; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin>>t; while(t-- > 0) { ...
// // Created by wiktor on 23.05.18. // #include "FactoryMethod.h" namespace factoryMethod{ }
/********************************************************************* 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...
#pragma once #include <d3dx9.h> #include <d3d9.h> #include "../GameObjects/Entity/Entity.h" class GameCollision { public: static bool isCollision(RECT rect1, RECT rect2); //Check collision between Point and Rectangle static bool pointCollision(float x, float y, RECT rect); //Check collision between Rectangle an...
// xdemo.cpp - xdemo Mode X demo program // (c) 1999 Michael Fink // https://github.com/vividos/OldStuff/ #include "xmode.h" #include <conio.h> void main() { xmode x; x.on(); x.clearpage(2); x.setpage(0); x.showpage(0); x.pagemove(2); x.pagemove(x.activepage()); byte array[16] = { 0,1,2,3,4,5,6,7,...
/* ID: hjl11841 TASK: sort3 LANG: C++ */ #include<bits/stdc++.h> using namespace std; int num[1010],cnt[4],a[4],n; int main(){ freopen("sort3.in","r",stdin); freopen("sort3.out","w",stdout); cin>>n; for(int i=1;i<=n;i++){ cin>>num[i]; cnt[num[i]]++; } for(int i=1;i<=cnt[1]+cnt[2];...
#define NOMINMAX #include <opencv2/opencv.hpp> #include <opencv2\core\core.hpp> #include <opencv2\imgcodecs.hpp> #include <opencv2\imgproc.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2\imgproc\imgproc.hpp> #include <iostream> #include <dirent.h> #include <vector> using namespace std; using namespace ...
// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "GameFramework/PlayerController.h" #include "Engine/DirectionalLight.h" #include "ConnectFourPlayerController.generated.h" /** PlayerController class used to enable cursor */ UCLASS() class AConnectFourPlayerController ...
// // Created by ariel.simulevski on 29.04.20. // #ifndef TINYGRAPH_GRAPH_H #define TINYGRAPH_GRAPH_H #include "types.h" #include <vector> namespace tinygraph { class Graph { public: std::map<std::string, std::shared_ptr<Vertex>> vertices; Graph(); ~Graph(); std::shared_ptr<...
//utilize the power function builtin #include <iostream> #include <cmath> //zaeem 19L-1196 void Power(double num, double exp, double &result){ result = pow(num,exp); } using namespace std; int main(){ double result, n,p; cout << "enter: number power "; cin >> n >> p; Power(n,p,result); cout <<"ans:"...
#include<bits/stdc++.h> using namespace std; #define ll long long #define M 100000000 /* ll p[Max],k=1; vector<bool > a(100000000, true); ll sieve( ) { ll i,j; a[0]=a[1]=false; for(i=4; i<=Max; i+=2) { a[i]=false; } for(i=3; i<=sqrt(Max); i+=2) { for(j=i*i; j<=Max; j=j+2...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define ll long long const int N = 2e5+22; const int F = 1e9+22; const ll INF = 2e15+22; class Edge { public: int u, v; ll d; Edge(int uu, int vv, int dd = 0) { u = uu; v = vv; d = dd; } }; // Weighted ...
#ifndef PROJECTILE_H #define PROJECTILE_H #include <QWidget> #include <QPainter> #include <QTimer> //#include "Box.h" class Projectile { public: Projectile(); int getX(); int getY(); int getWidth(); int getHeight(); void setPosition(int x, int y); void setDirection(int n...
/** * Copyright (C) 2017 Alibaba Group Holding Limited. All Rights Reserved. * * * 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 * * ...
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main (){ int N, num; vector<int> sum; cin >> N; /*새로 입력되는 단위의 화폐 마다 본인을 포함해 기존에 벡터 안에 들어있던 모든 금액과 더한 값을 넣어준다. */ for(int a = 0; a < N; a++){ cin >> num; int size = sum.size(); ...
#ifndef __RESHAPE_LAYER_H__ #define __RESHAPE_LAYER_H__ #include <cassert> #include <iostream> #include <fstream> #include <cstring> #include <cuda_runtime.h> #include "NvCaffeParser.h" #include "NvInferPlugin.h" #include "Common.h" using namespace nvinfer1; using namespace nvcaffeparser1; using namespace plugin; te...
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int n,k,q,ans[int(1e5)+5]; long long num[int(1e6)+5]; pair<long long,int> qs[int(1e5)+5]; void init(){ scanf("%d %d %d",&n,&k,&q); for(int i=0;i<n;i++){ scanf("%lld",&num[i]); } for(int i=0;i<q;i++){ scanf(...
#include <iostream> #include <cstring> #include <vector> #include <algorithm> using namespace std; bool graph[101][101]={0,}; int visit[101][101] = {0,}; int n, m, k; int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}}; void makeGraph(int x1, int y1, int x2, int y2){ for(int i=n-y1; i<=n-y2-1; i++){ for(int j=x1; j<=x2...
#include "rec.h" Rec::Rec(Point & _head, const char _c) :Rotatable(_head, _c) { int x = _head.getX(_head); int y = _head.getY(_head); char c1 = _c; bodyShape[0].set(x + 0, y, c1); bodyShape[1].set(x + 1, y, c1); bodyShape[2].set(x + 2, y, c1); bodyShape[3].set(x + 3, y, c1); } void Rec::takeShapeUp() { bodyS...
#ifndef _GALES_MESH_MOTION_HPP_ #define _GALES_MESH_MOTION_HPP_ #include "mesh.hpp" namespace GALES { template<int dim> class Mesh_Motion {}; template<> class Mesh_Motion<2> { using mesh_type = Mesh<2>; using vec = std::vector<double>; public: // This functi...
/*********************************************************************** * * Copyright (c) 2012 Alcatel-Lucent Technologies. * All rights reserved. * * ALL RIGHTS ARE RESERVED BY ALCATEL-LUCENT TECHNOLOGIES. * ACCESS TO THIS SOURCE CODE IS STRICTLY RESTRICTED * UNDER CONTRACT. THIS CODE IS TO BE KEPT STRICT...
#include <iostream> using namespace std; //13130110075 zhouyou bool check(int s[], int C, int k, int x[]){ int sum = 0; for(int i=0; i<=k; i++){ if(x[i] == 1) sum += s[i]; } if(sum > C) return false; else return true; } void KNAPSACK(int v[], int s[], int C...