text
stringlengths
8
6.88M
//=========================================================================== /* This file is part of the CHAI 3D visualization and haptics libraries. Copyright (C) 2003-2004 by CHAI 3D. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms o...
#pragma once class String { public: String(); ~String(); // 같은 방법을 하면 반대로도 바꿀 수 있음 static wstring StringToWString(string value); };
/* * Copyright 2016 Robert Bond * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
#ifndef PLAYER_H #define PLAYER_H #include <string.h> #include <time.h> #include <stdint.h> #include "Typedef.h" using namespace std; #define STATUS_PLAYER_LOGOUT 0 #define STATUS_PLAYER_INGAME 1 //正在打牌 #define GAME_END_NORMAL 0 #define GAME_END_DISCONNECT 1 #define GAME_END_DISCARD 2 #define BETNU...
/* ID: andonov921 TASK: lamps LANG: C++ */ #include <iostream> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <string> #include <algorithm> #include <sstream> #include <climits> #include <fstream> #include <c...
#include<bits/stdc++.h> using namespace std; main() { long long int i,sum=0,n; while(scanf("%lld",&n)==1) { if(n==0) break; else if(1<=n<=100) { for(i=n; i>=1; i--) { sum+=(i*i); } printf("%lld\n",sum); ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 1995-2011 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. It may not be distributed * under any circumstances. * * @author Marcin Zdun (mzdun) */ #ifdef AUTO_UPDATE_SUPPORT #ifn...
#include "Credits.h" Credits::Credits(QWidget* parent) : QDialog(parent) { this->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); this->setAttribute(Qt::WA_DeleteOnClose); QHBoxLayout* layout = new QHBoxLayout(this); ini(layout); this->exec(); } void Credits::ini(QHBoxLayout* layout) { ...
#ifndef TYPES_HPP #define TYPES_HPP #include <vector> #include <set> #include <utility> #include <GL/glew.h> #include <glm/glm.hpp> #include <glm/ext.hpp> #include <assimp/scene.h> #include <assimp/postprocess.h> //define global variables, some of them is not force to use, others are this are //optional names, defin...
/************************************************************************/ /* 已知集合A和B的元素分别用不含头结点的单链表存储,函数difference()用于求解集合A与B的差集, * 并将结果保存在集合A的单链表中。 * 例如,若集合A={5,10,20,15,25,30},集合B={5,15,35,25},完成计算后A={10,20,30}。*/ /************************************************************************/ #include <vector> #include...
#pragma once #include <Poco/SharedPtr.h> #include <Poco/ThreadPool.h> #include <Poco/Timespan.h> #include "util/Loggable.h" namespace BeeeOn { class HavingThreadPool : protected virtual Loggable { public: HavingThreadPool(); virtual ~HavingThreadPool(); void setMinThreads(int min); void setMaxThreads(int max);...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2002-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 CSSMANAGER_H #define CSSMANAGER_H #include "modules/pre...
//算法:DP //思路: //很容易推出:状态转移方程为: //a[i][j]=max(a[i+1][j],a[i+1][j+1])+a[i][j]; //则从最底层开始往上推 //推到顶,就得到了答案 #include<cstdio> #include<algorithm> using namespace std; int a[1010][1010],n; int main() { scanf("%d",&n); for(int i=0;i<n;i++) for(int j=0;j<i+1;j++) scanf("%d",&a[i][j]);//输入 for(int i...
// ili9225x driver interface implementation #ifndef _ili_9225_x_cc_ #define _ili_9225_x_cc_ // ili925x.cc file - ILITEK a-Si TFT LCD Single Chip Driver // #include <esfwxe/utils.h> #define ili9225xCmdWrite(regAddr, reg) \ esguiScreenBusWriteCmdB(hdrv->hbus, (regAddr)); \ esguiScreenBusWriteDataW(hdrv->h...
#pragma once class AI_Surface : public Hourglass::IAction { public: void LoadFromXML( tinyxml2::XMLElement* data ); void Init( Hourglass::Entity* entity ); IBehavior::Result Update( Hourglass::Entity* entity ); IBehavior* MakeCopy() const; private: StrID m_SurfaceEntityName; hg::Entity* m_SurfaceEntity; f...
#pragma once #include<list> #include<string> #include "dataEntry.h" class entryStats { public: entryStats(std::list<dataEntry*> &entries); ~entryStats(); void updateStats(dataEntry* newEntry, std::list<dataEntry*> &prevEntries); void resetStats(); double returnEffAvg(); int returnDistTotal(); int returnFills...
/* * Copyright (C) 2013 Tom Wong. All rights reserved. */ #ifndef __GT_USER_SERVER_H__ #define __GT_USER_SERVER_H__ #include "gtserver.h" GT_BEGIN_NAMESPACE class GtUserSession; class GtUserServerPrivate; class GT_SVCE_EXPORT GtUserServer : public GtServer { Q_OBJECT public: explicit GtUserServer(QObject...
template <typename T> inline Matrix<T,2,3>::Matrix() : data{ Vector<T,3>(1,0,0), Vector<T,3>(0,1,0) } { } template <typename T> inline Matrix<T,2,3>::Matrix(T m00, T m01, T m02, T m10, T m11, T m12) : data{ Vector<T,3>(m00,m01,m02), Vector<T,3>(m10,m11,m12) } { } template <typename T> inline Matrix<T,2,3>:...
#include <iostream> #include <stdlib.h> #include <time.h> #include <math.h> #include <string> #include "Debug.h" #include "Game.h" #include "Util.h" #include "math/Vec2.h" #include "math/Vec3.h" //#include "Sound.h" #include <AL/al.h> #include <AL/alc.h> using namespace NoHope; Game::Game(int width, int height) :w...
// // Created by dwb on 2019-07-18. // #include "Methods.h" //函数声明 inline void getInfo(); //函数定义 inline void getInfo(){ cout << "a sample C++ program" << endl; cout << "Hello C++!" << endl; } int add(int a ,int b = 200,int c = 300,int d = !400){ return a+b+c+d; } void Methods::test() { getInfo(); ...
// // Created by 송지원 on 2020/07/23. // #include <iostream> #include <algorithm> using namespace std; int alphaCnt [26]; char ch; string word; int wordLen; int maxVal; int maxIdx; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> word; wordLen = word.length(); for (int i=0; i<wordLen; i++)...
//merge sort implementation //keep dividing the array into halves //merge the sorted halves #include<iostream> using namespace std; void merge(int arr[],int l,int m,int r){ int n1=m-l+1; int n2=r-m; int L[n1]; int R[n2]; //copying fist half of array in L[] and other half in R[] int i=0; int j=0; int k...
// // Created by Alekhya on 4/28/2020. // #ifndef FINALPROJECT_TILESTATE_H #define FINALPROJECT_TILESTATE_H namespace mylibrary { enum class TileState { kEmpty, kMiss, kHit, kSink}; } // namespace mylibrary #endif // FINALPROJECT_TILESTATE_H
#pragma once #include "StdAfx.h" #include "BallPhysics.h" #include "GameLogic.h" class GameLogic; class BallPhysics; class RacketPhysics { protected: GameLogic* gameLogic; int playerId; Ogre::Vector3 pos; Ogre::Vector3 speed; Ogre::Quaternion ori; Ogre::Vector3 angVel; bool initialized; ...
#include <iostream> #include <stdlib.h> #include <math.h> using namespace std; //three points #define EXPECTED_ARG_COUNT 6 int main(const int argc, const char * argv[]) { int rc = 0; // Check argument count if (argc < EXPECTED_ARG_COUNT+1){ cerr << "Error: Expected " << EXPECTED_ARG_COUNT ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 1995-2010 Opera Software AS. All rights reserved. * * This file is part of the Opera web browser. It may not be distributed * under any circumstances. */ #ifndef __FILE_CHOOSER_FUN_H__ #define __FILE_CHOOSER_FUN_H__ #in...
#include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include "../util/Vec3f.h" #include "Chunk.h" #include "../util/simplexnoise.h" const Vec3f TILES[6] = { Vec3f(0.0f, 0.0f, 0.0f), Vec3f(1.0f, 1.0f, 1.0f), Vec3f(0.5f, 0.5f, 0.5f), Vec3f(1.0f, 0.0f, 0.0f), Vec3f(0.0f, 1.0f, 0.0f), Vec3f(0.0f, 0.0f, 1.0f)}; ...
#pragma once #include <glm/glm.hpp> class Sun { public: Sun(); Sun(glm::vec3 axis, float rot, float power); void Gui(); void SetAxis(glm::vec3 axis); void SetRotation(float rot); glm::vec3 GetDirection(); float GetPower(); private: glm::vec3 _direction; float _rot; glm::vec3 _axis; float _power; };
/* Реализуйте справочник столиц стран. На вход программе поступают следующие запросы: CHANGE_CAPITAL country new_capital — изменение столицы страны country на new_capital, либо добавление такой страны с такой столицей, если раньше её не было. RENAME old_country_name new_country_name — переименование страны из old_cou...
const int TriggerPin = 8; //Trig pin const int EchoPin = 9; //Echo pin void setup () { // initialize a distance sensor pinMode(TriggerPin, OUTPUT); // Trigger is an output pin pinMode(EchoPin, INPUT); // Echo is an input pin Serial.begin (9600); } void loop () { int noise = analogRead(A0); String outp...
// Outreachy: ceph - radosgw-admin application // Boost::program_options demo // Commands.h struct Command { int id; std::string cmd; std::string action; std::string text; }; std::ostream& operator<<(std::ostream& os, const Command& c) { return os << " " << c.cmd << " " << c.action << "\t\t" << c.text << ...
#include <cstdio> int main(){ int b, s; scanf("%d %d", &b, &s); printf("%d %d\n", s / b, b - (s % b)); return 0; }
#include <Wire.h> #include "MAX30100.h" #define REPORTING_PERIOD_MS 1000 // PulseOximeter is the higher level interface to the sensor // it offers: // * beat detection reporting // * heart rate calculation // * SpO2 (oxidation level) calculation MAX30100 pox; uint32_t tsLastReport = 0; // Callback (regis...
#include <iostream> int main(){ std::cout << "\n\nFILE: LALALA\n"; std::cout << "\n\nTreiner file\n"; return 0; }
/*C++ is different from C program by means of Classes and Object.*/ /*Class is used to specify the form of an object.*/ /*method are used for manipulating that data into neat packages.*/ /*Data and functions within a class are called members of the class.*/ /*Class will be used to define the blueprint for a data ty...
// // This file contains the C++ code from Program 8.9 of // "Data Structures and Algorithms // with Object-Oriented Design Patterns in C++" // by Bruno R. Preiss. // // Copyright (c) 1998 by Bruno R. Preiss, P.Eng. All rights reserved. // // http://www.pads.uwaterloo.ca/Bruno.Preiss/books/opus4/programs/...
#include "treeface/graphics/guts/HalfOutline.h" #include "treeface/math/Constants.h" #include "treeface/math/Mat2.h" using namespace treecore; namespace treeface { int HalfOutline::find_cross_from_head( const Vec2f& p1, const Vec2f& p2, Vec2f& p_cross, int step_limit ) const { treecore_assert( outline.size() > ...
// Copyright 2011 Yandex #include "ltr/scorers/composition_scorers/median_composition_scorer.h" namespace ltr { namespace composition { string MedianCompositionScorer::toString() const { std::stringstream str; std::fixed(str); str.precision(2); str << "Median composition of " << size() << " scorers:...
#ifndef PACKETS_ROOMS #define PACKETS_ROOMS #include <cstdint> #include "Packets/PacketBaseMessage.h" #pragma pack(push, 1) #include "Packets/PacketBaseMessage.h" struct BM_SC_GET_ROOMLIST : public TS_MESSAGE { static const uint16_t packetID = 2303; }; struct BM_SC_CREATE_ROOM : public TS_MESSAGE { char Name[24]; ...
#ifndef _GUARD_EEMP_H #define _GUARD_EEMP_H #include <ostream> #include <utility> #include <vector> #include "partial_perm.h" #include "perm_group.h" /** * @file eemp.h * @brief Definitions related to inverse semigroups of partial permutations. * * This file defines several auxiliary functions used behind the sc...
#include <stdio.h> #include <stdlib.h> int main() { int a, b, c, maior; printf("Digite tres numeros inteiros separados por espaco:"); scanf_s("%d %d %d", &a, &b, &c); maior = (a + b + abs(a - b)) / 2; maior = (maior + c + abs(maior - c)) / 2; printf("O maior numero eh %d.\n", maior); system("pause"); return 0;...
#ifndef __PATH_H__ #define __PATH_H__ #include <string> class Path { std::string shadersPath; std::string texturesPath; public: Path(std::string shaders_folder, std::string texture_folder) : shadersPath(shaders_folder), texturesPath(texture_folder) {} std::string sp(const std::string& name) { std::...
#pragma once #include "Application/Command.h" #include <vector> #include "glm/vec2.hpp" class DrawCommand : public Command { public: DrawCommand(std::vector<glm::vec2> locations, unsigned char* bitMap); ~DrawCommand(); virtual void Execute() override; virtual void Undo() override; private: std::vector<glm::vec...
///////////////////////////////////////////////////////////////////// // DepAnal.h - Determines depedancies based on #include // // // // Language: Visual C++ 2015 // // Platform: Lenovo Yoga, Windows ...
#ifndef LIGHTSOURCE_HPP #define LIGHTSOURCE_HPP #include "RT_Object.hpp" #include "RT_Vec3.hpp" class LightSource { protected: RT_Vec3 m_Position; // ambient RT_Vec3 m_Ka; // diffuse RT_Vec3 m_Kd; // specular RT_Vec3 m_Ks; public: LightSource(); ...
#include <bits/stdc++.h> #include <vector> #include<iostream> using namespace std; template<typename T> class statistic{ static int size; public: float Mean(vector<T> &vect); float median(vector< T> &vect); vector<T> mode(vector<T> &vect); }; template<typename T> float statistic<T>:: Mean(vector<T> &...
/* * MidiQueue.cpp * * Created on: Feb 4, 2019 * Author: juniper */ #include "MidiQueue.h" //#ifdef ON_BELA //#include <libpd/z_libpd.h> //extern "C" { //#include <libpd/s_stuff.h> //}; //#else //#include <z_libpd.h> //extern "C" { //#include <s_stuff.h> //}; //#endif MidiQueue* MidiQueue::instance_; boos...
// Created on: 1995-03-17 // Created by: Mister rmi // Copyright (c) 1995-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 Les...
// ========================================================================== // Wrapper code to interface g_Element // ========================================================================== // (C)opyright: // // Jochen Lang // SITE, University of Ottawa // 800 King Edward Ave. // Ottawa, On., K1N 6N5 // ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2006 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" #ifdef URL_FILTER #include "modules/conten...
/* Name: °´²ã´òÓ¡¶þ²æÊ÷ Copyright: Author: Xiao Dong, Xiao Date: 2019/8/21 15:22:31 Description: TODO δ֪´íÎó */ #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 Solutio...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; struct Stat { int d, s; Stat(){} Stat(int d, int s):d(d),s(s){} }; bool operator<(const Stat &r, const Stat &s) { return r.d > s.d; } int n, S; int s[N], a[N], b[N], d[N]; Stat stats[N]; long long pres[N]; long long cp(long long len) { long ...
#include <iostream> //standard input-output stream using namespace std; //standard namespace. cout, cin and a lot of other things are defined in it. int main() { int num1, num2, num3; int smallest, largest; // declaration cout << "Input three different integers: "; // prompt cin >> num1 >> num2 >> nu...
#include <iostream> int toPal(int n, bool even); bool base2Pal(int n); int main() { int sum = 0; for (int n = 0; n < 1000; n++) { int pal1 = toPal(n, false); int pal2 = toPal(n, true); if (base2Pal(pal1)) sum += pal1; if (base2Pal(pal2)) sum += pal2; } std::cout << sum << "\n"; } int toPal(int n, b...
#include "aeMath.h" namespace aeEngineSDK { aeRay::aeRay() { } aeRay::aeRay(const aeRay & A) { *this = A; } aeRay::~aeRay() { } }
#include <iostream> #include <random> #include <utility> #include <vector> #include <ctime> #include <fstream> #include <list> using namespace std; int seed; mt19937 getRand(seed); struct node { string key, value; node *prev; node *next; node(string _key, string _value) { key = move(_key); ...
#pragma once namespace game { class Player; } namespace jsplayer { JSBool createPlayerObject(JSContext* cx, JSObject* parent, const char* name, game::Player* player); }
/*Boost asio implementation (compilation optimization).*/ #include "cc/asio/boost_asio_utils.h" #include <boost/asio/impl/src.hpp>
#pragma once #include "CritlSec.h" #define BUFFER_SIZE 1024 #define QUEUE_SIZE 10240000 class Element { public: Element(int nIndex, double lfRatio): m_nElemIndex(nIndex), m_lfRatio(lfRatio) { } ~Element() { } int m_nElemIndex = 0; double m_lfRatio = 0; }; using elemntList = vector<Element>; class C...
// Client Widget // // Copyright (C) 2008 // Center for Perceptual Systems // University of Texas at Austin // // jsp Mon Aug 4 14:38:43 CDT 2008 #ifndef CLIENT_WIDGET_H #define CLIENT_WIDGET_H #include <QAction> #include <QComboBox> #include <QDebug> #include <QHBoxLayout> #include <QIntValidator> #include <QLabel>...
// // main.cpp // 2017.2.26.15.25.1.7 // // Created by Thai Cao Ngoc on 26/2/17. // Copyright © 2017 Thai Cao Ngoc. All rights reserved. // #include <iostream> #include <cstdlib> #include <ctime> #include <iomanip> class Rotate { public: void rotate (int** matrix, size_t N) { for (size_t layer = 0; layer < ...
//airlineTicket.h #include<string> using namespace std; class airlineTicket { public: airlineTicket(); ~airlineTicket(); int calculatePrinceInDollars(); string getPassengerName(); void setPassengerName(string inName); int getNumberOfMiles(); void setNumberOfMiles(int inMiles); bool ...
//对 回忆一下自己的做题思路(最近每做一题就把这个粘过去) //1.先理解题 //2.确定解题思路(选择数据结构算法什么的) 确定能解决正常情况,也不用考虑太多复杂度 //3.2达到之后, 开始考虑各种解决可能遇到的奇怪情况 然后看看有没有复杂度更低的思路 //看完题,能想出朴素算法 有个大概思路 但是不能保证不超时 然后看一看原来的代码吧 //突然发现还是按照最坏情况申请内存比较好,省了好多麻烦 //发现原来的代码也挺朴素的 简单的思路,但是45分了 思考一下能不能做出一点改进呢. //突然看到hash,想起了把字母全加起来判等,不过不知道能不能减少时间.那就先试试吧. //果然 思考多一点 速度...
#ifndef __CTRL_CLSEDITOR_H #define __CTRL_CLSEDITOR_H #include "CtrlWindowBase.h" //#include "ModelClsEditor.h" //#include "IViewBrowser.h" namespace wh { class IViewClsEditor : public IViewWindow { public: IViewClsEditor(wxWindow* parent) { } IViewClsEditor(const std::shared_ptr<IViewWindow>& parent) :IView...
#include <cstdio> int main(){ char cha[4] = {'W', 'T', 'L'}; double odds[3][3]; double win[3]; char bet[4]; for(int i = 0; i < 3; i++){ int maxi = 0; double maxo = -1; for(int j = 0; j < 3; j++){ scanf("%lf", &odds[i][j]); if(odds[i][j] > maxo){ ...
#ifndef ADDONS_DOMAINS_MATRIX_FIXTURES_HPP #define ADDONS_DOMAINS_MATRIX_FIXTURES_HPP namespace testing { namespace boolmatrix { using namespace boost::numeric::ublas; using namespace wali::domains; struct RandomMatrix1_3x3 { BoolMatrix::BackingMatrix mat; RandomMatrix1_3x3() : mat(3,3) { ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2005 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #ifndef MODULES_IMG_IMG_MODULE_H #define MODULES_IMG_IMG_MODULE_H...
#pragma once #include "transform.h" #include "iovector.h" #include "mask.h" namespace hdd::gamma { class Data { public: Data(const RawData& rawData); Data(const RawData& rawData, const std::vector<FormatType>& columnType); Data(const Data& data, uint32_t startIndex, uint32_t endInd...
#include <iostream> #include <fstream> #include <bitset> #include <map> #include <cmath> #include <iomanip> #include <string> #include <algorithm> using namespace std; int cache_size[4]={4,16,64,256}; //kB cache size int block_size[5]={16,32,64,128,256}; //B block size string TXT[2]={"DCACHE","ICACHE"}; string ext="....
#include <bits/stdc++.h> using namespace std; #define TESTC "" #define PROBLEM "10878" #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) int main(int argc, char const *argv[]) { #ifdef DBG freopen("uva" PROBLEM TESTC ".in", "r", stdin); freopen("uva" PROBLEM ".out", "w", stdout); #endif string str;...
#include "..\include\gmath.hpp" using namespace gmath; vec4::vec4(const float& x, const float& y, const float& z, const float& w): data(new float[4]{ x, y, z, w}) { } vec4::vec4(const __m128& data): data(new float[4]) { _mm_store_ps(this->data, data); } vec4::vec4(const vec4& other): data(new float[4]) { data[...
#pragma once #include <map> #include <SFML/Graphics.hpp> #include <SFML/Audio.hpp> #include <SFML/System/Vector2.hpp> #include "Animation.hpp" class Player; class Weapon { public: virtual ~Weapon(); const std::string &GetAmmoType() const; int GetAmmo() const; int GetMaxAmmo() const; void Tick(float dt); vo...
#include "TableTimer.h" #include "IProcess.h" #include "Table.h" #include "Logger.h" #include "Configure.h" #include "HallManager.h" #include "UdpManager.h" #include "LogServerConnect.h" //====================CTimer_Handler==================================// int CTimer_Handler::ProcessOnTimerOut() { if(handler) re...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2011 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** ** CREATED DG-271198 ** DESCRIPTION Win message hooks */ #incl...
#include <iostream> using namespace std; int main() { // your code goes here int t; cin>>t; while(t--) { int g; cin>>g; while(g--) { int i,n,q,k,h_count=0,t_count=0; cin>>i>>n>>q; if (n%2 == 0) { cout<<n/2<<endl; continue; } else { ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-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 POSIX_MUTEX_H #define POSIX_MUTEX_H __FILE__ # ifdef POSIX...
#ifndef GALAXY_H #define GALAXY_H #include <QVector> #include "quadrant.h" class Galaxy { private: QVector<QVector<Quadrant*>> matrix; int height; int width; int quadrantSize; public: Galaxy(); int getHeight() const; int getWidth() const; int getQuadrantSize() const; void setQua...
/* * @lc app=leetcode.cn id=174 lang=cpp * * [174] 地下城游戏 */ // @lc code=start #include<iostream> #include<algorithm> #include<vector> using namespace std; class Solution { public: int calculateMinimumHP(vector<vector<int>>& dungeon) { int n = dungeon.size(); int m = dungeon[0].size(); ...
// // Path.cpp // yearLong // // Created by Surya on 01/04/13. // // #include "Path.h" Path::Path(){ } Path::Path(int x, int y, int x1 ,int y1){ radius = 5; start = ofVec2f(x,y); end = ofVec2f(x1,y1); //end.he } void Path::display(){ ofSetColor(255); ofLine(start.x, start.y, end.x,...
#include <bits/stdc++.h> #define isNum(x) ('0'<=x&&x<='9') using namespace std; const int maxn = 200010; int read(); int n, ans, a[maxn], val[maxn], pos[maxn]; bool dis[maxn]; int main() { memset(val, 0, sizeof(val)); n = read(); for (int i = 1; i <= n; i++) a[i] = read(); ans = n; int i, j, k; for ...
/* Name: ¾ØÕóÖеÄ·¾¶ Copyright: Author: Hill Bamboo Date: 2019/9/7 18:54:16 Description: */ #include <bits/stdc++.h> using namespace std; const int maxc = 1e4 + 10; const int maxr = 1e4 + 10; int dx[4] = {0, 1, 0, -1}; int dy[4] = {1, 0, -1, 0}; bool vis[maxr][maxc]; char* t; int r, c; void print_vis() { for (int...
#include <iostream> using namespace std; int main() { std::ios::sync_with_stdio(false); int T,E,N,ans; cin>>T; while(T>0) { cin>>E>>N; ans=(E+N)/3; if(E<ans) ans=E; else if(N<ans) ans=N; cout<<ans<<endl; T--; } return 0; }
#include <bits/stdc++.h> using namespace std; #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) #define MAXN 1000 #define INF 0x3f3f3f3f #define DEVIATION 0.00000005 typedef long long LL; LL table[310][MAXN+10]; int main(int argc, char const *argv[]) { memset(table, 0, sizeof(table)); table[0][0] = 1...
// Created on: 1991-02-26 // Created by: Isabelle GRIGNON // Copyright (c) 1991-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...
// MarsColonisation.cpp : main project file. #include "Base.hpp" #include "Graph.hpp" #include "Neighbourhood_generator.hpp" #include "Edge.hpp" #include "Point.hpp" #include "SA.hpp" #include "Solution.hpp" #include "Validator.hpp" #include "MainForm.h" #include <cstdlib> #include <ctime> #include <Windows.h> #includ...
#include <iostream> using namespace std; class Student { private: int age, standard; string last_name, first_name; public: void to_string(int age, string fn, string ln, int standard) { cout << age << endl; cout << ln << ", " << fn << endl; cout << standard << endl; cout << "\n";...
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <functional> #include <queue> #include <string> #include <cstring> #include <numeric> #include <cstdlib> #include <cmath> using namespace std; typedef long long ll; #define INF 10e10 #define rep(i,n) for(int i=0; i<n; i++) #define r...
/******************************************************************************** ** Form generated from reading UI file 'accountcreation.ui' ** ** Created by: Qt User Interface Compiler version 5.13.2 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ****************************...
// // Created by dylan on 10-3-2020. // Cpp file containing the function definitons for the drawable class // #include "drawable.hpp" drawable::drawable(sf::Vector2f position, sf::Vector2f size, sf::Color Color ): position(position), size(size), Color(Color) {} //Jump function that instantly...
#ifndef ENTITY_H #define ENTITY_H #include "scenenode.h" class Entity : public SceneNode { public: explicit Entity(int hitpoints); void setVelocity (sf::Vector2f velocity); void setVelocity (float vx, float vy); void accelerate (sf::Vector2f velocity); voi...
#include<iostream> #define FOR(i,n) for(i=0;i<n;i++) using namespace std; long C[1001]; int main() { long i,t,n,ans,sum; cin>>t; while(t--) { cin>>n; FOR(i,n) cin>>C[i]; sum=0;ans=0; for(i=0;i<n;i++) { sum+=C[i]; if(i+1<n) { if(sum<C[i+1])ans++; else sum-=C[i]; ...
#ifndef _AK_CGUIWINDOW_H_ #define _AK_CGUIWINDOW_H_ #include "cocos2d.h" #include "Ak_Transform.h" class Ak_CGUIWindow : public Ak_CTransform { public: Ak_CGUIWindow(); virtual ~Ak_CGUIWindow(); public: void Create(unsigned int id, bool isRootWindow = false); void Update(float delta); void Destroy(); public: ...
/* * 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 <folly/Optional.h> #include <quic/QuicException.h> #include <quic/congestion_control/CongestionController....
#ifndef _BAG_H_ #define _BAG_H_ #include <iostream> #include <initializer_list> #include <stdexcept> template <typename Item> class Bag { private: int sz; int capacity; Item *items; public: Bag() : sz(0), capacity(4), items(new Item[4]) {} Bag(int c) : sz(0), capacity(c), items(new Item[c]) {} Bag(const B...
#pragma once #include <stddef.h> #include <utility> #include "triangulation.hpp" namespace space { template <typename Func, typename I> void Interpolate(Func &&f, I *root) { for (auto node : root->Bfs()) { // Create dual space basis. StaticVector<std::pair<std::pair<double, double>, double>, 3> eval_space...
#include <iostream> using namespace std; void changeArgument(int x) { x = x + 5; } int main() { int y = 4; changeArgument( y ); cout << y; // still prints 4 return 0; }
class Solution { public: bool isRectangleCover(vector<vector<int>>& rectangles) { unordered_set<string> se; int x1 = INT_MAX, y1 = INT_MAX, x2 = INT_MIN, y2 = INT_MIN, area = 0; for(auto rect: rectangles){ x1 = min(rect[0], x1); y1 = min(rect[1], y1); x2 ...
// Tina Greenfield /* This program is designed to calculate a concrete bridge's surface temperature. It is initialized with RWIS bridge and air temperatures, all else from MM5 or some other weather model. MM5 supplies atmospheric conditions at regular intervals, which are used to force the bridge tempe...
#include <assert.h> #include <algorithm> #include <climits> #include <functional> #include <iostream> #include <numeric> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #define ll long long using namespace std; int n; struct Solution { void solve() { int res = 0; vecto...
/******************************************************************************** ** Form generated from reading UI file 'mainwindow.ui' ** ** Created by: Qt User Interface Compiler version 5.12.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ***************************************...