text
stringlengths
8
6.88M
#include "Generador.h" #include "Constantes.h" #include "ziggurat.h" #include <ctime> #include <cstdio> #include <cstdlib> circle * randGenerator(float mu, float sigma) { //////pseudorandom normal distributed float between 0 and 1////// //Implementation of the Zigurat algorithm float fn[128]; int i; ...
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define ll long long #define pii pair<int,int> #define all(x) begin(x), end(x) #define loop(i,n) for(int i=0; i<n; i++) #define rep(i,a,b,c) for(int i=a; i<b; i+=c) #define tc(t) int t; cin>>t; ...
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ // Stack: inorder traversal // 1) Do In-Order Traversal of the given tree and store the result in a temp array. // 2) Check ...
// ******************************************************************************************************************************** // Floyd Warshall Shortest Path Algorithm // Input: Takes a the number of vertices on the first line, the // number of edges on the second line, a list of edges, // ...
#ifndef LIST_H #define LIST_H #include <iostream> template<typename T> class List { private: class Node { public: T data; Node *prev, *next; explicit Node(T value) : data(value), prev(nullptr), next(nullptr) {} Node(T value, Node* prev, Node* next) : data(value), prev(prev), nex...
#include "../Include/Bezier.h" Bezier::Bezier() :count(10000) { } bool Bezier::isGrabbed(int x, int y) { VECTOR c[4];//此矩阵是P和M的积,就是控制点阵和Bezier基矩阵的乘积 for (int i = 0; i<2; i++) { c[3][i] = (0 - points[0][i]) + 3 * points[1][i] - 3 * points[2][i] + points[3][i]; c[2][i] = 3 * points[0][i] - 6 * points[1][i] ...
#include <iostream> #include <string> #include <string.h> using namespace std; //get command from player on console class InputCmd { public: string Entry; string Cmd; string Attribute; void ReadEntry() { getline(cin, Entry); //cout << Entry << endl; }; void GetValues() { cout << "getva...
#include "mainwindow.h" #include "ui_mainwindow.h" static Stack< int> stack{}; static int i = 0; static string answer{}; static string inputTest{}; static string err{}; static string postfixForm; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); } M...
// CkBounce.h: interface for the CkBounce class. // ////////////////////////////////////////////////////////////////////// // This header is generated. #ifndef _CkBounce_H #define _CkBounce_H #include "chilkatDefs.h" #include "CkString.h" #include "CkMultiByteBase.h" class CkEmail; #ifndef __s...
#include<bits/stdc++.h> using namespace std; int getcount(vector<int>& arr,int n) { int count = 0; for(int i=1;i<=n-2;i++) { if((arr[i] > arr[i-1] && arr[i] > arr[i+1]) || (arr[i] < arr[i-1] && arr[i] < arr[i+1])) { count+=1; } } return count; } int solve(vector<int>& arr,int n) { vector<int> store(n,...
#include <iostream> using namespace std; int main() { char drink[3][11] = { "Americano", "Cafe Latte", "Lemon Tea" }; int money[3] = { 500, 400, 300 }; int N, m, cnt = 0; cin >> N >> m; cout << drink[N - 1] << endl; m = m - money[N - 1]; while (m >= 500) { m = m - 500; cnt++; } cout << cnt << ' '; cnt =...
/** * [Question] * - 配置された配列を反転するにはどうすればよいですか? * * [Solution] * - 先頭から順にスワップを繰り返す * - e.g. 10の配列の場合 * - 0と10をスワップ, 1と9をスワップ, 2と8をスワップ, ... * - 単純な線形探索の半分で実装できる */ #include <iostream> #include <vector> int main() { /* INPUT */ std::vector<int> v = {30, 88, 7, 25, 17, 20, 100, 2, 5, 88...
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while( t-- ){ int n, s; cin >> n >> s; int a[n]; unsigned long long sum = 0; for(int i = 0 ; i < n ; i++){ cin >> a[i]; sum += a[i]; } if(sum <= s){ ...
#include <iostream> #include <vector> #include <map> #include <list> #include <set> #include <unordered_set> class Graph { private: int numNodes; public: Graph(int num):numNodes(num){nodes = new Node[numNodes];} class edge{ public: edge(int n, double w=0):dst(n),weight(w){} int dst; ...
#include "CheckBoxLabel.h" #include <QDebug> CheckBoxLabel::CheckBoxLabel(int width, int height, const QImage &falseImage, const QImage &trueImage, bool startState, QWidget *parent): QLabel(parent), m_imageFalse(falseImage), m_imageTrue(trueImage), m_state(startState) { this->setFixedSize(width, height); u...
// COMPETITION TIME OVER!! //TLE #include <bits/stdc++.h> using namespace std; map<string, int> m; string helper(string s, int n) { if (s.length() > n) return s; if (s.length() == n) { if (m.find(s) != m.end()) m.insert(make_pair(s, 1)); } vector<char> input{'a', 'b', '...
#include <iostream> #include <gtest/gtest.h> #include "hs_math/random/normal_random_var.hpp" #include "hs_math/random/uniform_random_var.hpp" #include "hs_sfm/sfm_utility/similar_transform_estimator.hpp" namespace { template <typename _Scalar> class TestSimilarTransformEstimator { public: typede...
#include "DeferredRenderingApplication.h" #include "Controls.h" #include "LightsAnimator.h" #include <FastCG/World/GameObjectLoader.h> #include <FastCG/World/ComponentRegistry.h> #include <FastCG/Assets/AssetSystem.h> #include <vector> #include <cstdint> using namespace FastCG; DeferredRenderingApplication::Deferre...
#include "Scene.h" #include "Parser.h" Scene::Scene(): CGFscene(){ } void Scene::init() { attributes = new Attributes(); /*string filename; cout << "Insert the ANF filename: " << endl; cin >> filename; Parser teste = Parser(filename.c_str(), attributes); */ Parser teste = Parser("textures/pingpong.anf", a...
// // GameWorld.h // PaperBounce3 // // Created by Chaim Gingold on 9/9/16. // // #ifndef GameWorld_h #define GameWorld_h #include <memory> #include "cinder/Xml.h" #include "cinder/PolyLine.h" #include "Contour.h" #include "Vision.h" class Pipeline; class GameWorld { public: virtual string getSystemName() cons...
#include <particle_structs.hpp> #include <ppTiming.hpp> #include "perfTypes.hpp" #include "../particle_structs/test/Distribute.h" PS* createSCS(int num_elems, int num_ptcls, kkLidView ppe, kkGidView elm_gids, int C, int sigma, int V); PS* createCSR(int num_elems, int num_ptcls, kkLidView ppe, kkGidView elm_gids); int...
#include "resources.h" namespace tna { mesh_registry_t* p_mesh_registry = nullptr;; shader_registry_t* p_shader_registry = nullptr;; void resources_init() { p_mesh_registry = new mesh_registry_t(); p_shader_registry = new shader_registry_t(); } void resources_release() { delete p_shader_registry; d...
/*********************************************************************** created: Sat Jun 11 2011 author: Paul D Turner <paul@cegui.org.uk> *************************************************************************/ /*************************************************************************** * Copyrigh...
/*Author: Mehmed Esad AKÇAM 150190725 */ #include "Faction.h" class Merchant{ Faction *firstFaction; Faction *secondFaction; Faction *thirdFaction; int startingWeaponPoint; int startingArmorPoint; int revenue; int weaponPointLeft; int armorPointLeft; public: //constructors ...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <cstring> #include <queue> #include <sstream> using namespace std; /* 链接:https://www.nowcoder.com/questionTerminal/72a5a919508a4251859fb2cfb987a0e6 来源:牛客网 答案是斐波那契数列,分析如下: 2*n的大矩形,和n个2*1的小矩形 其中target*2为大矩阵的大小 有以下几种情形: 1) target <= 0 大矩...
#define aref_voltage 3.3 #include <LiquidCrystal.h> int tempSensorAPin = 0; int blinkDPin = 13; LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { lcd.begin(16, 2); Serial.begin(9600); pinMode(blinkDPin, OUTPUT); analogReference(EXTERNAL); } void loop() { int reading = analogRead(tempSensorAPin); ...
#include <Servo.h> //Digital Pins const int motorIn1 = 4; const int motorIn2 = 5; const int motorIn3 = 6; const int motorIn4 = 7; const int enA = 9; const int enB = 10; Servo myservo; String inByte; int pos; int degree; int speed = 148; //max speed = 255 #define pos_ini 0 void setup() { Serial.be...
#include "dsl/interpreter.h" #include <vector> #include <experimental/optional> namespace dm { class device_manager { public: device_manager(std::string programFile); ~device_manager(); dsl::Input getInput(std::string line); void addDev(dsl::Input input); ...
#include "experimenthandler.h" #include <QDebug> #include <QtGui> #include <QtCore> #include <qtimer.h> #include <QDesktopWidget> #include <QMessageBox> #define SEC 1000 ExperimentHandler::ExperimentHandler(FullScreenWidget *screen,QObject *parent) : QObject(parent) { m_screen = screen; m_experiment...
#include<bits/stdc++.h> using namespace std; char dic[30][20] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "a", "both", "another", "first", "second", "third"}; i...
#include <my_global.h> #include <mysql.h> void finish_with_error(MYSQL *con) { fprintf(stderr, "%s\n", mysql_error(con)); mysql_close(con); exit(1); } int Push_Data(int id, float data) { char query[64]; MYSQL *con = mysql_init(NULL); if(con == NULL) { fprintf(stderr, "%s\n", mysql_error(con)); ...
/* 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 "Bone.h" using namespace kyrbos; Bone::Bone() { D3DXMatrixIdentity(&m_Matrix); }
#include <iostream> #include <vector> #include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace std; using namespace cv; int main(int argc, char** argv) { // 初始化变量和随机值 Mat image(600, 600, CV_8UC3); RNG& rng = theRNG(); // 循环, 按下ES...
#include "../../include/infra/Common.hpp" #include <chrono> #include <boost/multiprecision/cpp_dec_float.hpp> /******************************/ /* Helper Methods *************/ /******************************/ int find_log2_floor(biginteger bi) { if (bi < 0) throw runtime_error("log for negative number is not suppo...
// Menghitung banyaknya bangunan yang ada di map // Made by Bayu Dasprog C 0172 copyright 2019 :)) #include <stdio.h> char maps[100][100]; int n,count=0,x,y; int a,b; int build ()//Build map function { int i=0,j=0; while(1) { char c = getchar(); if (c == EOF) { ...
#ifndef PWMWEBSERVER_H #define PWMWEBSERVER_H #include "httpendpoint.h" #include "httpendpointjsonget.h" #include "httpendpointjsonset.h" #include "pwminterface.h" #include <SmingCore.h> #include <array> #include <vector> class PwmWebServer { public: PwmWebServer(PwmInterface &pwm); void init(); void onAjaxAsArr...
/***** 描述 生日蛋糕上有三棵草莓,小F想把蛋糕切成形状完全相同的三块,并且每一块上都有一个草莓。你可以把草莓看成一个点,切块的时候不能切中草莓。请问能否切成满足相同的三块? 关于输入 第一行包含一个整数t表示有t组测试数据。 每组测试数据一行,包含7个整数:r x1 y1 x2 y2 x3 y3,r表示蛋糕半径,(x1,y1)(x2,y2)(x3,y3)表示三个草莓的位置(以圆心为坐标轴原点)。 关于输出 对每组数据输出一行。 如果能够切成全等的三块并且每块上有一个草莓,输出"Yes",否则输出"No" 例子输入 2 2 1 1 -1 1 0 -1 10 0 9...
#include <iostream> #include <time.h> #include <stdlib.h> #include <conio.h> #include <windows.h> #include <fstream> #include <sstream> using namespace std; void screenheader() { system("cls"); system("color f1"); cout << "\n\t \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2...
/************************************************************* * > File Name : U78300.cpp * > Author : Tony * > Created Time : 2019/08/13 16:01:08 * > Algorithm : 模拟 **************************************************************/ #include <bits/stdc++.h> using namespace std; #define...
#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QQmlContext> int main(int argc, char *argv[]) { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QGuiApplication app(argc, argv); qmlRegisterSingletonType(QUrl("qrc:///Utili...
#ifndef CELLO_ACTION_SEQUENCE_H #define CELLO_ACTION_SEQUENCE_H #include <algorithm> #include <functional> #include <initializer_list> #include <queue> #include <vector> #include <util/Tweener.h> #include <util/Action.h> using std::function; using std::initializer_list; using std::queue; using std::vector; namespace...
#include "navigator.h" #include "screenfactory.h" using namespace screens; FragmentNavigator::FragmentNavigator( QStackedWidget *container, BaseScreensFactory *screensFactory, Resolver* resolver) : mResolver(resolver) { this->screensFactory = screensFactory; this->currentContainer = c...
#include "Run_time_Framework.h" extern int kind; CRun_time_Framework* CRun_time_Framework::myself = nullptr; CRun_time_Framework::CRun_time_Framework() { } GLvoid CRun_time_Framework::draw() { glClearColor(0, 0, 0, 1); // 바탕색을 지정 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // 설정된 색으로 전체를 칠하기 glEnable...
#include "ComputerDesktop.h" #include "GameWindow.h" #include "Textures.h" #include "Button.h" #include "App.h" #include "App_WebBrowser.h" ComputerDesktop::ComputerDesktop() { } ComputerDesktop::ComputerDesktop(GameWindow *gameWindowP) { this->gameWindowP = gameWindowP; std::cout << "GAMEWINDOW: " << this->g...
// This file has been generated by Py++. #include "boost/python.hpp" #include "generators/include/python_CEGUI.h" #include "TextUtils.pypp.hpp" namespace bp = boost::python; void register_TextUtils_class(){ { //::CEGUI::TextUtils typedef bp::class_< CEGUI::TextUtils, boost::noncopyable > TextUtils_expos...
/*********************************************************************** * Copyright (C) 2019 Yinheyi. <chinayinheyi@163.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 the Free Software Foundation; either * vers...
#ifndef SRC_PT_PTOROP_H #define SRC_PT_PTOROP_H /// @file src/pt/PtOrOp.h /// @brief PtOrOp のヘッダファイル /// @author Yusuke Matsunaga (松永 裕介) /// /// Copyright (C) 2005-2011 Yusuke Matsunaga /// All rights reserved. #include "PtBinaryOp.h" BEGIN_NAMESPACE_YM_BB ///////////////////////////////////////////////////////...
#include <map> #include <set> #include <utility> #include <stdio.h> #include <stdlib.h> #include <algorithm> #define pir std::pair<int , int> #define mp(x , y) std::make_pair(x , y) #define DEBUG printf("Passing [%s] in Line %d\n" , __FUNCTION__ , __LINE__) ; const int MAX_N = 3e5 + 10 , dx[4] = {-1 , 1 , 0 , 0} , dy...
// OnHScrollLineLeft.h #ifndef _ONHSCROLLLINELEFT_H #define _ONHSCROLLLINELEFT_H #include "ScrollAction.h" #include "HorizontalScroll.h" class OnHScrollLineLeft : public ScrollAction { public: OnHScrollLineLeft(HorizontalScroll *horizontalScroll); OnHScrollLineLeft(const OnHScrollLineLeft& source); virtual ~OnHSc...
#ifndef PNODE_MAP_H #define PNODE_MAP_H #include <vector> #include <iostream> #include "PNode.h" class PNode_Map{ public: void Build_Map(const vector<vector<int>>& array); void Clear_Map(); PNode* Start_node; PNode* End_node; private: vector<vector<PNode*>> pnode; }; #endif
#include <MetaEvent.h> #include <EventID.h> #include <memory> using namespace std; MetaEvent::iterator::iterator(Storage::iterator iter) : Storage::iterator(iter) {} MetaAttribute& MetaEvent::iterator::operator*() { return this->Storage::iterator::operator*().second; } MetaEvent::const_iterator::const_iterator(St...
// // Created by 79164 on 18.11.2020. // #ifndef UDP_SERVER_INTERACTION_H #define UDP_SERVER_INTERACTION_H #include <stddef.h> #include <stdint.h> #include <iterator> #include <iostream> #include <fstream> #include <vector> #include <array> #define POLY 0x82f63b78 #define ACK 0 #define PUT 1 #define MAX_DATA_SIZE ...
// Time is sort(O(nlogn + n)) // Space is O(n+n)=>O(2*n) class Solution { public: //Function to find the minimum number of swaps required to sort the array. int minSwaps(vector<int>&nums) { vector<int> temp=nums; int n = nums.size(); unordered_map<int,int> hash; for(int i=0;i<n;i...
#include "PostSearchAnalysisTask.h" #include "PostSearchAnalysisParameters.h" #include "../../EngineLayer/ProteinParsimony/ProteinGroup.h" #include "../../EngineLayer/PeptideSpectralMatch.h" #include "../MyTaskResults.h" #include "../../EngineLayer/GlobalVariables.h" #include "../../EngineLayer/EventArgs/ProgressEvent...
# include <iostream> # include <vector> # include <list> # include <set> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, a, b, v1, v2, ans; set<pair<int, int>> s; cin >> n >> m >> a >> b; vector<list<int>> adj_list(n); vector<int> deg(n); ...
#ifndef HELPER_H #define HELPER_H #include <string> std::string exec(const char* cmd); #endif // HELPER_H
#include <iostream> #include <vector> #include <queue> #include <future> #include <assert.h> #include <cstdlib> #include "separate.h" #include "private_queue.h" #include "processor.h" std::vector <processor*> g_processors; int max_iters = 5000; class producer { public: separate <int> *m_var; private_queue <int>...
#include <stdio.h> #include <iostream> #include <iomanip> #include <opencv2/imgcodecs.hpp> #include <opencv2/imgproc.hpp> #include <opencv2/videoio.hpp> #include <opencv2/highgui.hpp> #include <opencv2/video.hpp> using namespace cv; using namespace std; int main() { // 最多顯示小數後兩位 cout << fixed << setprecision(2); ...
#pragma once #include <distant/support/winapi/psapi.hpp> #include <distant/types.hpp> namespace distant::system { class performance_info { public: performance_info(); /// @brief The number of pages currently committed by the system. uint commited_pages() const; /// @brief The current maximum number of p...
#ifndef UTENTEEXECUTIVE_H #define UTENTEEXECUTIVE_H #include "utente.h" class UtenteExecutive : public Utente{ public: //qui ci sarà l'overriding della funzione di ricerca UtenteExecutive(Username, Info); virtual vector<string> userSearch(const DB&, string); }; #endif // UTENTEEXECUTIVE_H
//************************************************************************** //** //** 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 ...
#include <bits/stdc++.h> #define MAX 100001 #define M 1000000007 #define ll long long #define ld long double #define ESP 0.0001 using namespace std; ll mat[2][2], org[2][2]; ll a, d, r, n, m; int matPow(int x) { if (!x) return 0; if (x&1) { matPow(x-1); ll temp[2][2]; temp[0][0] = ((mat[0][0]*org[0][0])%m + (...
#pragma once class Int2 { public: Int2(); Int2(const int _x, const int _y); int x; int y; };
#include <iostream> #include <climits> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int maxNo = arr[0]; int minNo = arr[0]; for (int i = 0; i < n; i++) { if (arr[i] > maxNo) { ...
/* * This program is illustrate operator overloading of Binary operators. * Program of vector is created to illustrate it and get the sum of it. */ #include <iostream> // Header using namespace std; class Vector{ // Vector class public: void set(int x,int y){ // set function. real=x; img=y; } void pr...
#include <iostream> #include <iomanip> #include <fstream> #include <cmath> #include <cstdlib> #include <complex> #include <vector> using std::cout; using std::endl; using std::ofstream; using std::ifstream; using std::complex; using std::vector; #include "include.h" int main(int argc,char *argv[]){ cout.precisio...
#ifndef ARTICLE_H #define ARTICLE_H #include "note.h" class NotesManager; /*! * \file article.h * \brief Classe de base permettant de définir une note de type article * \author Pauline Cuche/Simon Robain */ /** *\class Article * \brief Classe représentant les Articles */ class Article : public Note { QStri...
#pragma once #include "Card.h" class KerkhofCard : public Card { public: KerkhofCard(); static std::unique_ptr<Card> __stdcall Create(); ~KerkhofCard(); };
#ifndef _GAME_MODELS_H_ #define _GAME_MODELS_S_ #include "../../../Dependencies/glew/glew.h" #include "../../../Dependencies/freeglut/freeglut.h" #include "../Vertex_Format/Vertex_Format.hpp" #include <vector> #include <map> namespace Models { struct Model { unsigned int vao; std::vector<unsigned int> vbos; ...
#include "externals.h" #include "typedValue.h" #include "stack.h" #include "word.h" #include "context.h" void InitDict_Array() { // (n -- array) // n new-array Install(new Word("new-array",WORD_FUNC { if(inContext.DS.size()<1) { return inContext.Error(E_DS_IS_EMPTY); } TypedValue tvArraySize=Pop(inContext.DS);...
/*#include "TesteController.h" #include "Controller.h" #include <assert.h> bool TesteController::logIn() { Controller* c1 = new Controller(); assert(logIn == 0); } */ /* void TesteController::geSize_isNotSet() { Controller* c1 = new Controller(); int size = c1->getSize(); assert(size != 5); } voi...
/* * t_PID.cpp * * Created on: Feb 28, 2016 * Author: alexander */
// Copyright [2015] <lgb (LiuGuangBao)> //===================================================================================== // // Filename: file.cpp // // Description: 文件上传 // // Version: 1.0 // Created: 2015年07月31日 09时22分27秒 // Revision: none // Compiler: gcc // // Autho...
#pragma once #include <cstdint> #if defined __ARM_FP16_FORMAT_IEEE && !defined __CUDACC__ #define CIL_FP16_TYPE 1 #else #define CIL_FP16_TYPE 0 #endif namespace cil { union CIL16suf { int16_t i; uint16_t u; #if CIL_FP16_TYPE __fp16 h; #endif struct _fp16Format { unsigned int significand : 10; unsign...
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> using namespace std; int n,m; int xi,yi; int zi,wi; //200*xi+3*yi; bool p1[100000] = {false}; bool t1[100000] = {false}; struct node{ int z; int w; }; int max1 = 0; node te; vector<node > p; vector<node > t; int num = 0; bool cmp(node a,nod...
#ifndef WINDOW_H #define WINDOW_H #include <iostream> #include "ui_window.h" #include <QDialog> #include <bits/stdc++.h> #include "PlayRoom.h" #include "CreepingGame.h" #include "Ant.h" #include "Stick.h" #include <QPropertyAnimation> #include <QSequentialAnimationGroup> #include <QParallelAnimationGroup> #include <QG...
/* * BasicJob.h * * Created on: 2016年9月21日 * Author: genue */ #ifndef JOBTHREAD_H_ #define JOBTHREAD_H_ #include <pthread.h> #include <iostream> using namespace std; enum JOB_EXIT_CODE { /** * 正常退出,一般是break之后退出 * **/ JOB_NORMAL_EXIT, /** * 异常退出,一般是流断了之后退出 * **/ JOB_EXCEPTION_EXIT }; class...
#define _USE_MATH_DEFINES #include<iostream> #include<iomanip> #include<cmath> using namespace std; int main() { long double A, B, H, M; cin >> A >> B >> H >> M; long double ratioH = (60.0 * H + M) / (12.0 * 60.0); long double ratioM = M / 60.0; long double diff = abs(ratioH - ratioM); long d...
#include <iostream> #include<cmath> using namespace std; int main() { // your code goes here unsigned int tc; cin>>tc; while(tc--) { unsigned long long int start,end; cin>>start>>end; unsigned long long int x=ceil(sqrt(start)); unsigned long long int y=floor(sqrt(end)); cout<<(y-x)+1<<endl; } retu...
// Devin Kim ddk3ev@virginia.edu #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <limits.h> // Google implementations of union-find and work backwards from there int parent[100005*2], cnt[100005*2], id[100005*2]; //we need to add a CNT and ID array to keep track long long sum[100005*2...
/*----------------------------------------------------------------------------* * ���ϸ� : sinItem.cpp * �ϴ��� : ������ ���� * �ۼ��� : ����������Ʈ 12�� * ������ : �ڻ� *-----------------------------------------------------------------------------*/ #include "sinLinkHeader.h" #include "Language\\language.h" /*-...
#pragma once #include "Command.hpp" class AbstractCommandHandler { public: virtual void HandleCommand(const Command& cmd) const = 0; virtual ~AbstractCommandHandler() {} };
#include<bits/stdc++.h> using namespace std; #define ll long long int main() { ll m,n,i,j,k; ll l=1, h=1000000; while( l !=h ) { ll mid=(l+h+1)/2; printf("%lld\n", mid); fflush(stdout); char c[3]; scanf("%s", c); if( strcmp(c, "<" )==0 ) { ...
#include<iostream> #include<vector> using namespace std; const int NMAX=10100; int n,q,c,x,y; int r[NMAX]={0},p[NMAX]={0}; void make(int x){ for(int i=0;i<x;++i){ p[i]=i; } } void link(int x,int y){ if(r[x]>r[y]){ p[y]=x; } else{ p[x]=y; if(r[x]==r[y]){ ...
/* * JobBuffer.h * * Created on: 2016年9月23日 * Author: kean */ #ifndef JOBBUFFER_H_ #define JOBBUFFER_H_ #include "RtmpInfo.h" #include <pthread.h> #include <iostream> #include <list> using namespace std; class JobBuffer { private: pthread_mutex_t mutex; list<RtmpInfo *> area; public: int index; pub...
/* 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...
/* *using switch * - Days of week */ #include "iostream" using namespace std; int main() { int num; cout<<"\t\t\tDAYS OF WEEK\n"; cout<<"Enter number :- "; ab: cin>>num; switch (num) { case 1: cout<<"\n Monday \n"; break; case 2: cout<<"\n Tu...
/*---------------------------------------------------------------- Copyright (c) 2017 Author: Jagadeesh Vasudevamurthy file: e8p.h -----------------------------------------------------------------*/ /*---------------------------------------------------------------- This file has e8p class declaration ----------------...
#include <glew.h> #include <glut.h> #include <iostream> #include <vector> #include "textfile.h" // header file for code to read a textfile int winXRes = 600; int winYRes = 600; GLuint vbo = 0;//used to store the vertex buffer object GLuint vao = 0;//used to store the vertex array object int numOfVertex = 108; float ...
/************************************************************* * > File Name : P1801.cpp * > Author : Tony * > Created Time : 2019年02月20日 星期三 15时57分24秒 **************************************************************/ #include <bits/stdc++.h> using namespace std; int m, n, a[200010], b, r = 1...
// // Created by twome on 08/05/2020. // #ifndef GAMEOFLIFE_OPENGL_LABEL_H #define GAMEOFLIFE_OPENGL_LABEL_H #include <string> #include "../base/TextComponent.h" class Label : public TextComponent { public: explicit Label(const std::string &id); void draw(Graphics &graphics) override; void layout() ove...
/*Given a sorted dictionary of an alien language having N words and k starting alphabets of standard dictionary the task is to complete the function which returns a string denoting the order of characters in the language. Note: Many orders may be possible for a particular test case, thus you may return any valid order....
/* 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 <fstream> #include <string> #include <iostream> #include <sstream> #include <cstdlib> using namespace std; int main() { int *P_Bt, *P_Wt, *P_Tat, *P_At, *P_id; float avg_wt=0.0, avg_tat=0.0; ifstream file("Q2.txt"); string str; int num, count=0, burst_time=0, min; file >> num; P_Bt ...
#include "Newton.h" #include "iostream" #include "vector" #include "map" using namespace std; void Newton::init() { double argument, value; while (cin >> argument >> value) { this->points.push_back(make_pair(argument, value)); } table = new double* [points.size() + 1]; for (int i = 0; i < points.size() + 1; i++)...
/* Copyright (c) 2011 Andrew Wall Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub...
#include <gtest/gtest.h> #include "hypercube.hpp" typedef uint8_t byte; TEST(Hypercube, DefaultConstructorDim1) { Hypercube<byte, 1> h; } TEST(Hypercube, DefaultConstructorDim2) { Hypercube<byte, 2> h; } TEST(Hypercube, DefaultConstructorDim3) { Hypercube<byte, 3> h; } TEST(Hypercube, DefaultConstructorDim4) { Hyperc...
// Copyright 2021 The Google Research Authors. // // 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...
/* ======================================================================== Name : d_traceredirect.h Author : DH Copyright : All right is reserved! Version : E-Mail : dh.come@gmail.com Description : Copyright (c) 2009-2015 DH. This material, including documentation and any re...