text
stringlengths
8
6.88M
#include "Clyde.h" Clyde::Clyde() { points = 10; dead = false; lastAnimationPowerUP = POWER_UP_INFO::X_GREY_2_SPRITE; direction = CLYDE_INITIAL_INFO::DIRECTION; lastTime = clock(); timeDown = 0.15f; } void Clyde::Update(bool* _keys) { if (!dead) { //input control if (_keys[(int)InputKey::K_LEFT]) { d...
#pragma once #include "utils/ptts.hpp" #include "proto/config_child.pb.h" using namespace std; namespace pc = proto::config; namespace nora { namespace config { using child_phase_ptts = ptts<pc::child_phase>; child_phase_ptts& child_phase_ptts_instance(); void...
#ifndef MUD_H #define MUD_H #include <QByteArray> class MUD { public: MUD(); ~MUD(); virtual bool onClientInput(QByteArray aInput) = 0; virtual bool onLineReceived(QByteArray aLine) = 0; virtual bool onColorFragment(QByteArray aColor, QByteArray aText) = 0; }; #endif // MUD_H
#include "stdafx.h" #include "Tree.h" size_t GetHeight(Node *node) { size_t size = 0; if (node != nullptr) { size = node->m_height; } return size; } size_t CheckBalanceFactor(Node *node) { size_t leftValue = ((node->m_leftLink != nullptr) ? GetHeight(node->m_leftLink) : 0); size_t rightValue = ((node->m_righ...
int outpin = 8; float kiloh; long period; bool ones = false; long lastTime = 0; long now; // Timer output const byte CLOCKOUT = 9; // Only for Arduino Uno #define NOP __asm__ __volatile__ ("nop\n\t") // Output strings //String bitstring = "0110100001100101011011000110110001101111"; // Hello //String bitstring = "010...
#include <iostream> using namespace std; using ll = long long; int main() { ll N, M; cin >> N >> M; ll mi = max(0LL, N - M * 2); ll ma = N; while (true) { ll c = N - ma; if (M <= c * (c - 1) / 2) break; --ma; } cout << mi << " " << ma << endl; return 0; }
#include "hydroponics/hydroponicsai.hpp" #include "hydroponics/hydroponics_table.hpp" #include "hydroponics/hydroponicsjobs.hpp" #include "components/room.hpp" #include "job/jobprovider.hpp" #include "utilities/assert_cast.hpp" using namespace ai; using namespace ecs; namespace hydroponics { AI::timer_t Hydropon...
#include <bits/stdc++.h> using namespace std; const int inf=2012345678; long long dist[10][10]; char b[2010101]; int main(){ scanf("%s",b); int n=strlen(b); for(int x=0;x<10;x++)for(int y=0;y<10;y++){ for(int i=0;i<10;i++)for(int j=0;j<10;j++)dist[i][j]=inf; for(int i=0;i<10;i++)dist[i][(i+x)%10]=dist[i][(i+y)%1...
#include <bits/stdc++.h> using namespace std; string ltrim(const string &); string rtrim(const string &); vector<string> split(const string &); /* * Complete the 'distanceTraversed' function below. * * The function is expected to return an INTEGER. * The function accepts 2D_INTEGER_ARRAY lot as parameter. */ ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup" -*- * * Copyright (C) Opera Software ASA 1999-2004 */ #include "core/pch.h" #include "modules/ecmascript/carakan/src/es_pch.h" #include "modules/ecmascript/carakan/src/builtins/es_regexp_builtins.h" #include "mod...
#pragma once #include <nlohmann/json.hpp> #include <string> using namespace std; using json = nlohmann::json; double toDouble(const json &);
/* Copyright (c) 2018-2019, tevador <tevador@gmail.com> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditio...
// Created on: 1995-10-17 // Created by: Laurent BOURESCHE // 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 ...
#ifndef APPLICATION_BASECMD_H #define APPLICATION_BASECMD_H #include <utility> #include "CallbacksHolder/CallbacksHolder.h" // Abstract command class BaseCmd { public: virtual ~BaseCmd() = default; BaseCmd(int numRequest, const std::optional<std::string>& error, const std::string& body); /...
#include <chrono> #include <cstdio> #include <cstdlib> #include <iostream> #include <memory> #include <string> #include <thread> #include <unistd.h> #include "odb/client/db-client-impl-data.hh" #include "odb/client/tcp-data-client.hh" #include "odb/mess/db-client.hh" #include "odb/mess/simple-cli-client.hh" void wait...
/* * drinkmachine.h * */ #ifndef DRINKMACHINE_H_ #define DRINKMACHINE_H_ // put any includes here #include <iostream> #include <fstream> #include <iomanip> //put constant structures const unsigned int MAX_DRINKS = 20; // put your structures here struct DrinkItem { unsigned int id; std::string name; d...
#include <iostream> using namespace std; int n; int main(){ cout<<"masukan angka : "; cin>>n; for(int i = 1; i <= n; i++){ if((i%3!=0) && (i%5!=0)) { cout<<i<<endl; } if(i%3==0) { cout<<"upin"<<endl; } if(i%5==0) { cout<<"ipin"<<endl; } } return 0; }
/* C --> C++ 변경, 개선점 <Data 정의 값 추가> #define TRUE 1 --> true #define FALSE 0 --> false 0 --> NULL (void *)0 --> NULL(C) --> nullptr(C++) <Data Type 추가> bool : 논리 타입 --> true / false 명령어 를 저장하는 타입 <참조 타입 추가> type * --> 동적 할당 / C style string 에 사용(char [])에 사용 배열형 --> type var[] 변수 참조형 --> reference type ---> ( type &...
//**************************************************************************** // // Copyright (C) 1997-2007 3DV SYSTEMS LTD. // All rights reserved. // // Module Name: DepthCamera.cpp // Date: 1-9-2007 // Description: Implementation file for CDepthCamera class, which uses // the DMachine SDK to cont...
#include<cstdio> #include<cstring> #define MAXN 10010 using namespace std; /* 函数extend[i] = |T与T(i,m)的最长公共前缀|,这里2<=i<=m。 函数Bi = |T与S(i,n)的最长公共前缀|,这里1<=i<=n。 */ struct ExtKmp{ //start from 1 const char *t, *s; int *b; int extend[MAXN]; int m,n; void cal(char *_t, int _m, ch...
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <queue> #include <set> using namespace std; struct ListNode{ int val; ListNode* next; ListNode(int x):val(x),next(NULL){} }; void printLL(ListNode* head){ ListNode* temp = head; ...
/* * The Deploy Implementation * Nana C++ Library(http://www.nanapro.org) * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) * * 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) * * @file: _/Deploy.hpp * ...
#include <cmath> //for log, sqrt and erf #include <iostream> #include "EuropeanOption.h" #include "MarketData.h" #include "Payoff.h" #include "Pricer.h" class SimpleMarketData : public MarketData{ double discountFactorTo(double time) const override { double rate = 0.03; return exp(-rate*time); } d...
#pragma once /* * Lanq(Lan Quick) * Solodov A. N. (hotSAN) * 2016 * LqIpRaw - . */ #include "LqOs.h" #include "LqPtdArr.hpp" #include "LqSbuf.h" #pragma pack(push) #pragma pack(1) template<typename NumT, bool ByteOrderBigEndiean> class LqByteOrderNum { NumT val; public: typedef NumT Type; operator Num...
#include <math.h> #include "GameInfo.h" #include "glut.h" #include "Bullet.h" #include "Player.h" #include "MouseClicked.h" MouseClicked* Bullet::getmouse() { return MouseClicked::Instance(); } void Bullet::drawBullet() { //마우스 좌측 버튼 클릭시 if (getmouse()->getisShot()) { isShotStart = true; ...
#include <iostream> #include <cstring> using namespace std; long long arr[21]; long long check[21]; long long a,b,count=0; void dfs(long long t,long long total){ if(total==b-arr[0]){ count++; } for(long long i=t;i<a;i++){ if(check[i]) continue; check[i]=1; dfs(i,total+arr[i])...
#pragma once #include "GameNode.h" // 에너미 부모 클래스 #define FIRECOUNT 1000 enum Direction { DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_DOWN, }; class Enemy : public GameNode { private: Image * _image; RECT _rc; POINT _pos; float _speed; // 프레임 이미지를 돌리기 위한 변수 int _count; int _currentFrameX; int _currentFra...
#include "SomeOfEverything.h" #include "PxPhysicsAPI.h" #include "NvBounds3.h" #include <vector> #include <stdint.h> #include <stdlib.h> #include <math.h> #pragma warning(disable:4100) #define NUMBER_OF_MATERIALS 2 #define NUMBER_OF_SHAPES 2 typedef std::vector< physx::PxMaterial *> MaterialVector; typedef std::vec...
#include "CppUnitTest.h" #include "CppUnitTestAssert.h" #include "../3XD_Lib/geometry/computus.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Z_3D_LIB_FOR_EGE; namespace My3D_Lib_for_ege_UnitTest { TEST_CLASS(_computus_test) { typedef _affine_vector DOT; typedef _line LINE; ...
/* * Copyright 2016 Freeman Zhang <zhanggyb@gmail.com> * * 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 applic...
#include <string> #include "../headers/FormalNode.hpp" #include "../headers/ClassNode.hpp" #include "../headers/AstNode.hpp" using namespace std; FormalNode::FormalNode() = default; string FormalNode::getType() { return type; } void FormalNode::setName(string name) { this->name = name; this->value = name; }...
#include <iostream> using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; void deleteNode(struct ListNode* node) { if (node->next->next != NULL) { node->next = node->next->next; } else if(node->next->next == NULL) { ...
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, instal...
#include <vector> #include <string> #include <iostream> #include <fstream> #include <sstream> #include <list> #include <algorithm> #include <sstream> #include <set> #include <cmath> #include <map> #include <stack> #include <queue> #include <cstdio> #include <cstdlib> #include <cstring> #include <numeric> #include <bits...
#include "ast_node.h" #include "parser.hpp" #include <iostream> #include <map> #include <list> extern AST_Expression *root; extern int yyparse(); // Maps identifier-names to a list of nodes where they occur. typedef std::map<std::string, std::list<AST_Identifier*> > IdMap; // Maps identifier-names to boolean values, ...
// // Created by tudom on 2019-12-28. // #ifdef _WIN32 # define DUMMY_API __declspec(dllexport) # define DUMMY_LOCAL #else # define DUMMY_API __attribute__((visibility("default"))) # define DUMMY_LOCAL __attribute__((visibility("hidden"))) #endif int DUMMY_API square(int i) { return i * i; } void DUMMY_API p...
#include <ionir/passes/type_system/type_check_pass.h> #include <ionir/misc/bootstrap.h> #include <ionir/syntax/ast_builder.h> #include <ionir/test/const.h> #include "../pch.h" using namespace ionir; // TODO: Separate into multiple tests. TEST(TypeCheckPassTest, Run) { PassManager passManager = PassManager(); ...
#include "GMOnlineImp.h" #include <sys/time.h> #include <sys/resource.h> #include "util/tc_http.h" #include "sig_check.h" #include "util/tc_md5.h" #include "util/tc_logger.h" #include "util/tc_base64.h" #include "CommLogic.h" using namespace MINIAPR; //const string g_appKey = "KfvpPibrLiA4sj41&"; taf::Servant* g_p...
#include <ranges> #include <vector> #include <algorithm> #include <iostream> export module range_exam; namespace fibo::ranges { struct Foo { std::pmr::string name; unsigned age; }; export void exam1() { std::pmr::vector<Foo> vec{ {"a", 1}, {"b", 2}, {"c", 3} }; std::ranges::sort(vec, std::greater{}, &Fo...
/* * TimerManager.h * * Created on: Jun 11, 2017 * Author: root */ #ifndef TIMER_TIMERMANAGER_H_ #define TIMER_TIMERMANAGER_H_ #include "Timer.h" #include <list> #include "../Common.h" #include "../Thread/Task.h" #include "TimerBase.h" using namespace std; namespace CommBaseOut { class Slot { public: v...
//#ifndef INT_LINKED_LIST //#define INT_LINKED_LIST class IntNode { public: int info; IntNode *next; /* IntNode() { next = 0; } */ IntNode(int el, IntNode *ptr = 0) { info = el; next = ptr; } }; class IntSLList { public: IntSLList() { head = tail = 0; } ~IntSLList...
/* XMRig * Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com> * * 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 * ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** ** Magnus Gasslander */ #include "core/pch.h" #if defined SUPPO...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2008 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** */ #include "core/pch.h" #ifdef _EXTERNAL_SSL_SUPPORT_ #incl...
#include <bits/stdc++.h> using namespace std; ofstream fout ("blocks.out"); ifstream fin ("blocks.in"); #define For(x) for(int i = 0; i < x; i++) #define Forv(vector) for(auto& j : vector) int count(string s, char c) { int count = 0; for (int i = 0; i < s.size(); i++) if (s[i] == c) count++; return count; }...
#include<iostream> #include<cstring> #define FOR0(i,n) for(i=0;i<n;i++) #define FOR(i,j,n) for(i=j;i<n;i++) #define FORD(i,j,k) for(i=j;i>=k;i--) #define MAX(a,b) (a)>(b)?(a):(b) #define MIN(a,b) (a)<(b)?(a):(b) #define num 1000000 using namespace std; long dp[105][105]; long count(int K,int N) { if(K==0&&...
#ifndef MAINUI_H #define MAINUI_H #include <TaskerUIMainWindowQWidget.h> #include <memory> /** * @brief The MainUI class */ class MainUI { private: MainUI(); static CommStatsQWidget *Instance; public: static CommStatsQWidget *getInstance(); ~MainUI(); public slots: static void saveTaskerStateSlo...
#include "gamemanager.h" #include "logincontroller.h" RRG::GameManager::GameManager() { } RRG::GameManager::~GameManager() { } bool RRG::GameManager::Initialize() { if (!_initialized) { _initialized = true; } return _initialized; } void RRG::GameManager::Update(double time) { //RRG::LoginCo...
/* -*- Mode: c++; tab-width: 4; 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. * * Espen Sand */ #include "core/pch.h" #include "ipcmessageparser.h" #include "module...
//====================================================================== #include <upl/st_code.hpp> //====================================================================== namespace UPL { namespace Type { //====================================================================== #define TAG_INFO_STRUCT(v,e,s,b0,b...
#include <bits/stdc++.h> using namespace std; #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) #define MAXN 100 int main(int argc, char const *argv[]) { string str; while( getline(cin,str) ){ list <char> text; auto Iter = text.begin(); for(int i = 0 ; i < str.size() ; i++ ){ if( str[i] == '...
#include "msg_0x11_usebed_stc.h" namespace MC { namespace Protocol { namespace Msg { UseBed::UseBed() { _pf_packetId = static_cast<int8_t>(0x11); _pf_initialized = false; } UseBed::UseBed(int32_t _entityId, int8_t _unknown, int32_t _x, int8_t _y, int32_t _z) : _pf_entityId(_entityId) , _pf_unknown(_unknown) , _...
// Parses a sequence of texts into separate lines. Client defines // the delimiter. Parsed output is returned as a vector of strings. #ifndef UTILS_FILE_FILEWRITER_H_ #define UTILS_FILE_FILEWRITER_H_ #include <string> #include "utils/error_handling/status.h" namespace utils { namespace file { namespace filewriter ...
#ifndef _TRANSITION_ #define _TRANSITION_ #include <SFML/Graphics.hpp> class State; typedef struct TransitionState { sf::Time time = sf::Time::Zero; sf::Vector2f position = sf::Vector2f(0, 0); //sf::Vector2f scale = sf::Vector2f( 0, 0 ); //sf::Vector2f rotation = sf::Vector2f( 0, 0 ); sf::Color color = sf::C...
#include <iostream> #pragma comment(linker, "/entry:print") int print() { printf("hello world\n"); return 0; } int main(void) { return 0; }
/* ***** BEGIN LICENSE BLOCK ***** * FW4SPL - Copyright (C) IRCAD, 2012-2013. * Distributed under the terms of the GNU Lesser General Public License (LGPL) as * published by the Free Software Foundation. * ****** END LICENSE BLOCK ****** */ #ifndef _GDCMIO_DICOMDISTANCE_HPP_ #define _GDCMIO_DICOMDISTANCE_HPP_ #in...
/*==================================================================== Copyright(c) 2018 Adam Rankin 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 limitati...
#ifndef RSA_H_INCLUDED #define RSA_H_INCLUDED #include <iostream> using namespace std; class RSA { private: int clavePrivada1; public: int clavePublica1; int nyYa; void generadorClaves(); RSA(); void mostrarDatos(); int cifrado(int, int, string); string descifrado(int)...
/* * Copyright 2017, Victor van der Veen * * 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 a...
// Problem No. 2 => Find the repeating and the missing #include <bits/stdc++.h> using namespace std; void printTwoElements(int arr[], int size) { int i; cout << " The repeating element is "; for (i = 0; i < size; i++) { if (arr[abs(arr[i]) - 1] > 0) arr[abs(arr[i]) - 1] = -arr[abs...
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); ShowWindow(GetConsoleWindow(), SW_HIDE); //Скроем консоль на всякий случай QApplication a(argc, argv); MainWindow w; system("chcp 1251"); w.show...
// Created on: 1998-08-26 // Created by: Julia GERASIMOVA // Copyright (c) 1998-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...
#ifndef ROUTE_H #define ROUTE_H #include <QString> namespace wpp { namespace qt { class Route { private: QString m_name; QString m_method; QString m_host; QString m_pattern; public: Route() {} //default-constructor needed by QMap, create an INVALID Route Route(const QString& name, const QString method, const...
#ifndef ARISTA_H #define ARISTA_H #include <QString> #include <QDebug> class Arista{ public: QString origen; QString destino; double costo, km, min; bool activo; Arista(QString pOrigen, QString pDestino, bool pActivo, double pCosto, double pKm, double pMin){ this->origen = pOrigen; ...
/* Name: Copyright: Author: Xiaodong Xiao Date: 2019/10/30 21:31:55 Description: */ #include <bits/stdc++.h> using namespace std; int main() { return 0; }
#include "object\\DiffObject.h" #include "Reference.h" DiffObject::DiffObject(Vector2 vec) : Object(vec), accel(Ref::VectorZero) { alpha = 0, fade = 24; shouldRender = true; } Vector2 DiffObject::GetAccel() const { return accel; } void DiffObject::SetAlpha(int alphaIn) { alpha = alphaIn; } void DiffObject::Upda...
#include"stdio.h" #include"conio.h" void main(void) { int a,b; clrscr(); for(a=1; b<=50; b++) { b=a*a; printf("%d %d\n",a,b); } getch(); }
void f() { throw 1; }
/* ========================================== Copyright (c) 2016-2018 Dynamic_Static Patrick Purcell Licensed under the MIT license http://opensource.org/licenses/MIT ========================================== */ #pragma once #include "Dynamic_Static/Core/Defines.hpp" #include "Dynamic_Static/Core/St...
#ifndef UTILS_H #define UTILS_H #include "../includes.h" #include <QFileInfo> void showColorModel(uchar* &C1,uchar* &C2,uchar* &C3,int rows,int cols,cv::String name); void showColorImage(uchar* &R,uchar* &G,uchar* &B,int rows,int cols,cv::String name); void abrir_imagen (uchar* &R,uchar* &G,uchar* &B,int &rows...
/* -*-mode:c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ #include "engine_gg.hh" #include <stdexcept> #include "response.hh" #include "net/http_response.hh" #include "thunk/ggutils.hh" #include "util/optional.hh" #include "util/system_runner.hh" #include "util/units.hh" #include "util/base64.hh"...
#include <corridor_navigation/corridor_navigation.h> #include <ros/ros.h> CorridorNavigation::CorridorNavigation():desired_direction_(0), recovery_direction_threshold_(1.0), correction_direction_threshold_(0.06), desired_distance_(0), goal_type_(-1) { } CorridorNavigation::~CorridorNavigation() { } void CorridorNav...
////////////////////////////////////////////////////////////////////// ///Copyright (C) 2011-2012 Benjamin Quach // //This file is part of the "Lost Horizons" video game demo // //"Lost Horizons" is free software: you can redistribute it and/or modify //it under the terms of the GNU General Public License as published ...
#include "stdafx.h" #include "Monster.h" #include "MonsterAction.h" #include "MonsterEffect.h" #include "../PythonBridge/PythonBridge.h" #include "../../Engine/character/CharacterController.h" #include "../GameData.h" //#include "MonsterAI.h" #include "MonsterActionList.h" #include "MonsterMarker.h" #include "Action...
#include <iostream> #include <queue> #include <climits> using namespace std; // STACK USING 2 QUEUES class StackUsingDoubleQueue { queue<int> q1, q2; int top; public: void push(int); int pop(); int peek() { return top; } }; void StackUsingDoubleQueue ::push(int x) { // Complexit...
#include "msg_0x69_updatewindowproperty_stc.h" namespace MC { namespace Protocol { namespace Msg { UpdateWindowProperty::UpdateWindowProperty() { _pf_packetId = static_cast<int8_t>(0x69); _pf_initialized = false; } UpdateWindowProperty::UpdateWindowProperty(int8_t _windowId, int16_t _property, int16_t _value) : _...
#ifndef __ARRAY2D_H__ #define __ARRAY2D_H__ #include <Array.h> template <class T> class Array2D { protected: unsigned int numberOfRows; unsigned int numberOfColumns; Array<T> array; public: class Row { Array2D& array2D; unsigned int const row; ...
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; /* Expects a SORTED vector */ int calcUnfairness(int K, vector<int> &test){ int min = -1; vector<int>::iterator iter; for(iter = test.begin(); iter != test.end()-K; iter++) { // cout << *ite...
#include "LISW_MPI.hpp" #include "wignerSymbols.h" #include "Integrator.hpp" #include "Log.hpp" #include <fstream> #include <math.h> #include <cmath> Bispectrum_LISW::Bispectrum_LISW(AnalysisInterface* analysis) : interpolate_large(false), ql_interpolated(false) { log<LOG_BASIC>("... Beginning ...
#ifndef TREEFACE_VISUAL_OBJECT_H #define TREEFACE_VISUAL_OBJECT_H #include "treeface/scene/SceneObject.h" #include <treecore/HashMap.h> #include <treecore/RefCountObject.h> namespace treecore { class Identifier; class Result; class var; } // namespace treecore class TestFramework; namespace treeface { class Scene...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup" -*- * * Copyright (C) 1995-2005 Opera Software ASA. All rights reserved. * * This file is part of the Opera web browser. It may not be distributed * under any circumstances. */ #ifndef LOGDOC_OPELEMENTCALLBACK_H #define LOGDOC_OPEL...
/* Given a sorted integer array A of size n, which contains all unique elements. You need to construct a balanced BST from this input array. Return the root of constructed BST. Note: If array size is even, take first mid as root. Input format: The first line of input contains an integer, which denotes the value of n. ...
//HeapDate.cpp #include <iostream> #include <string> #include <sstream> #include <fstream> #include "HeapDate.h" using namespace std; //HeapDate constructor HeapDate::HeapDate(){ HeapDate::day = "1"; HeapDate::month = "1"; HeapDate::year = "2000"; }; void HeapDate::dateChange(string date){ stringstream ss; ss << ...
#include <iostream> #include <list> #include <map> using namespace std; class Graf{ private: int vertexcount; list <int> *adj; public: Graf(int V){ this->vertexcount = V; adj = new list<int>[V]; } void add(int v, int h){ adj[v].push_back(h); adj[h].push_back(v); } list<int> sort(list<int>unmarkt, map...
#ifndef __COMMON_HPP__ #define __COMMON_HPP__ #include <cuda.h> #include <cuda_runtime.h> enum Side { WHITE, BLACK }; #define OTHER(x) (x == WHITE? BLACK:WHITE) #define MAX_NUM_MOVES 32 class Move { public: int x, y; __host__ __device__ Move() { this->x = -1; this->y = -1; } ...
#include "scrollinterface.h" #include "scroll.h" ScrollInterface::ScrollInterface() {} ScrollInterface::~ScrollInterface() {}
#include <iostream> #include <fstream> #include <vector> #include <string> #include <cmath> using namespace std; /* *** Function : 逻辑回归Logistic Regression的c++实现 *** Author : TheDetial *** Platform : Windows10+VS2013 *** Time : 2021/08/03 *** Result : 结果已通过。 *** */ /* 相关知识点:线性回归、sigmoid()、梯度下降...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; ll func(vector<ll> a, int fugo) { ll ans = 0; ll offset = 0; //蓄積する修正量 for (int i = 0; i < n; i++) { if (i % 2 == fugo){ if (a[i] <= offset){ ans += offset - (a[i] - 1); off...
#include "GamePCH.h" #include "GStateScene.h" #include "GStateBGLayer.h" #include "GStateUILayer.h" #include "GAbilityListCtrlItem.h" #include "GItemListCtrlItem.h" #include "GStateListCtrlItem.h" #include "GnIListCtrl.h" #include "GPlayingDataManager.h" #include "GItemInfo.h" #include "GUnitViewer.h" #inclu...
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "BehaviorTree/BTTaskNode.h" #include "BTTask_StartAttack.generated.h" /** * */ UCLASS() class ANIMATIONTEST_API UBTTask_StartAttack : public UBTTaskNode { GENERATED_BODY() public: UBTTa...
#pragma once #include "shaders\Shader.h" #include "SolarSystem.h" #include "Camera.h" #include "Skybox.h" class RenderingManager { private: GLFWwindow* m_window; Camera * m_camera; GLfloat m_deltaTime; Shader * m_default_shader = nullptr, *m_light_shader = nullptr, *m_skybox_shader = nullptr; Sky...
// Copyright 2020 Fuji-Iot authors. 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 // // Unless required by appli...
// // Persona.h // // // Created by Daniel on 14/08/14. // // #ifndef ____Persona__ #define ____Persona__ #include <iostream> class Persona{ private: int hambre; int edad; int energia; int altura; int peso; public: void comer() = 0; void dormir() = 0; void crecer() = 0; v...
#include <iostream> #include <vector> #include <map> #include <stack> using namespace std; /********************************************************************************** * * Given a string containing just the characters '(', ')', '{', '}', '[' and ']', * determine if the input string is valid. * * The brackets mu...
// Copyright (c) 2017 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 Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special ...
#include "Cloud.h" #include "Platy.Game.Core/Util/Util.h" #include <Util/Util.h> namespace Platy { namespace Game { Cloud::Cloud( const float& aParticleMaxSize, const sf::Vector2f& aPosition, const sf::Color& aColor, const size_t& aParticleCount, const float& anIntensity, const float& aLifeTime...
#include<iostream> #include<vector> #include<cstdlib> #include<cstdio> #include<cmath> #define ull1 long long using namespace std; int modulo(int a,int b,int c){ long long x=1,y=a; // long long is taken to avoid overflow of intermediate results while(b > 0){ if(b%2 == 1){ x=(x*y); ...
#include "../include/Transfer.h" Transfer::Transfer(){ } void Transfer::convert(std::string filename){ std::string command = ("cd data && libreoffice --convert-to 'pdf' " + filename); system(command.c_str()); } std::string Transfer::upload(){ std::string filename = "./logs.pdf"; std::string command = ("cd data ...
#include<iostream> using namespace std; int sum_digi(int n,int sum) { if(n<10) return sum+n; return sum_digi(n/10,(n%10)+sum); } //tail recursive int main(int argc,char* argv[]) { int n; cin>>n; cout<<sum_digi(n,0); }
#include<bits/stdc++.h> using namespace std; main() { int n,m; while(cin>>n>>m) { int ans; ans = n+(floor((n-1)/(m-1))); cout<<ans<<endl; } return 0; }