text stringlengths 8 6.88M |
|---|
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 666666666
ll t,n,q,R,mod,mod2,tp;
ll A[200001];
ll powm(ll a, ll deg, ll M)
{
if(deg==0)return 1%M;
if(deg&1)return a*powm(a,deg-1,M)%M;
return powm(a*a%M,deg/2,M);
}
void precalc(int n, vector<ll>&Ri, vec... |
//------------------------------------------------------------------------------
// <copyright file="wxMainWindow.h" company="UNAM">
// Copyright (c) Universidad Nacional Autónoma de México.
// </copyright>
//------------------------------------------------------------------------------
// Shared memory between thr... |
#pragma once
class Unit
{
protected:
int m_atk;
int m_def;
public:
Unit();
~Unit();
int GetAtk() { return m_atk; }
void SetAtk(int atk) { m_atk = atk; }
int GetDef() { return m_def; }
void SetDef(int def) { m_def = def; }
};
|
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long l... |
#include <JeeLib.h>
#include <Ports.h>
// Joystick values structure
struct Joy_Vals
{
int JoyR_L;
int JoyD_U;
};
Port port1 = Port(1); // Up-Down Value Port
Port port2 = Port(2); // Right-Left Value Port
Port port3 = Port(3); // Vehicle_Status Button
void setup() {
// Begin RF Transmission on Channel 69
rf12... |
#ifndef HW_264_DECODER_H
#define HW_264_DECODER_H
#include "MediaDecoder.h"
#include "HwMediaDecoder.h" //from libhwcodec
#include "SwsScale.h"
//硬解码: h264->YUV[420p]
////////////////////////////////////////////////////////////////////////////////
class CHw264Decoder : public CMediaDecoder
{
public:
CHw264Decoder(... |
#include "cutsphere.h"
CutSphere::CutSphere(int _xcenter, int _ycenter, int _zcenter, int _radius )
{
xcenter = _xcenter;
ycenter = _ycenter;
zcenter = _zcenter;
radius = _radius;
}
CutSphere::~CutSphere()
{
}
void CutSphere::draw(Sculptor &t){
for (int i = xcenter-radius; i < xcenter+radius; i++... |
#pragma once
#include <vector>
namespace Utils
{
template<typename T>
bool Remove(std::vector<T>& vec, T item) //is this bad???
{
int index = -1;
for (int i = 0; i < vec.size(); ++i)
{
if (vec[i] == item)
{
index = i;
break;
}
}
if (index != -1)
{
vec.erase(vec.begin() + index);
r... |
#ifndef NYUPARSER_H
#define NYUPARSER_H
#include "geom/geometry.h"
#include "geom/transform.h"
#include "glm/glm.hpp"
#include "parse/tokens.h"
class Scene;
class Camera;
class Box;
class Plane;
class Sphere;
class NYUParser{
private:
Tokenizer * tokenizer;
// helper functions
void ParseLeftAng... |
#ifndef LEVELCONFIGDIALOG_HPP
#define LEVELCONFIGDIALOG_HPP
#include <QDialog>
#include <QFileDialog>
namespace Ui
{
class LevelConfigDialog;
}
namespace Maint
{
class LevelConfigDialog : public QDialog
{
Q_OBJECT
Ui::LevelConfigDialog *ui;
bool ShowFileDialog(QString& selectedP... |
/*
* Kaveh Pezeshki and Christopher Ferrarin
* E155 Lab 6
*
* Displays a voltage string sent over UART, printing the button state whenever it is updated
* Much of the basic ESP8266 code adapted from: https://randomnerdtutorials.com/esp8266-web-server/
* RX = D2
* TX = D3
*/
//Loading the ESP8266 library
#in... |
#ifndef WIB_BUILD_H
#define WIB_BUILD_H
#pragma once
#include <vector>
#include <map>
#include <string>
namespace WhatIBuild
{
class Unit
{
public:
Unit(const std::string& filename, const std::string& path);
~Unit();
const std::string& GetFileName() const { return m_Filename; }
const std::st... |
// Copyright (c) 2015 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// 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)
// This test case demonstrates the issue described in #1481:
// Sync primitives safe d... |
#include <iostream>
#include <stdio.h>
#include "MinIntStack.h"
using std::cout;
using std::endl;
// does this need "const"?
void pushTest(MinIntStack *m,int val,int min){
cout << endl<<"push "<<val<<endl;
m->push(val);
cout << (m->isEmpty()?"(bad) is empty":" not empty")<<endl;
cout << " length: "<<m->size()<<end... |
#include <iostream>
using namespace std;
#include "../Headers/point.hh"
#include <cmath>
double computeArea(Point &p, Point &q, Point &r);
int main()
{
Point myPt1(2,3,8);
Point myPt2(3,4,5);
Point myPt3(4,5,6);
//cout<<myPt1.distanceTo(myPt2)<<endl;
cout<<computeArea(myPt1,myPt2,myPt3)<<endl;
//cout<<"Pt2: ... |
#include "gameboardsizedialog.h"
#include "ui_gameboardsizedialog.h"
#include "mainwindow.h"
GameBoardSizeDialog::GameBoardSizeDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::GameBoardSizeDialog)
{
ui->setupUi(this);
board_size = lowestBoardSize; //default
}
GameBoardSizeDialog::~GameBoardSizeDi... |
#include<iostream>
using namespace std;
const int maxn=/*行列式大小*/
const int mo=/*答案取余*/
int det[maxn][maxn],n,ans;
void make_det()
{
/*构造行列式*/
}
void cal_det()/*转化为阶梯阵求行列式*/
{
int i,j,k,t,swap;
ans=1;
for (i=0; i!=n; ++i)
for (j=0; j!=n; ++j) det[i][j]%=mo;
... |
#ifndef PPM_H
#define PPM_H
//references from https://github.com/sol-prog/threads/blob/master/image_processing/ppm.cpp
#include <string>
#include <vector>
class PPM
{
public:
PPM();
//create a PPM object and fill it with data stored in source
PPM(const std::string & fileName);
//create an "empt... |
/*
* @author profgrammer
* @date 17-2-2019
*/
#include <bits/stdc++.h>
using namespace std;
class MyStack{
private:
int top;
int stack[100];
int size;
public:
MyStack(int _size){
top = -1;
size = _size;
}
bool isEmpty(){
return top == -1;
}
bool isFull(){
... |
#ifndef VnaSweepSegment_H
#define VnaSweepSegment_H
// RsaToolbox
#include "Definitions.h"
// Etc
// Qt
#include <QObject>
#include <QScopedPointer>
namespace RsaToolbox {
class Vna;
class VnaChannel;
class VnaSegmentedSweep;
class VnaSweepSegment : public QObject
{
Q_OBJECT
public:
explicit VnaSweepSegm... |
#include <Arduino.h>
#include "a_car.h"
int g_count = 0;
int g_array[3];
int g_flag = 0;
float g_SF[3];
int value[3] = {0};
int choose;
int number;
void TSC_Init()
{
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(VCC, OUTPUT);
pinMode(GND, OUTPUT);
pi... |
#ifndef ELEVATOR_CC
#define ELEVATOR_CC
#include "elevator.h"
elevator::elevator()
{
elev_lock = new Lock("elevLock");
userLimit = new Semaphore("userL_sem", 20);
}
elevator::~elevator()
{
delete elev_lock;
delete userLimit;
}
void elevator::GoingFromTo(int from, int to)
{
elev_lock->Acquir... |
#define MAINPREFIX z
#define PREFIX TF47
#include "script_version.hpp"
#define VERSION MAJOR.MINOR.PATCH.BUILD
#define VERSION_AR MAJOR,MINOR,PATCH,BUILD
#define REQUIRED_VERSION 2.02
|
#ifndef _CCHECK_USERNAME_h_
#define _CCHECK_USERNAME_h_
#include <string>
#include "CHttpRequestHandler.h"
class CCheckUserName : public CHttpRequestHandler
{
public:
CCheckUserName(){}
~CCheckUserName(){}
virtual int do_request(const Json::Value& root, char *client_ip, HttpResult& out);
private:
bo... |
#include <bits/stdc++.h>
using namespace std;
void solve () {
int n;
cin >> n;
map<string, int> db;
map<string, int>::iterator it;
while (n--) {
string user;
cin >> user;
it = db.find(user);
if (it == db.end()) {
db[user] = 0;
cout << "OK\n";
} else {
db[user] = ++db[... |
/****************************************************************************
* *
* Author : lukasz.iwaszkiewicz@gmail.com *
* ~~~~~~~~ *
* Lice... |
//
// Created by kanae on 2019-09-10.
//
#ifndef CMPRO_LEARNING_METHOD_H
#define CMPRO_LEARNING_METHOD_H
#include <dlib/opencv.h>
#include <opencv2/opencv.hpp>
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/image_processing/render_face_detections.h>
#include <dlib/image_processing.h>
#include... |
// LED Array Testing Code
// Light Integrated Threads
//
//
#include <FFT.h>
#include <SPI.h>
#include <LPD8806.h>
//#include <LEDArray.h>
#include <Grid.h>
Grid myGrid(18,18);
int maxVal = 0;
int maxIndex = 0;
int weights[7] = {5,4,3,3,3,3,2};
int weightedSpectrum[7] = {0,0,0,0,0,0,0};
int *spectrum;
//int color[3... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2010 Opera Software ASA. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
*/
#ifndef ISO_8859_1_ENCODER_H
#define ISO_8859_1_ENCODER_H
#incl... |
/*
* Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
... |
#include "tcp_client.h"
#include "ftp_client.h"
#include "cJSON.h"
#include "proto.h"
SOCKET sclient;
int tcp_client_init()
{
WORD socketVersion = MAKEWORD(2,2);
WSADATA wsaData;
if(WSAStartup(socketVersion, &wsaData) != 0)
{
return 0;
}
sockaddr_in serAddr;
serAddr.sin_family ... |
//
// Created by root on 25/05/19.
//
#include "Player.h"
Player::Player(sf::Texture* tx, sf::Vector2u imageCount,float switchTime, float speed,float jumpheight):
playerAnimation(tx,imageCount,switchTime),
body(sf::Vector2f(128.0f,80.0f))
{
this->speed = speed;
row=0;
faceRight=true;
this->jumpheigh... |
#pragma once
#include <json/Writer.h>
#include <map>
#include "credb/IsolationLevel.h"
#include "credb/Witness.h"
#include "LockHandle.h"
namespace credb
{
namespace trusted
{
struct operation_info_t;
class Ledger;
class OpContext;
/**
* Server-side logic for transaction processing
*/
class Transaction
{
private... |
/**
* @brief strinlistgmodel.cpp
* This is the source file which contains the definitions of the functions of the StringListModel class.
*/
#include "stringlistmodel.h"
/**
* @brief StringListModel
* This is the constructor for the StringListModel class
* @return
* none
*/
StringListModel::StringListModel()
{
m_c... |
#include<stdio.h>
#define grindsize 8
#define pathsize
int change=0,time=2,b,chess[grindsize][grindsize]={0},a[8][2]={
{2,1},
{2,-1},
{1,2},
{1,-2},
{-1,2},
{-1,-2},
{-2,1},
{-2,-1},
};
int walk=0,i=0,j=0,x0=0,y0=0;
void dfs(int time,int change,int x0,int y0){
int r=0;
for(r=0;r<grind... |
void setup() {
pinMode(3, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void Leader(){
digitalWrite(13, HIGH);
digitalWrite(3, HIGH);
delay(9);
digitalWrite(3, LOW);
delayMicroseconds(4500);
}
void One() {
digitalWrite(3, HIGH);
delayMicroseconds(562);
digitalWrite(3, LOW);
delayMicrose... |
// Created on: 2013-01-28
// Created by: Kirill GAVRILOV
// Copyright (c) 2013-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 Lesser General Public License version 2.1 ... |
#include "room.h"
#include "demon.h"
#include "boss.h"
#include "skull.h"
#include <iostream>
int Room::nbRoom = 0;
Room::Room(int a)
{
nbRoom ++;
//Si on appelle le constructeur Room(1), la room créée est celle du Boss, qui ne contient donc aucun autre monstre
if(!a==1)
{ //Positions où apparaitron... |
class Solution {
public:
string reverseString(string s) {
string res = s;
int left = 0;
int right = res.size() - 1;
while(left < right){
swap(res[left++],res[right--]);
}
return res;
}
};
|
/*
* GadgetApplicationListener.h
* Opera
*
* Created by Mateusz Berezecki on 5/13/09.
* Copyright 2009 Opera Software. All rights reserved.
*
*/
#include "core/pch.h"
#ifndef GADGET_APPLICATION_LISTENER
#define GADGET_APPLICATION_LISTENER
#ifdef WIDGET_RUNTIME_SUPPORT
#include "platforms/mac/quick_suppor... |
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <set>
#include <stack>
#include <cstdio>
#include <cstring>
#include <climits>
#include <cstdlib>
... |
#include <bits/stdc++.h>
using namespace std;
typedef struct node *typeptr;
struct node{
int info;
typeptr next;
typeptr prev;
};
typeptr first, end;
int listKosong()
{
if(first==NULL)
return(true);
else
return(false);
}
void buatListBaru()
{
typeptr list;
list=NULL;
first=lis... |
#ifndef TRAP_H
#define TRAP_H
#include "baseobject.h"
#include "hpreducer.h"
class Trap : public BaseObject, public HPReducer {
Q_OBJECT
public:
Trap(QObject *parent = nullptr);
Trap(int x,
int y,
int width,
int height... |
#include "SceneManager.h"
namespace FW
{
SceneManager::SceneManager(Application& app)
: app(app)
{
}
void SceneManager::popScene()
{
scenes.pop_back();
}
SceneManager::BaseScene& SceneManager::getCurrentScene()
{
return *scenes.back();
}
} |
//
// Created by fab on 09/04/2020.
//
#ifndef DUMBERENGINE_GUICOMPONENT_HPP
#define DUMBERENGINE_GUICOMPONENT_HPP
class GuiComponent
{
protected:
bool isActive;
public:
//used to show params in the inspector
virtual void drawInspector() = 0;
virtual ~GuiComponent()= default;
};
#endif //DUMBERENGIN... |
class Solution {
public:
bool isPowerOfFour(int num) {
return (num > 0 && ((int)(log10(num)/log10(4)) - log10(num)/log10(4)) == 0);
}
};
|
#include "digitizerTriggerHandler.h"
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <signal.h>
#include "common_defs.h"
extern pthread_mutex_t M_cout;
extern pthread_mutex_t DataReadoutDone;
extern pthread_mutex_t DataReadyReset;
#define BUFFER_LENGTH 260096
#define INCLUDE_ADC
using namespac... |
#include "_pch.h"
#include "dlg_mkobj_view_Frame.h"
#include "MObjCatalog.h"
#include "PGClsPid.h"
using namespace wh;
using namespace wh::object_catalog::view;
//---------------------------------------------------------------------------
Frame::Frame(wxWindow* parent,
wxWindowID id,
const wxString& title,
const w... |
#include <stdio.h>
int main(){
int speed;
scanf("%d", &speed);
const char *s = speed > 60 ? "Speeding" : "OK";
printf("Speed: %d - %s", speed, s);
// printf("Speed: %d - %s", speed, speed > 60 ? "Speeding" : "OK");
return 0;
}
|
/**************************************************************************************
* File Name : OpenGLWindow.hpp
* Project Name : Keyboard Warriors
* Primary Author : JeongHak Kim
* Secondary Author :
* Copyright Information :
* "All content 2019 DigiPen (USA) Corporation, all rights reserv... |
// Copyright 2018 Benjamin Bader
//
// 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 agree... |
#include "utils.hpp"
#include "common_ptts.hpp"
#include "actor_ptts.hpp"
namespace nora {
namespace config {
system_preview_ptts& system_preview_ptts_instance() {
static system_preview_ptts inst;
return inst;
}
v... |
//科普连接:https://home.gamer.com.tw/creationDetail.php?sn=4114818
#include<iostream>
#include<sstream>
/*strstream类同时可以支持C++风格的串流的输入输出操作。 *\
是istringstream和ostringstream类的综合,支持<<, >>操作符
\*可以进行字符串到其它类型的快速转换 */
using namespace std;
int main()
{
/****************************************************\
| 重载>>和<<,相当于,以字... |
#pragma once
#ifndef _PROJECT_CAMERA_
#define _PROJECT_CAMERA_
#include "../Project.h"
#include <vector>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
using namespace std;
class ProjectCamera : public Project {
private:
const char* vs_path;
const char* fs_path;
... |
//Created by: Mark Marsala and Marshall Farris
//Date: 5/4/2021
//Interface
#ifndef IFILEIO_H
#define IFILEIO_H
/**
* Class that reads and writes the file inputted into the program
*/
class iFileIO{
protected:
/**
* Function that reads the file
*/
virtual void readFile() = 0;
/**
* Function that writes the ... |
#include "GnMeshPCH.h"
#include "GnGamePCH.h"
#include "GMainGameMove.h"
#include "GMainGameEnvironment.h"
GMainGameMove::GMainGameMove(GActorController* pController) : GActionMove( pController )
{
mBeforeVerticalDirection = MOVE_MAX;
mBeforeHorizontalDirection = MOVE_MAX;
}
void GMainGameMove::Update(fl... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2009 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 CLIENTSIDE_STORAGE_SUPPORT
#includ... |
#include <string>
#include <iostream>
#include <vector>
#include <unistd.h>
#include <algorithm>
#include <queue>
#include "MorseTranslation.h"
//#include "MorseDriver.h"
#include "GPIOclass.h"
using namespace std;
#define TIME_BASE 150000
int channel_clear = 0;
GPIOClass* gpio;
int morse_init(st... |
#ifndef BS_UTILS_HPP
#define BS_UTILS_HPP
#include <bs/defs.hpp>
#include <bs/detail/threshold.hpp>
#include <chrono>
#include <functional>
#include <opencv2/imgproc.hpp>
namespace bs {
namespace detail {
inline cv::Mat
scale_frame (cv::Mat& frame, double factor) {
cv::Mat bw;
cv::cvtColor (frame, bw, cv::... |
// BEGIN CUT HERE
// PROBLEM STATEMENT
// Elly has placed several (possibly none) figurines on a
// rectangular board with several rows and columns. Now
// Kristina wants to remove all figurines from the board. In
// a single move she selects either up to R consecutive rows,
// or up to C consecutive columns and re... |
// Created on: 2013-01-29
// Created by: Kirill GAVRILOV
// Copyright (c) 2013-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 Lesser General Public License version 2.1 ... |
//
// Single Number.cpp
// interview-algorithm-question-solution
//
// Created by Sun Shijie on 2018/4/26.
// Copyright © 2018年 Shijie. All rights reserved.
//
#include <stdio.h>
class Solution {
public:
int singleNumber(vector<int>& nums) {
int length = nums.size();
int result = 0 ;
... |
#pragma warning(disable:4996)
#include <iostream>
#include <fstream>
#include "forbus.h"
#include "Bus.h"
using namespace std;
int main() {
int i;
while (1) {
cout << "\n1.버스 정보 기입\n2.예약\n3.정보 확인\n4.이용 가능한 버스\n5.종료\n\n";
cin >> i;
if (!cin)
IsEnteredNum(i);
else {
switch (i) {
case 1:
bus[o].I... |
#define LED1_PIN 12
#define LED2_PIN 8
#define LED3_PIN 7
#define DELAY 50
#define LED_AMOUNT 3
const int LEDadress[] = {LED1_PIN, LED2_PIN, LED3_PIN};
int LEDnum = 0;
void setup()
{
for (int i = 0; i < LED_AMOUNT; i++)
{
pinMode(LEDadress[i], OUTPUT);
}
}
void loop()
{
digitalWrite(LEDadress[LEDnum % ... |
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *deleteDuplicates(ListNode *head) {
// Note: The Solution object is instantiated only once and is reused by each te... |
/* ***** 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 ****** */
#include <boost/bind.hpp>
#include <fwCore/base.hpp>
#include <fwService... |
#include <allegro5\allegro.h>
#include <allegro5\allegro_primitives.h>
#include <allegro5\allegro_image.h>
#include <iostream>
#include "Game.h"
#include "Input.h"
#include "VariousColors.h"
#include "Camera.h"
void drawStar(float x, float y, ALLEGRO_COLOR C);
int main(int argc, char *argv[])
{
bool doLogic = false;... |
// Created on: 1991-05-07
// Created by: Laurent PAINNOT
// 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 GN... |
#include "Control.h"
using namespace Control;
Controler::Controler(){
}
Controler::Controler(ET_Connection::Connector* connector) : connector(connector){
}
Controler::~Controler(){
}
void Controler::async_remote_control(void){
}
void Controler::Control(){
bool forward_key_pressed = keyboard.getKeyState(mo... |
// Copyright (c) 2021 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 ... |
/*
Copyright (c) 2021-2022 Xavier Leclercq
Released under the MIT License
See https://github.com/ishiko-cpp/test-framework/blob/main/LICENSE.txt
*/
#include "TestMacrosFormatter.hpp"
namespace Ishiko
{
bool Internal::UniversalFormatter<char*>::Format(const char* value, std::string& output)
{
output =... |
/*
* Реализация паттерна "Посетитель" для построения таблицы символов программы
*/
#pragma once
#include "Visitor.h"
#include "Table.h"
class CSymbolTableBuilder : public IVisitor
{
public:
CSymbolTableBuilder() : isCorrect( true ), currentClass( NULL ), currentMethod( NULL ) { };
bool IsTableCorrect() const { retu... |
#include "debug.h"
Debug::Debug(){
}
Debug::~Debug(){
}
void Debug::message(std::string msg, termColor color) {
switch (color) {
case 0 : //grey
std::cout << termcolor::grey << msg << std::endl;
std::cout << termcolor::reset;
break;
case 1: //red
std::cout << termcolor::red << msg << std::endl;
... |
// Created on: 1997-11-17
// Created by: Jean-Louis Frenkel
// Copyright (c) 1997-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... |
/* -*- 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.
*
* @author Manuela Hutter (manuelah)
*/
#include "core/pch.h"
#... |
//convex
//中大资料集数据\二\第二章\2.3_凸边形外壳
#include<stdio.h>
#include<algorithm>
#define MAXN 100010
using namespace std;
struct point
{
int x,y;
point(int ix,int iy):x(ix),y(iy){}
point(){}
int operator*(const point &that)
{
return x*that.y-that.x*y;
}
point operator-(const point &that)
... |
#ifndef DELETEWORKER_H
#define DELETEWORKER_H
#include<QObject>
#include<QThread>
#include<QString>
#include<QFileInfo>
#include<QDir>
#include<QFile>
#include<iostream>
class DeleteWorker : public QObject
{
Q_OBJECT
public:
DeleteWorker() = default;
~DeleteWorker() = default;
void init(QFileInfo&);
... |
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmRulePlaceholderExpander_h
#define cmRulePlaceholderExpander_h
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
#include <string>
class cmOutputCon... |
#ifndef __CLIETN_SOCKET_H__
#define __CLIETN_SOCKET_H__
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string>
class CClientSocket
{
public:
CClientSocket();
CClientSocket(const std::string& host,const int port, const unsigned int nTimeOutMicroSend = 300000... |
/*
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
*/
// This function should rotate list counter-clockwise
// by k and return new head (if changed)
Node* rotate(Node* head, int k)
{
// only gravity will pull me down
// Rotate a Linked Li... |
#ifndef TIMELINEWIDGET_H
#define TIMELINEWIDGET_H
#include <QFrame>
#include <memory>
#include <Widget/timeline.h>
//--------------------------------------------------------------------------------------------------------------
/// @author Idris Miles
/// @version 1.0
/// @date 01/06/2017
//--------------------------... |
/**
* @copyright (c) 2020, Kartik Venkat, Nidhi Bhojak
*
* @file main.cpp
*
* @authors
* Part 1:
* Kartik Venkat (kartikv97) ---- Driver \n
* Nidhi Bhojak (nbhojak07) ---- Navigator\n
*
* @version 1.0
*
* @section LICENSE
*
* BSD 3-Clause License
*
*
* All rights reserved.
* Redistribution and use i... |
/* Runs the motors and solenoid valves on the device.
* This board has support for 4 solenoids (2 independent, 3 & 4 controlled by single pin). Solenoid voltage is controlled by a jumper, which can provide either 12 or 24 volts.
* The solenoids should open when high and closed when low.
*
* The module supports ... |
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary... |
#pragma once
#include "QuestionStateImpl.h"
#include "SequenceQuestionState_fwd.h"
#include "QuestionReview.h"
#include "types.h"
namespace qp
{
class CSequenceQuestionState : CQuestionState
{
public:
LOKI_DEFINE_VISITABLE()
CSequenceQuestionState(CConstSequenceQuestionPtr const& question);
~CSequenceQuestionState... |
#pragma once
#ifndef _DISPATCH_H
#define _DISPATCH_H
#include "common.h"
#include <mutex>
/*
* Dispatch Object.
*/
struct DispatchObject {
// Holds everything we need to analyze the data of a stream
// This includes the video fetcher and the video analyzer.
std::shared_ptr<class VideoFetcher> mFetch;
std::s... |
#include "WarlockAttack.h"
WarlockAttack::WarlockAttack() { std::cout << " creating WarlockAttack " << std::endl; }
WarlockAttack::~WarlockAttack() { std::cout << " deleting WarlockAttack " << std::endl; }
// void NecromancerAttack::heal(Unit& ally, SpellCaster& healer) {
// ally.takeTreatment(healer.getState().... |
#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
using ll = long long;
int main()
{
int n;
cin >> n;
vector<ll> inx(n),iny(n),x(n),y(n);
for(int i = 0;i< n;i++){
cin >> inx[i] >> iny[i];
}
for(int i = 0;i<n;i++){
if((abs(inx[i])+abs(iny[i]))%2!=(abs(inx[0])+abs(iny[0]))%2){
cout<<-1<<e... |
#include "soda_jacobi2d_2.h"
#include <cstdlib>
#include <cstring>
#include "hw_classes.h"
#include <iostream>
#include "ap_int.h"
#include "jacobi2d_2_kernel.h"
#include "jacobi2d_2.h"
using namespace std;
int main() {
const int ncols = 32;
const int nrows = 32;
const int img_size = ncols*nrows;
ap_uint<... |
#include "Apple.h"
vector<RECT> Apple::LoadRECT(AppleState::StateName state)
{
vector<RECT> listSourceRect;
RECT rect;
if(Tag == EntityTypes::Bowl)
switch (state)
{
case AppleState::Flying:
rect.left = 15; rect.top = 97; rect.right = rect.left + 28; rect.bottom = rect.top + 20; listSourceRect.push_back(r... |
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/trace/tracenode.h>
namespace mbus {
typedef vespalib::TraceNode TraceNode;
} // namespace mbus
|
//////////////////////////////////////////////////////////////////////
///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 <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
using namespace std;
int s[111][111];
int nhang,ncot,size;
int count;
void input(){
scanf("%d %d %d",&nhang,&ncot,&size);
for (int i=0;i<nhang;i++)
for (int j=0;j<ncot;j++)
s... |
#include "gtest/gtest.h"
#include "opennwa/Nwa.hpp"
#include "opennwa/query/language.hpp"
#include "opennwa/construct/quotient.hpp"
#include "opennwa/query/automaton.hpp"
#include "Tests/unit-tests/Source/opennwa/fixtures.hpp"
#include "Tests/unit-tests/Source/opennwa/int-client-info.hpp"
#include "Tests/unit-tests/S... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
string s;
cin >> s;
int ans_one = 0; //0101
int ans_two = 0; //1010
for(int i = 0; i < s.size(); i++)
{
if (s[i] == '0'){
if ((i % 2) == 0){
ans_two++;
} else {... |
#include <iostream>
#include <vector>
#include "StrongDataTypes.h"
#include "Utils.h"
using namespace std;
using namespace utils;
template <class Iterator>
void MergeSort(Iterator first, Iterator last) {
if (std::distance(first, last) > 1) {
Iterator middle = first + (last - first) / 2;
MergeSort(... |
#include <iostream>
using namespace std;
class Circle{
};
class Rectangle{
};
int main(){
}
|
/*
* 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/portability/GMock.h>
#include <quic/QuicException.h>
#include <quic/state/QuicTransportStatsCallba... |
#include <fstream>
#include <iostream>
#include <sys/types.h>
#include <inttypes.h>
#include <map>
#include <vector>
#include <list>
#include <set>
#define _STDC_FORMAT_MACROS
#define dMap1MaxSize 512
#define dMap2MaxSize 4096
#define iMap1MaxSize 512
#define iMap2MaxSize 4096
#define OFFCHIP_LATENCY 60
using namespa... |
/*
* 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 <quic/server/QuicUDPSocketFactory.h>
namespace quic {
class QuicReusePortUDPSocketFactory : public QuicU... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.