text
stringlengths
8
6.88M
// to get the shortest path from source to destination // since it is unweighted we will use dfs #include<bits/stdc++.h> using namespace std; struct node { int v,dis; }; void printpath(map<int,int>& parent,int index) { if(parent[index]==-1)//source { cout << index << endl; return ; } cout << index << " "; ...
/* The |getline| library by Arthur O'Dwyer. Public domain. */ #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include "getline.h" static void try_resize(char **p, size_t *cap); /* The |fgetline_notrim| function reads characters from |stream| and store...
#include "TimeMeas.h" #include <windows.h> #include <vector> using namespace std; namespace Shim { namespace TimeMeas { class TimeMeas_Sub { public: int m_id; LARGE_INTEGER start, end, temp_start; double cur_dt_micros; double min_dt_micros; double max_dt_micros; double avg_dt_micros; d...
/* Copyright (c) 2012 Rohan McGovern <rohan@mcgovern.id.au> 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, mod...
#pragma once #include <chrono> #include <memory> #include <string> #include <utility> #include <vector> #include "options.hpp" #include "outputs.hpp" #include "impl/runtime.hpp" namespace fantom { class AlgorithmImpl; class DataObject; class Graphics; class Texture; //--------------------------...
#ifndef _GALES_ELEMENT_HPP_ #define _GALES_ELEMENT_HPP_ #include <vector> #include "node.hpp" namespace GALES { /** A generic mesh element. This class implements a generic mesh elements: it can be composed by any number of nodes; also, it can have any number of adjacent elements. */ //--------------------...
#include <windows.h> #include <iostream> using namespace std; TCHAR szName[] = TEXT("MyFileMappingObject"); CRITICAL_SECTION* crSection; int main() { HANDLE hMapFile = OpenFileMapping( FILE_MAP_ALL_ACCESS, FALSE, szName); if (hMapFile == NULL) { std::cout << "Cannot open shared memory critical section" <<...
// // Copyright Jason Rice 2017 // 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/catch.hpp> #include <nbdl/js.hpp> #include <nbdl/run_async.hpp> #include <boost/hana/tuple.hpp> #include <catch....
#include <bits/stdc++.h> #define ull unsigned long long #define ll long long #define il inline #define db double #define ls rt << 1 #define rs rt << 1 | 1 #define pb push_back #define mp make_pair #define pii pair<int, int> #define X first #define Y second #define pcc pair<char, char> #define vi vector<int> #define vl ...
#include <gtest/gtest.h> #include <argparser/arg.h> #include <any> #include <string> #include <map> #include <vector> namespace argparser { class ArgTests : public ::testing::Test { }; TEST_F(ArgTests, BasicInit) { argparser::Arg<std::string> arg1("--upload", "Description for upload", std::string("")); EXP...
#include<iostream> using namespace std; int sumf(int n){ double sum=0; for(int i=1;i<=n;i++){ sum=sum+i; } cout<<"\n\t sum : %d"<<sum; } void sumM(int n){ double sum=(n*(n+1))/2; cout<<"\n\t sum : %d"<<sum; } int main(){ printf("\n\t enter a no : "); int n; cin>>n; //sumf(n); sumM(...
/* Author: Nayeemul Islam Swad Idea: - If we start going up or down from `(0, 0)`, the sequence of cells will be periodic. `(goalX, goalY)` must be one of the cells in this sequence. Then, we can restate the problem as follows, Given an array of length `n` and our current position `pos`. If our ...
#include "darr.h" int strCount(string &input) { unsigned int count = 0; unsigned int ptr = 0; bool num = false; if (input.empty()) return 0; for (ptr = 0; ptr < input.length(); ptr++) { if (input[ptr] == ' ') { if (num != false) { ...
#pragma once #include <QWidget> #include <QStringListModel> #include "Group.hpp" namespace Ui { class SubjectListEdit; } class SubjectListEdit : public QWidget { Q_OBJECT public: explicit SubjectListEdit(QWidget *parent = 0); void setGroup(Group &group_); ~SubjectListEdit(); private slots: voi...
#pragma once #ifndef J_MATH_SEQUENCE_H_ #define J_MATH_SEQUENCE_H_ #include <vector> #include <sstream> #include "..\utility\clamp.h" namespace j { namespace math { // Method of indexing enum class IndexType { CLAMP, WRAP }; // One-dimensional sequence of values. template<typename valuetype> struct Sequence1D...
#ifndef _CREATESLICE_H_ #define _CREATESLICE_H_ /* ! \class CreateSlice This class is a traversal which marks elements that should be in a slice. It does so by accepting a list of nodes that belong in the slice. Currently, it's basically a destructive operation: the ast itself is changed to produce the co...
#include <bits/stdc++.h> using namespace std; int dp[100069]; int main() { int n; cin>>n; int arr[n+1]; for(int i=0;i<n;i++) { cin>>arr[i]; } dp[0] = arr[0] > 0 ? arr[0] : 0; if(n==1) { cout<<arr[0]<<endl; return 0; } dp[1] = max(dp[0],dp[0]+arr[1]); for(int i=2;i<=n;i++) { dp[i] = max(dp[i-1],dp[...
#include <stdio.h> #include<stdlib.h> typedef struct SStr{ char *ch; //可以指向一个字符序列的char指针 int len; // 保存串的长度 }SStr; //函数声明 //串初始化 void StrInit(SStr &T); //串赋值 void StrAssign(SStr &T , SStr &S); //串输出 void StrPrint(SStr T); //求子串 void SubString(SStr &SUB , SStr T , int pos , int len); //判断串是否为空 bool StrEmpty(SS...
/* * * Copyright (c) 2020 gyabo <gyaboyan@gmail.com> * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify,...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "base.h" WINRT_WARNING_PUSH #include "internal/Windows.Storage.3.h" #include "internal/Windows.Foundation.Collections.3.h" #include "internal/Windows.Foundation.3.h" #include "interna...
// // Created by lin-k on 01.10.2016. // #ifndef NESEMULATOR_MEMORY_H #define NESEMULATOR_MEMORY_H #include "Common.h" #include "Controller.h" #include "Console.h" #include "PPU.h" #include "ROM.h" #include "APU.h" class PPU; class APU; class Memory { public: Memory(); virtual ~Memory(); void init(); ...
#ifndef PLAYER_H #define PLAYER_H #endif // PLAYER_H #include <QGraphicsPixmapItem> #include <QGraphicsRectItem> #include <QKeyEvent> #include <QObject> class Player: public QObject,public QGraphicsRectItem{ Q_OBJECT public: Player(); void keyPressEvent(QKeyEvent *event); public slots: ...
#include <iostream> using namespace std; int largest; int smallest; int main() { int i_number1, i_number2, i_number3, i_number4, i_number5; cout << "Enter number1: "; cin >> i_number1; largest = i_number1; smallest = i_number1; cout << "Enter number2: "; cin >> i_number2; ...
#include "board.h" #include <string> #include "engine/vertex.h" namespace { auto build_checkerboard(glm::vec3 tile_size, const apeiron::opengl::Cuboid* white, const apeiron::opengl::Cuboid* black) { std::vector<example::chess::Tile> checkerboard; // Build board from bottom left float x = -tile_size.x *...
#include <bits/stdc++.h> using namespace std; const int MAX_INT = std::numeric_limits<int>::max(); const int MIN_INT = std::numeric_limits<int>::min(); const int INF = 1000000000; const int NEG_INF = -1000000000; #define max(a,b)(a>b?a:b) #define min(a,b)(a<b?a:b) #define MEM(arr,val)memset(arr,val, sizeof arr) #defi...
// This file has been generated by Py++. #include "boost/python.hpp" #include "generators/include/python_CEGUI.h" #include "Vertex.pypp.hpp" namespace bp = boost::python; void register_Vertex_class(){ { //::CEGUI::Vertex typedef bp::class_< CEGUI::Vertex > Vertex_exposer_t; Vertex_exposer_t Vert...
#include <MetaValue.h> #include <ValueType.h> #include <MetaFactory.h> #include <ID.h> using namespace std; using MVB = MetaValueBaseImplementation; using Data = MVB::Data; using Attributes = MVB::Attributes; using UnaryOp = MVB::UnaryOp; using UnaryConstOp = MVB::UnaryConstOp; using Binar...
#pragma once #include "Transport.h" #include <vector> #include <list> using namespace std; class Manager { private: list<Truck*> truckList; public: Manager() {} ~Manager(); void addTruck(Truck* t) { truckList.push_back(t); } Truck* transport(int targetDistance, int weight); double getAllIncome(); ...
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,a; cin>>n; vector<int>v; map<int,int>mp; for(int i=0;i<n;i++) { cin>>a; v.push_back(a); } int j=0,ans=0; for(int i=0;i<n;i++) ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) const ll MOD = 1000*1000*1000+7; const ll INF = 1ll*1000*1000*1000*1000*1000*1000 + 7; const ll MOD2 = 998244353; const ld PI = 3.14159265358...
#include <algorithm> using namespace std; int getgcd(int a, int b) //유클리드 호제법 { while (b != 0) { int r = a % b; a = b; b = r; } return a; } long long solution(int w, int h) { long long answer = (long)w*h; //int 범위 초과 int gcd = getgcd(w, h); answer -= w + h - gcd; return answer; }
// // MyCharSet.hpp // XinzhouProject // // Created by YangLin on 2017/6/14. // // #ifndef MyCharSet_hpp #define MyCharSet_hpp #include "stdint.h" #include "stdio.h" #include <string.h> #include <memory.h> #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #include <malloc.h> #endif class MyCharSet { public: MyCha...
/*************************************************************************** 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 "basis.h" #include <iostream> using namespace std; int main() { basis NewBasis(2,0); NewBasis.printBasis(); }
//CharacterKey.h #ifndef _CharacterKey_H #define _CharacterKey_H #include "KeyAction.h" class CharacterKey :public KeyAction { public: CharacterKey(Form *form = 0); CharacterKey(const CharacterKey& source); ~CharacterKey(); CharacterKey& operator=(const CharacterKey& source); virtual void OnKeyDown(UINT nChar, ...
#ifndef BOUNDARY_H #define BOUNDARY_H #include "ModelBase.h" #include "Common.h" namespace FastCAEDesigner { class BoundaryModel : public ModelBase { Q_OBJECT public: BoundaryModel(QString nameEng, QString nameChn, QString iconName, QObject *parent); ~BoundaryModel(); virtual int ShowEditor(QTreeWidgetIt...
#ifndef ENCHANTED_FOREST_H #define ENCHANTED_FOREST_H #include <places/outdoor.h> #include <objects/usable.h> #define N_ANIMALS_FOREST 2 #define FOREST_MAX_POPULATION 3 namespace lab3 { namespace places { class Forest : public Outdoor { public: Forest(const std::string &name); ~Forest(); void gene...
// -*- 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 "pch.h" #include "PhoneBookDB.h" SYSTEM_INFO sysinfo = { 0 }; HANDLE hFile; DWORD fsize; HANDLE hMapping; LPVOID fPointer; #define BLOCK_SIZE 65536 #define NEXT_SIZE 28 //Указатель на начало данных unsigned char* pointer; //Отступ по блокам DWORD offset; //Отступ при хождении по данным int offsetInData...
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define MOD 1000000007 ll dezElevadoA[100100]; void preProcess(){ dezElevadoA[0] = 1; for(int i = 1; i < 100010; i++){ dezElevadoA[i] = (dezElevadoA[i-1] * 10LL) % MOD; } } int n, m; string L, R; pair<ll, ll> memo[100100][2][13]; void li...
#ifndef RTSP_COMMON_H #define RTSP_COMMON_H #include <string> #include "liveMedia.hh" #define NEW_SMS(description) do {\ char const* descStr = description\ ", streamed by the LIVE555 Media Server";\ std::string stream = createStreamName(mFileName);\ sms = ServerMediaSession::createNew(*mEnvironment, ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a[100001]; for(int i=0; i<100001; i++) a[i] = -1; for(int k=0; k<n; k++) { int x, y, ans = 0; cin>>x>>y; for(int i=1; i<=sqrt(x); i++) { if(x%i==0) { //check for unique sol if(a[i]==-1 || a[i]<k-y) ans++; //u...
#pragma once #include "Light.h" /*! * \brief Class defining directional lights * */ class DirectionalLight : public Light { private: /*! * Struct of the properties of a directional light. * */ struct DirectionalLightProperties { glm::vec3 color; glm::vec3 direction; DirectionalLightProperties(glm::...
#ifndef DRAWERS_SIMDATA_DRAWER_HEADER #define DRAWERS_SIMDATA_DRAWER_HEADER #include <memory> #include "Source/Math/Math.h" #include "Source/Units/Unit.h" namespace solar { namespace openGL { class Shader; class Sphere; } class Camera; namespace drawers { //Draws simulated units on screen as spheres // ...
#include "PlayerModel.h" #include <GL/glew.h> #include <glm/glm.hpp> #include <assimp/Importer.hpp> #include <assimp/postprocess.h> #include <glm/ext.hpp> #include <boost\filesystem.hpp> #include <SOIL/SOIL.h> PlayerModel::PlayerModel(const char* path, Shader *shader, protos::Message_GameObject_AnimationState state) ...
#pragma once #include "math3d.h" class FEMesh; //----------------------------------------------------------------------------- //! This class implements a modifier that coarses a plygonal mesh using an //! approximated centroidal voronoi diagram. class FEMeshSmoothingModifier { public: //! Constructor ...
#pragma once #include "serialcomms.h" #include "states.h" namespace FennecScalesGUI { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace Syst...
// github.com/andy489 //First Solution BFS #include <cstdio> #include <set> using namespace std; int main() { int dx[]{ -1,-1,-1,0,0,1,1,1 }, dy[]{ -1,0,1,-1,1,-1,0,1 }, n,k,x,y,xx,yy,c(0); scanf("%d%d%d%d", &n, &k,&x,&y); set<pair<int, int>> bad; while (k--) { scanf("%d%d", &x...
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while( t --){ int n, k, x, y; cin >> n >> k >> x >> y; if(k == 0){ if(x == y) cout << "YES\n"; else cout << "NO\n"; } else{ bool flag = false; for...
#include "application_kernel.hh" namespace { void write_vector(sys::pstream& out, const std::vector<std::string>& rhs) { const uint32_t n = rhs.size(); out << n; for (uint32_t i=0; i<n; ++i) { out << rhs[i]; } } void read_vector(sys::pstream& in, std::vector<std::string>& rhs) { rhs.clear(); uint...
#define _CRT_SECURE_NO_WARNINGS #include <Windows.h> #include <iostream> #include <cmath> #include <malloc.h> #include <fstream> #include <string> #include <assert.h> #include <bitset> #include <vector> #include <stdio.h> #include <sstream> using namespace std; #define FILE_SIZE_OFFSET 0x0002 #define DA...
// // Created by ariel.simulevski on 29.04.20. // #ifndef TINYGRAPH_DATA_H #define TINYGRAPH_DATA_H namespace tinygraph { std::shared_ptr<Vertex> vertex_create(const std::string& name, std::shared_ptr<Type> type); } #endif //TINYGRAPH_DATA_H
#ifndef PARSER_SALAS_H #define PARSER_SALAS_H #include <string> #include <vector> #include "../definiciones/definiciones.h" #include "../niveles/sala.h" #include "../juego/factorias/factoria_objetos_juego.h" namespace App_Generador { /** * El parser de salas. Un aspecto importante es que tiene un vector de contenedo...
class Solution { public: int singleNonDuplicate(vector<int>& nums) { int n = nums.size(), left = 0, right = n - 1; while (left < right) { int mid = left + (right - left) / 2; // before the single elem, // for each pair, the first elem is at...
#include <bits/stdc++.h> using namespace std; class Solution { int ans = 0; int num(char c) { return c - '0'; } int helper(string str, map<string, int> &m) { if (m.find(str) != m.end()) return m[str]; int n = str.length(); if (n < 2) { m[str] = n...
// IMPORTANT: When including a library in a firmware app, a sub dir prefix is needed // before the particular .h file. #include "eoLabs/eoLabs-example.h" void setup() { // Call functions on initialized library objects that require hardware // to be wired up correct and available. } void loop() { // Use the li...
#include <bits/stdc++.h> #include <time.h> using namespace std; #define ll long long #define ld long double #define uint unsigned int #define ull unsigned long long const ll INF = 2e18; struct pnt { int place; ll val; pnt() {} pnt(int p, ll v) { place = p; val = v; } }; void prin...
// Created by wangwenjie on 2014/01 #ifndef __SCROLL_LAYER_H__ #define __SCROLL_LAYER_H__ #include "cocos2d.h" #include "LBLibraryBase.h" #include "ConfigFoolHead.h" #include "PBase.h" #include "LockHelper.h" #include "ScrollBase.h" class ScrollLayer : public WJLayer, public ScrollBase { protected: CC_SYNTHESIZE(S...
//58. Write a program in C++ to print the area of a polygon. #include<iostream> #include<cmath> using namespace std; int main() { float s,area,n; cout<<"Enter number of sides of polygon:"; cin>>n; cout<<"Enter length of side of polygon:"; cin>>s; area= (n * (s * s)) / (4.0 * tan((M_PI / n))); cout<...
#ifndef DFA_TO_DOT_H #define DFA_TO_DOT_H //#include "rose.h" #include <string> #include <map> #include <set> #include <sstream> #include <iostream> #include <iomanip> #include <cctype> #include <stdint.h> #include "filteredCFG.h" #include "DefUseAnalysis.h" class LivenessAnalysis; namespace VirtualCFG { templat...
#pragma once /* Default Ranged Swap * PATCHES: Standard.dll */ #include "../Main.h" #include "../Singleton.h" #include "GenericPatcher.h" class CPatcher_DefaultRangedSwap : public IGenericPatcher { public: CPatcher_DefaultRangedSwap(); bool ReadINI(void); bool WriteINI(void); bool SetSwap(int); static int Get...
// // Created by Josh on 4/21/2020. // #ifndef FINALPROJECT_ALIEN_H #define FINALPROJECT_ALIEN_H #include "location.h" namespace space_invader { // Represents an alien class Alien { public: explicit Alien(const Location& location); Location GetLocation() const; Location SetLocation(const Location&); void Set...
#include "PlayThread.h" #include "MyFFmpeg.h" #include <QtCore> PlayThread::PlayThread(MyFFmpeg * m_ffmpeg):m_ffmpeg(m_ffmpeg) { } PlayThread::~PlayThread() { this->quit(); wait();//优雅的关闭线程 } void PlayThread::run() { while (1) { static int flag=0; if (!(m_ffmpeg->m_isPlay)) {...
// https://codility.com/programmers/lessons/3-time_complexity/perm_missing_elem/ // you can use includes, for example: // #include <algorithm> #include <vector> // you can write to stdout for debugging purposes, e.g. // cout << "this is a debug message" << endl; inline int sum(std::vector<int> *); int solution(vect...
#include "scripting\Singularity.Scripting.h" using namespace Singularity::Components; namespace Singularity { namespace Scripting { class LuaTask : public Singularity::Threading::Task { DECLARE_OBJECT_TYPE; private: #pragma region Static Variables static LuaTask* g_pInstance; #...
#ifndef SCENE_H #define SCENE_H #include <cstddef> #include "imath.h" const int MAX_LINES_COUNT = 16; const int MAX_CIRCLES_COUNT = 256; const int MAX_COLLISIONS_COUNT = 1024; const Vec2 SCENE_MIN(0, 0); const Vec2 SCENE_MAX(80, 60); struct Line { Vec2 a, b; }; struct Circle { float radius; Vec2 position; V...
/*====================================================================================== * 05-kuka_screwing.cpp * * Example of a controller for a Kuka arm made with the screwing alignment primitive * ScrewingAlignment controller is used to align a bottle cap with a bottle before using * the RedundantArmMotion prim...
#include "Move.h" #include "ModuleInput.h" #include "Application.h" #include "TimeManager.h" #include "ModuleImGui.h" Move::Move(GameObject * own) : Component(own) { target = (Transform*)own->FindComponentbyType(TRANSFORM); SetType(MOVE); Setname("Movement"); speed = 0.1f; } Move::Move() { SetType(MOVE); Setnam...
#include <bits/stdc++.h> #include<regex> using namespace std; string ltrim(const string &); string rtrim(const string &); vector<string> split(const string &); int main() { string N_temp; getline(cin, N_temp); int N = stoi(ltrim(rtrim(N_temp))); vector<string> result; regex b("@gmail.com$"); ...
/* Copyright (c) 2013 Richard Russon (FlatCap) * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * * This program...
/*********************************************************************** created: 30/5/2004 author: Paul D Turner purpose: Implementation of text support class *************************************************************************/ /*************************************************************...
// Using sizeof operator is returned total bytes of array. #include <iostream> using namespace std; size_t byte( double * ); int main(){ double array[ 20 ]; cout << " size of array = " << sizeof( array ) << endl; cout << " size of double = " << sizeof( double ) << endl; cout << " returned va...
// InvokeDll.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include "pch.h" #include <iostream> #include "..\DllDemo\DllDemo.h" /* 首先,这个_tmain()是为了支持unicode所使用的main一个别名而已,既然是别名,应该有宏定义过的,在哪里定义的呢?就在那个让你困惑的<stdafx.h>里,有这么两行 #include <stdio.h> #include <tchar.h> 我们可以在头文件<tchar.h>里找到_tmain的宏定义 #define _tmain main 所以,经过预编译以后, _t...
#include<iostream> #include "itemsclass.h" #include "fruitsclass.h" #include "vegetablesclass.h" #include "nodeclass.h" #include "linkedlistclass.h" #include<stdio.h> #include<stdlib.h> using namespace std; int id = 1001; int main() { linked_list store; FILE* fruit = fopen("fruits.txt","r"); ...
///* // * Dog.cpp // * // * Created on: Sep 14, 2021 // * Author: pinkhathacker // */ // ///* #include "Dog.hpp" #include <iostream> using namespace std; ////constructors ///* // * TODO: Dog(string n) // */ Dog::Dog(string nName){ name = nName; strength=50; x=0; y=0; } // ///* // * TODO: Dog() // */ Dog::Dog...
/* * Author : BurningTiles */ #include <iostream> #define ll long long using namespace std; int main(){ ll x1=0 , x2=1, temp, n; cin >> n; if(n==1) cout << x1; else if(n==2) cout << x2; else{ for(ll i=3; i<=n; i++){ temp = (i-1)*(x1+x2)%100000...
/* 14889. 스타트와 링크 다시풀기 */ #include <iostream> #include <vector> #include <math.h> using namespace std; int N; int board[21][21]; bool selected[21]; int answer = 987654321; void calculate() { int sum[2] = {0,0}; for(int i = 0; i < N; i++) { bool flag = selected[i]; for(int j = 0; j < N; j...
#include <iostream> #include <vector> #include <ncurses.h> #include <cstdlib> #include <ctime> #ifndef SNAKEGAME_H #define SNAKEGAME_H // Unreal standards struct CharPosition { int x, y; CharPosition(int col, int row); CharPosition(); }; class snakeGame { private: int speed, itemChange, maxwidth, max...
#include <bits/stdc++.h> using namespace std; static const int SIZE = 1 << 18; static const int LOG2 = 18; int n, q; int arr[SIZE]; int log_2[SIZE]; int st[SIZE][LOG2]; void input() { cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; } } void build() { log_2[1] = 0; for (int i = 2;...
//~ <template> #include <bits/stdc++.h> using namespace std; mt19937 rng(int(chrono::steady_clock::now().time_since_epoch().count())); //~ </template> class Solution { private: string vowels = "aeiou"; vector< string > possibilities; void generate(const string &s) { if (int(s.size()) == 3) { this...
// This file has been generated by Py++. #ifndef UBox_hpp__pyplusplus_wrapper #define UBox_hpp__pyplusplus_wrapper void register_UBox_class(); #endif//UBox_hpp__pyplusplus_wrapper
#ifndef __SOUND_SCENE_H__ #define __SOUND_SCENE_H__ #include "cocos2d.h" #include "SimpleAudioEngine.h" USING_NS_CC; class SoundControl { public: static bool hasEffect; static SoundControl* getInstance(); static void destroyInstance(); void changeBgmState(bool hasBgm); void changeEffectState(bo...
#include<iostream> #include<conio2.h> #include<vector> #include<string> #include<fstream> #include<sstream> using namespace std; #include"Tela.h" #include"Categorias.h" #include"Pecas.h" #include"Servicos.h" #include"Clientes.h" #include"Pedido.h" main() { Tela janela; Categorias cat; Pe...
#include "loadShaders.h" #include <stdio.h> #include <stdlib.h> #include <GL/glut.h> #include <GL/gl.h> #include <GL/glu.h> void framebuffer_size_callback(GLFWwindow* window, int width, int height); void processInput(GLFWwindow *window); //Settings const unsigned int SCR_WIDTH = 800; const unsigned int SC...
/* * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de> * SPDX-License-Identifier: BSD-3-Clause */ #ifndef CUTELYSTVALIDATORREQUIREDWITHALL_H #define CUTELYSTVALIDATORREQUIREDWITHALL_H #include "validatorrule.h" #include <Cutelyst/cutelyst_global.h> #include <QStringList> namespace Cu...
/* 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<cstdio> #include<iostream> #include<cstring> using namespace std; int main() { char str[1005]; int num[10] = {0}; cin >> str; for(int i= 0; i < strlen(str); i++) num[str[i] - 48]++; for(int i = 0; i < 10; i++) if(num[i]) cout << i << ':' << num[i] << endl; retur...
#pragma once #include "enemy.h" #include "camera.h" class Boss : public Enemy { public: Boss(sf::Vector2f = sf::Vector2f(0, 0)); ~Boss(); void update(int, int, float, sf::Vector2f&, sf::Vector2u&); void moveForward(float); void moveBackward(float); float boss_range; float boss_range_end; };
#ifndef RCFNODEIMPL_H #define RCFNODEIMPL_H /// @file RcfNodeImpl.h /// @brief RcfNodeImpl のヘッダファイル /// @author Yusuke Matsunaga (松永 裕介) /// /// Copyright (C) 2013 Yusuke Matsunaga /// All rights reserved. #include "RcfNode.h" BEGIN_NAMESPACE_YM ///////////////////////////////////////////////////////////////////...
#include "util.h" using namespace std; GLuint loadTexture( const char * filename,int width,int height){ GLuint texture; unsigned char * data; FILE * file; file = fopen( filename, "rb" ); if ( file == NULL ) { cout<<"error"; return 0; }; fseek ( file , 56 , SEEK_SET ); data = (unsigned char *)mallo...
#include "SkeletalModel.h" #include <FL/Fl.H> using namespace std; void SkeletalModel::load(const char *skeletonFile, const char *meshFile, const char *attachmentsFile) { loadSkeleton(skeletonFile); m_mesh.load(meshFile); m_mesh.loadAttachments(attachmentsFile, m_joints.size()); computeBindWorldToJointTransfor...
#include "HypergraphNodeEditor.h" #include "ui_HypergraphNodeEditor.h" HypergraphNodeEditor::HypergraphNodeEditor(HypergraphNodePresenter *hypergraph_node) :HypergraphNode(hypergraph_node) { Ui::HypergraphNodeEditor Ui; Ui.setupUi(this); // Radius = Ui.Radius; RadiusDecay = Ui.RadiusDecay; ParentWeight = Ui.P...
#include <bits/stdc++.h> using namespace std; // sub of the factor with some given conditions! int main() { int n; cin >> n; vector<int> factors; for (int i = 1; i <= n / 2; i++) { if (n % i == 0) factors.push_back(i); } factors.push_back(n); // .. proceess!! cou...
#include <iostream> using namespace std; void main() { int N; cin >> N; N = (N+500) / 1000 * 1000; cout << N; }
#include "Arduino.h" #include "UVsensor.h" UVsensor::UVsensor(byte newPin){ pin=newPin; } int UVsensor::read(){ int data=analogRead(pin); if(data<10) return 0; if(data>10&&data<46) return 1; if(data>46&&data<65) return 2; if(data>65&&data<83) return 3; if(data>83&&data<103) return 4; if(data>103&&data...
/* * Camera.cpp * * Created on: 04 сент. 2017 г. * Author: Илья */ #include "Camera.h" Camera::Camera() { pos = glm::vec3(0.0f, 0.0f, 3.0f); // положение target = glm::vec3(0.0f, 0.0f, 0.0f); // цель direction = glm::normalize(pos - target); // нормализация } Camera::~Camera() { ...
// // CalendarDayCell.cpp // IMKSupply // // Created by KimSteve on 2017. 9. 7.. // // #include "CalendarDayCell.h" #include <string> #include <sstream> #include "../Base/SMButton.h" #include "../Const/SMFontColor.h" #include "../Util/ViewUtil.h" std::string convertInt(int number) { std::stringstream ss; s...
class Solution { public: int longestMountain(vector<int>& A) { int pos = 1; int len = 0; while(pos < A.size()) { while(pos < A.size() && A[pos - 1] == A[pos]) pos++; int inc = 0; while(pos < A.size() && A[pos - 1] < A[pos]) { ...
/* 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...
//************************************************************************** //** //** See jlquake.txt for copyright info. //** //** 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 ...