text stringlengths 8 6.88M |
|---|
#include "stdafx.h"
#include "Command.h"
#include <iostream>
using namespace std;
Command::Command()
{
}
Command::~Command()
{
std::cout << "command baseclass destructor" << endl;
}
void Command::Run(list<string>* parameters, Game * game)
{
}
|
//-----------------------------------------------------------------------------
// VST Plug-Ins SDK
// VSTGUI: Graphical User Interface Framework not only for VST plugins :
//
// Version 4.2
//
//-----------------------------------------------------------------------------
// VSTGUI LICENSE
// (c) 2013, Steinberg Media... |
#ifndef FUZZYCORE_OUTPUT_VARIABLE_DAO_H
#define FUZZYCORE_OUTPUT_VARIABLE_DAO_H
#include "../DAOUtils/DAOUtils.h"
#include "../DAOUtils/NullConverter.h"
#include "../../utils/stringEditor/StringEditor.h"
#include "../../enums.hpp"
#include "../../models/outputVariable/OutputVariable.h"
class OutputVariableDAO {
priva... |
#ifndef _HS_SFM_FEATURE_MATCH_OPENCV_FEATURE_DETECTOR_HPP_
#define _HS_SFM_FEATURE_MATCH_OPENCV_FEATURE_DETECTOR_HPP_
#include <string>
#include <vector>
#include <opencv2/nonfree/features2d.hpp>
#include "hs_sfm/config/hs_config.hpp"
namespace hs
{
namespace sfm
{
namespace feature_match
{
class HS_EXPORT OpenCV... |
#include <bits/stdc++.h>
using namespace std;
const int MAX_INT = std::numeric_limits<int>::max();
const int MIN_INT = std::numeric_limits<int>::min();
const int INF = 1000000000;
const int NEG_INF = -1000000000;
#define max(a,b)(a>b?a:b)
#define min(a,b)(a<b?a:b)
#define MEM(arr,val)memset(arr,val, sizeof arr)
#defi... |
#pragma once
#include "Plant.h"
#include<vector>
#include<math.h>
#include<ctime>
#define PI 3.14
/*! \brief
* Derived from Plant class, indicates the pattern for creating each set of top points and the difference between
* each top's and base's radius.
*/
class Tree:public Plant
{
public:
Tree(double width, dou... |
/*************************************************************
* > File Name : P1441.cpp
* > Author : Tony
* > Created Time : 2019/06/21 15:27:10
* > Algorithm : [Dfs+DP]
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
i... |
//Asked on HackerEarth/heaps
//All testCases Passed, within the given time complexity.
#include<bits/stdc++.h>
using namespace std;
void buildHeap(vector<long long> &arr, int n, int i) {
int parent = (i-1) / 2;
if(arr[i] > arr[parent]) {
swap(arr[i],arr[parent]);
buildHeap(arr,n,parent);
}
}
void printHeap(v... |
int Solution::minimize(const vector<int> &a, const vector<int> &b, const vector<int> &c) {
int aa=a.size();
int bb=b.size();
int cc=c.size();
int i=0,j=0,k=0;
int ans=INT_MAX;
while(i<aa and j<bb and k<cc)
{
int temp=max({abs(a[i] - b[j]), abs(b[j] - c[k]), abs(c[k] - a[i])});
... |
/**
* Copyright (C) 2017 Alibaba Group Holding Limited. 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
*
* ... |
class Solution {
public:
vector<vector<int>> combine(int n, int k) {
vector<int> temp;
backtrack(n,0,temp,k);
return result;
}
void backtrack(int n, int pos, vector<int> temp, int k)
{
if(temp.size() == k)
{
result.push_back(temp);
... |
//使用for循环,将50~100相加
#include <iostream>
using namespace std;
int main() {
int sum=0;
for(int val=50;val<=100;val++)
sum+=val;
cout << sum <<endl;
return 0;
} |
#ifndef NETWORKINTERFACE_H
#define NETWORKINTERFACE_H
#ifdef _WIN32
#include <json/json.h>
#else
#include <jsoncpp/json/json.h>
#endif
#include <string>
class NetworkInterface {
public:
virtual Json::Value sendRequestGet(const std::string& requ, const std::string& body = "") = 0;
virtual Json::Value sendRequestPost(c... |
#pragma once
//#include "Module.h"
#include "Application.h"
#include "ImGui\imconfig.h"
//#include "ImGui\imgui_internal.h"
#include "Panel.h"
#include "Console.h"
#include "ConfigPanel.h"
#include "imgui_impl_sdl.h"
#include "SDL/include/SDL_opengl.h"
#include "Geomath.h"
#include "GameObject.h"
#include "ImGui\ImGui... |
#include <Polycode.h>
#include "PolycodeView.h"
#include "Polycode3DPhysics.h"
#include <vector>
#include <list>
using namespace Polycode;
#define MOVE_SPEED 4.0 //speed when area == 100
#define MOVE_SPEED_STEP 0.1
#define MAX_MOVE_SPEED 4.0
#define START_TIME 20
#define MAX_BOOST 10
#define BOOST_RATE 5 //points p... |
#include <ArduinoJson.h>
#include <AzureIoTHub.h>
#include <SPIFFS.h>
#include "logging.h"
#include "iot_device_core.h"
#include "iot_device_method.h"
struct MethodCallback {
const char* methodName;
IOT_DEVICE_METHOD_CALLBACK callback;
};
static MethodCallback methodCallbacks[IOT_DEVICE_MAX_METHOD_COUNT];
s... |
//**************************************************************************
//
// Copyright (c) 1997.
// Richard D. Irwin, Inc.
//
// This software may not be distributed further without permission from
// Richard D. Irwin, Inc.
//
// This software is distributed WITHOUT ANY WARRANTY. No claims are made
// as to ... |
#include "objeto_juego_i.h"
using namespace App_Interfaces;
Objeto_juego_I::Objeto_juego_I()
:borrar(false)
{
}
|
#include <iostream>
using namespace std;
bool isPrime(int);
int main(){
for(int i = 0; i < 1000; i++)
if (isPrime(i)) cout << i << endl;
return 0;
}
bool isPrime(int a){
if (a < 2) return false;
if (a == 2) return true;
if (a%2 == 0) return false;
for (int i = 3; i*i <= a; i++)
if (a%i == 0) return ... |
/*
* dolier-remove-subincl.cpp
*
* Created on: Jan 24, 2014
* Author: vbonnici
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <sstream>
#include <set>
#include "data_ts.h"
#include "timer.h"
#include "trim.h"
#include "pars_t.h"
#include "dimers.... |
#include <iostream>
using namespace std;
int main() {
int i = 1;
int number;
cout << "Enter the number:";
cin >> number;
for (; i < number; i *= 2) {
}
if (i == number) {
cout << "Yes";
} else {
cout << "No";
}
return 0;
}
|
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.UI.WebUI.1.h"
#include "Windows.ApplicationModel.1.h"
#include "Windows.ApplicationModel.Activation.1.h"
#include "Windows.ApplicationModel.Background.1.h"
#include "Windows.F... |
#include "DisplayGrid.h"
DisplayGrid::ColorIdMap DisplayGrid::GridColors;
DisplayGrid::DisplayGrid()
{
loadColors();
}
DisplayGrid::DisplayGrid(GridBool* obsMap) : obsMap(obsMap)
{
loadColors();
}
DisplayGrid::~DisplayGrid()
{}
void DisplayGrid::draw(sf::RenderTarget &target, sf::RenderStates states) const
{
in... |
#include "HardwareSerial.hpp"
HardwareSerial::HardwareSerial() {
}
void HardwareSerial::begin(long speed) {
uart_config(speed, EIGHT_BITS, STICK_PARITY_DIS, NONE_BITS, ONE_STOP_BIT, NONE_CTRL);
}
void HardwareSerial::print(const char*s) {
while(*s) {
tx_one_char(*s++);
}
}
void HardwareSeri... |
#pragma once
// includes
namespace Debug
{
/// \brief process memory reader/writer
/// note that for reading from/writing to a process the appropriate system privilige
/// is necessary.
class ProcessMemory
{
public:
/// ctor; takes process id
ProcessMemory(DWORD dwProcessId): m_dwProcessId(dwProcessId){}
/... |
#ifndef _PKEYWORD_H
#define _PKEYWORD_H
#include <string>
using std::string;
namespace PorkParserSpace
{
// Enumeration for keywords used in PorkScript
enum PKeyword { NONE, REQUIRES, DEF, SET, EDEF, DYNAMIC, DEFAULT,
STATE, TRUE, FALSE, ESET, RELIESON, FROM, TRIGGER, PRESENT,
N_PRESENT, INF, FOR, D... |
#include <Wire.h>
#include "SHT2x.h"
SHT2x sensor;
void setup() {
Serial.begin(9600);
Wire.begin();
sensor.begin();
Serial.println("Reading...");
Serial.println(sensor.readTemperature());
Serial.println(sensor.readHumidity());
Serial.println(sensor.heaterOn());
Serial.println("Heater On");
Ser... |
#include "Item.h"
RECT Item::getFrameRectFromType(eAirCraftType type)
{
switch (type)
{
case B:
return SpriteManager::getInstance()->getSourceRect(eID::AIRCRAFT, "b_ammo");
break;
case F:
return SpriteManager::getInstance()->getSourceRect(eID::AIRCRAFT, "f_ammo");
break;
case L:
return SpriteManager::ge... |
#include "shaderc.h"
// Set the default allocator
namespace bgfx
{
static bx::DefaultAllocator s_allocator;
bx::AllocatorI* g_allocator = &s_allocator;
struct TinyStlAllocator
{
static void* static_allocate(size_t _bytes);
static void static_deallocate(void* _ptr, size_t /*_bytes*/);
};
void* TinyStlAllocator::sta... |
#include <iostream>
#include "Worker.h"
using namespace std;
int main()
{
init();
int a;
int count = 0;
do {
cout << "\n\t 1.Add new worker \n";
cout << "\t 2.Redakr \n";
cout << "\t 3.Search by age \n";
cout << "\t 4.Search by sekond name \n";
cout << "\t 5.Dellet \n";
cout << "\t 6.Write in file \... |
/*
1826. 연료 채우기
그리드(탐욕) 알고리즘
힙
연료가 거리보다 작을 때 계속 반복
1) 주유소 정보에서 거리순으로 정렬
2) 현재 연료(=주행가능한 거리) 보다 짧은 거리의 주유소 탐색
3) 그 주요소 탐색 후 우선순위 큐에 주유가능한 연료 넣기
4) 가장 앞에 있는 연료 추가, pop, cnt++
5) 만약 주유 가능한 연료가 없으면(큐 비어있으면) 도착 실패
*/
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#define MAX 101
... |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <bitset>
#include <utility>
#include <set>
#include <math.h>
#define pi acos(-1.0)
#define INF ... |
#include "global_utility.h"
int full_initial(GLFWwindow* &window, int _width, int _height) {
/*
窗口初始化
*/
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_F... |
/***********************************************************************
created: Tue Mar 3 2009
author: Paul D Turner (parts based on original code by Thomas Suter)
*************************************************************************/
/***************************************************************... |
#pragma once
#include "../utility/position.h"
#include "../utility/grid.h"
enum ObstructionType
{
OT_EMPTY,
OT_OBSTRUCTED,
OT_CONSIDERED
};
class ObstructionMap : public Grid<ObstructionType>
{
public:
ObstructionMap(int size_x, int size_y);
bool isObstructed(Position);
bool isConsidered(Position);
bool isOp... |
//Isaac Mooney June, 2018 for jet mass analysis in simulation
#include "params.hh"
#include "funcs.hh"
#include "TStarJetPicoDefinitions.h"
using namespace fastjet;
using namespace std;
using namespace Analysis;
typedef fastjet::contrib::SoftDrop SD;
// -------------------------
// Command line arguments: ( Defaults... |
#include "easytf/easytf.h"
#include "easytf/easytf_assert.h"
#include "easytf/easytf_logger.h"
easytf::EasyTFGraph::EasyTFGraph()
{
logCritical("EasyTFGraph construct function begin.");
logCritical("EasyTFGraph construct function end.");
}
void easytf::EasyTFGraph::push_node(const easytf::Node& node)
{
logCritical... |
#include<iostream>
using namespace std;
/*
userNodes is a class with multiple nodes representing users
printRequestingNode is a friend class to userNodes to print the userName and userID
pageCounter is a friend function to userNodes to print the number of pages from that class
*/
class userNodes{
const char* _userNa... |
#ifndef MockIEncoderTask_h
#define MockIEncoderTask_h
#include <fstream>
#include <string>
#include <gmock/gmock.h>
#include <compressor/data/data.h>
#include <compressor/data/reader.h>
#include <compressor/data/writer.h>
#include <compressor/task/coder.h>
#include <compressor/task/encoder.h>
#include <compressor/en... |
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> kClosest(vector<vector<int>> &points, int K)
{
if (K == points.size())
return points;
map<float, vector<vector<int>>> m;
for (auto arr : points)
{
float distance = sqrt(arr[0] * arr[0] + arr[1] * arr[1]);
m[distan... |
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcovered-switch-default"
#pragma clang diagnostic ignored "-Wsign-compare"
#pragma clang diagnostic ignored "-Wdeprecated"
#pragma clang diagnostic ignored "-Wshift-sign-overflow"
#include <gtest/gtest.h>
#pragma clang diagnostic pop
#pragma clang diagnos... |
#include<string>
#include <iostream>
#include <vector>
using namespace std;
bool solution(string s)
{
bool answer = true;
vector<char> block;
int i=0;
while(i<s.size()){
if(s[i]=='(') block.push_back('(');
else{
if(block.size()==0) return false;
if(block[block.s... |
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... |
#include <iostream>
int main()
{
using std::cout;
using std::cin;
using std::endl;
cout << "Enter a sentence with a '$' in it: " << endl;
int ct = 0;
char ch;
while ((ch = cin.get()) != '$')
ct++;
// put $ back to stream
cin.putback(ch);
while (cin.get() != '\n')
... |
//
// hlog.cpp
//
//
// Created by Artur Gilmutdinov on 4/26/13.
//
//
#ifndef _hlog_cpp
#define _hlog_cpp
#include "../include/hlog.h"
void hlog_clear(string file)
{
FILE *f = fopen(file.c_str(), "w");
}
void hlog_log(string s, string file)
{
FILE *f = fopen(file.c_str(), "a+");
fprintf(f, "%s", s.... |
// =============================================================================
// Copyright 2012.
// Scott Alexander Holm.
// All Rights Reserved.
// =============================================================================
#include "game.h"
#include "play.h"
#include "confederateplay.h"
#include <ios... |
#include <iostream>
#include <stack>
using namespace std;
void isOK(string s);
string ss;
int main()
{
int n = 0;
cin >> n;
for(int i = 1; i < n; i++)
{
string s;
cin >> s;
isOK(s);
ss.append("\n");
}
string s;
cin >> s;
isOK(s);
cout << ss;
... |
#include "Globals.h"
#include "Application.h"
#include "ModuleInput.h"
#include "SDL/include/SDL.h"
#include "p2Qeue.h"
#include "SDL/include/SDL_gamecontroller.h"
#include "ModulePlayer.h"
#include "ModulePlayer2.h"
ModuleInput::ModuleInput() : Module()
{
for (uint i = 0; i < MAX_KEYS; ++i)
keyboard[i] = KEY_IDLE;... |
#ifndef APPLICATION_H
#define APPLICATION_H
#include <vector>
#include <string>
#include <ostream>
#include "LinkLayer.h"
class Application {
public:
Application();
void run();
private:
LinkLayer link_layer;
int serial_port;
unsigned max_packet_size;
unsigned max_reconnects;
unsigned current_reconnects;... |
/*
* Copyright (c) 2009-2012 André Tupinambá (andrelrt@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use... |
#include "Topping.h"
Topping::Topping(){
}
string Topping::get_name() {
return this->name;
}
int Topping::get_price(){
return this->price;
}
void Topping::set_name(string new_name){
this->name = new_name;
}
void Topping::set_price(int new_price){
this->price = new_price;
}
... |
#ifndef HHREPORT_H
#define HHREPORT_H
#include <QObject>
#include <QVector>
class IoNetClient;
class QFile;
class HhReport : public QObject
{
Q_OBJECT
public:
explicit HhReport(QVector<IoNetClient*> &source,QObject *parent = 0);
signals:
private slots:
void slotGasDataReady(bool);
void slotUpdateaD... |
// -*- C++ -*-
//
// Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory,
// Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC
//
// This file is part of FreePOOMA.
//
// FreePOOMA is free software; you can redistribute it and/or modify it
// under the terms of the Expat license.
//
// This progr... |
/// @file LsimLcc.cc
/// @brief LsimLcc の実装ファイル
/// @author Yusuke Matsunaga (松永 裕介)
///
/// Copyright (C) 2005-2011 Yusuke Matsunaga
/// All rights reserved.
#include "LsimLcc.h"
#include "YmNetworks/BdnNode.h"
BEGIN_NAMESPACE_YM
//////////////////////////////////////////////////////////////////////
// クラス Lsim... |
#include "horline.h"
Horline::Horline(uint16_t x_, uint16_t y_, uint16_t * color_, uint16_t length_, uint8_t thick_)
:x(x_), y(y_), colorPtr (color_), length (length_), thick (thick_)
{
}
void Horline::draw () const
{
displayDriver->horLine (x, y, colorPtr, length, thick);
}
void Horline::setPosition (uint16_t x_, ... |
#include "usefull.h"
U32 U32_big_endian( void * ptr)
{
BYTE *l_ptr = (BYTE *)ptr;
return ( (UI)l_ptr[0]<< 24) + ((UI)l_ptr[1]<< 16) + ((UI)l_ptr[2]<< 8) + ((UI)l_ptr[3]);
}
void U32_big_endian_to_bytes(U32 val, void * ptr)
{
BYTE *l_ptr = (BYTE *)ptr;
l_ptr[0] = val >> 24;
l_ptr[1] = val >> 16;
l_ptr[2] = val >... |
#ifndef __MQTTCLIENTHANDLER_H__
#define __MQTTCLIENTHANDLER_H__
/*
https://github.com/eclipse/paho.mqtt.cpp/blob/master/src/samples/async_subscribe.cpp
https://github.com/eclipse/paho.mqtt.cpp/blob/master/src/samples/async_publish.cpp
*/
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
#incl... |
#include "main.h"
PCREATE_PROCESS_NOTIFY_ROUTINE trampoline = 0;
BYTE shellcode[] =
{
0x50, // push rax
0x48, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // mov rax, TARGET
0x48, 0x87, 0x04, 0x24, // xchg QWORD P... |
//
// SMButton.h
// SMFrameWork
//
// Created by KimSteve on 2016. 11. 4..
//
//
#ifndef SMButton_h
#define SMButton_h
#include "SMView.h"
#include <2d/CCLabel.h>
class ShapeSolidRect; // for under line
class SMButton : public _UIContainerView
{
public:
SMButton();
virtual ~SMButton();
// button s... |
#ifndef DE_RENDERBUFFER_H
#define DE_RENDERBUFFER_H
#include "export.h"
#include "core/CountedObject.h"
#include "data/Texture.h"
#include <gl/glew.h>
#include <list>
namespace de
{
class DE_EXPORT RenderBuffer
{
protected:
unsigned int mWidth;
unsigned int mHeight;
GLuint mID;
int mCurrentAttacheme... |
class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
vector<vector<int>> result;
sort(nums.begin(), nums.end());
int sz = nums.size();
int temp;
for(int first = 0; first < sz; first++)
{
if(first > 0 && nums[first] == nums[... |
#include "common.h"
#include "randgen.h"
namespace {
float glc(float crd, float crd0, float acrd) {
return (crd - crd0)/acrd;
}
//line обязательно валидная
float getSingleLambdaCoeff(const line &l, const QVector3D &p) {
if (l.ax != 0) {
return glc(p.x(), l.x0, l.ax);
} else if (l.ay != 0) {
... |
/**
* Copyright (C) 2017 Alibaba Group Holding Limited. 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
*
* ... |
// Copyright Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
========================================================================... |
#include "SaveLoad.h"
void SAVE(void* addressOfObject, const int sizeOfClass, ofstream& out)
{
out.write(reinterpret_cast<char*>(addressOfObject), sizeOfClass); //write
}
void LOAD(void* addressOfObject, const int sizeOfClass, ifstream& in) {
in.read(reinterpret_cast<char*>(addressOfObject), sizeOfClass);
}
|
/////////////////////////////////////////////////////////////////////////////////////////
// FILE NAME: Control.cpp
//
// DESCRIPTION: CONTROL Class implementation. This class handles the two Status Registers
// and the Timers chips.
//
//////////////////////////////////////////////////////////////////////////////////... |
#include "Bool2.h"
Bool2::Bool2()
{
}
Bool2::Bool2(const bool _x, const bool _y) : x(_x), y(_y)
{
} |
#include "Score.h"
#include <QFont>
Score::Score(QGraphicsItem *parent)
: QGraphicsTextItem (parent) , playerScore{0}
{
setPlainText(QString::number(playerScore));
setDefaultTextColor(Qt::red);
setFont(QFont("times",20));
//create score player
scorePlayer = new QMediaPlayer();
score... |
#pragma once
#include "floor.h"
#include "roomCT.h"
#include "floorCT.h"
#include "player.h"
#include "playerCT.h"
class Game {
friend int main();
friend class Player;
private:
std::unordered_map<int, Floor> floors;
int floorHighestId{ 0 };
int currentFloor;
int currentRoom;
Playe... |
#include<bits//stdc++.h>
using namespace std;
int arr[100010],len = 0;
void find_min_max(int &mini,int &maxi)
{
for(int i = 0 ; i < len ; i++)
{
if(arr[i]<mini)
mini = arr[i];
if(arr[i]>maxi)
maxi = arr[i];
}
}
void devide_and_conquer_min_max(int i, int n, int &mini, ... |
#include "wizThumbIndexCache.h"
#include <QDebug>
#include "wizDatabaseManager.h"
#define WIZNOTE_THUMB_CACHE_MAX 1000
#define WIZNOTE_THUMB_CACHE_RESET 300
CWizThumbIndexCache::CWizThumbIndexCache(CWizExplorerApp& app)
: m_dbMgr(app.databaseManager())
{
qRegisterMetaType<WIZABSTRACT>("WIZABSTRACT");
c... |
#include <iostream>
using namespace std;
int main(){
int N;
cin >> N;
if (N%2 != 0) {
cout << "Weird" << endl;
} else if ( N%2 == 0) {
if ((N>=2) && (N<=6)) {
cout << "Not Weird" << endl;
} else if ((N>=6) && (N<=20)) {
cout << "Weird" << endl;
}... |
#include <cstdlib>
#include <cstdio>
#include <cassert>
#include <sched.h>
#include <numaif.h>
#define NUM_FUNCS 100000
typedef int (*Fptr) (int, int);
extern void libInit(Fptr*, int);
int driverMain(char* memAddress, int memSize)
{
Fptr funcArr[NUM_FUNCS] = {0};
// initializing function pointers.
libInit... |
#ifndef UTILS
#define UTILS
#include <bits/stdc++.h>
using namespace std;
double getSol(double a, double b, double c, double &t1, double &t2)
{
double d2 = b*b-4*a*c;
if(d2 < 0) return -1;
double d = sqrt(d2);
t1 = (-b-d)/(2*a);
t2 = (-b+d)/(2*a);
if(t1 > 0) return t1;
if(t2 > 0) return ... |
// ---------- SYSTEM INCLUDE --------------------------------------------------------------------- //
// ---------- EXTERNAL MODULE INCLUDE ------------------------------------------------------------ //
// N/A
// ---------- PROGRAMMING DEFINITION INCLUDE ----------------------------------------------------- //
// N/A
... |
/*
// Copyright 2007 Alexandros Panagopoulos
//
// This software is distributed under the terms of the GNU Lesser General Public Licence
//
// This file is part of Be3D library.
//
// Be3D is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public Licen... |
/*
Handle degenerate case of all 0s separately.
Start from top right. Keep doing until we reach last row: go down if current element is 0, go left otherwise.
Column number of final ptr is our answer.
*/
// In a binary matrix (all elements are 0 and 1), every row is sorted in ascending order (0 to the left of 1).
// ... |
#include"Enemy.h"
Enemy::Enemy() :GameObject(244,100,"enemy",1) {
}
Enemy::~Enemy() {
}
void Enemy::init() {
DDS_FILE* dds = readDDS("dds/enemy2.dds");
float x = dds->header.dwWidth*0.5;
float y = dds->header.dwHeight*0.5;
setAnchor(x, y);
setDDS(dds);
fireTime = 0;
fireRate = 1;... |
#pragma once
#include <EventListener.h>
#include <sc2api/sc2_common.h>
#include <set>
#include <glm/vec2.hpp>
class SC2;
class CannonRush : public EventListener
{
public:
~CannonRush();
CannonRush(SC2& api);
void step() override;
void unitCreated(const sc2::Unit* unit) override;
void buildingConstructionCo... |
/*
#include <iostream> // подключаем заголовочный файл iostream
int main() // определяем функцию main
{ // начало функции
setlocale(LC_ALL, ""); // функция поддержки кириллических символов
std::cout <<"Привет мир!"; // выводим строку на консоль
... |
#pragma once
#include <vector>
#include <utility>
namespace gms
{
template <typename T>
class matrix
{
public:
matrix(size_t rows, size_t cols);
T* data();
typename std::vector<T>::iterator begin();
typename std::vector<T>::iterator end();
T& operator()(size_t row, size_t col);
const T& operator()(size_t row,... |
#include "BackConverter.hpp"
#include "SliceMatcher.hpp"
using namespace type_to_vector;
void FlatBackConverter::setSlice(const std::string& slice) {
if ( mpMatcher ) {
delete mpMatcher;
mpMatcher = 0;
}
if (slice != "") mpMatcher = new SliceMatcher(slice);
}
FlatBackConverter::~FlatBa... |
// Copyright 2020-2021 Russ 'trdwll' Treadwell <trdwll.com>. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "SteamEnums.generated.h"
UENUM(BlueprintType)
enum class ESteamGameOverlayTypes : uint8
{
Friends,
Community,
Players,
Settings,
OfficialGameGroup,
Stats,
Achievements
};
UENUM(Bl... |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool comp(int i, int j){
return i > j;
}
int main(){
int n, k, num, sum = 0;
cin >> n >> k;
vector<int> v1;
vector<int> v2;
for(int a = 0; a < n; a++){
cin >> num;
v1.push_back(num);
}
for(int a =... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
for(int k = 1; k <= t; k ++){
int n;
cin >> n;
string in, out;
cin >> in >> out;
vector<vector<int>>adj(n, vector<int>(n, 0));
vector<int>graph[n];
for(int i = 0; i < n; i ++){
... |
#pragma once
#include <string>
#include <map>
#include <clang/Basic/SourceLocation.h>
// FIXME
using namespace clang;
struct ClassInfo {
SourceLocation loc;
std::string locStr;
std::string diagName;
ClassInfo(SourceLocation loc, std::string&& locStr, std::string&& diagName) :
loc(loc), locStr(std::move(l... |
/*
* Point.h
*
* Created on: May 17, 2017
* Author: muhammadhassnain
*/
#ifndef POINT_H_
#define POINT_H_
class Point {
int x;
int y;
public:
Point(int=-1,int=-1);
int getX();
int getY();
float distance(Point);
void setPoint(int,int);
bool operator==(Point);
};
#endif /* POINT_H_ */
|
/*====================================================================*
- Copyright (C) 2001 Leptonica. All rights reserved.
-
- 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 c... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.Gaming.UI.1.h"
WINRT_EXPORT namespace winrt {
namespace ABI::Windows::Foundation {
#ifndef WINRT_GENERIC_c50898f6_c536_5f47_8583_8b2c2438a13b
#define WINRT_GENERIC_c50898f6... |
#ifndef PARSERCONFIG_H
#define PARSERCONFIG_H
#include <QObject>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
class ParserConfig
{
public:
ParserConfig();
public slots:
QString GetParam(QByteArray, QString);
QVariant GetParamStandby(QByteArray, QString);
int GetRequestInterav... |
#ifndef _AUTOCALL_YIELDNOTE_LEAST_PERFORM_PAYOFF_H_
#define _AUTOCALL_YIELDNOTE_LEAST_PERFORM_PAYOFF_H_
#include "multiasset_autocall_payoff.h"
#include "cpn_freq.h"
#include <vector>
class ACYNLeastPerformPayoff: public MAACPayoff {
public:
/* Constructors and destructor */
ACYNLeastPerformPayoff();
ACYNL... |
/*
* This program is to demonstrate basic to class type conversion.
*/
#include<iostream> // Header
using namespace std;
class Vector { // Vector class
public:
Vector():x{0},y{0}{} // Default constructor.
Vector(int a){ // Constructor with one parameter, which work as basic to class type converter.
x=y... |
#pragma once
#include <exception>
#include <string>
#include <vector>
typedef unsigned int uint;
typedef unsigned char uchar;
class WorldException : public std::exception {
std::string mReason;
public:
WorldException(std::string reason) : mReason(reason) {}
const char *what() const noexcept override {retur... |
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
char datos[4];
void setup() {
radio.begin();
Serial.begin(115200);
//Abrimos un canal de escritura
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening()... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin>>n>>m;
int a[n], mn = n, ans = 0;
memset(a, -1, sizeof(a));
for(int i=0; i<m; i++)
{
int v;
cin>>v;
a[v] = 0;
mn = min(mn, v);
}
for(int i=mn+1; i<n; i++)
{
if(a[i]==-1) a[i] = a[i-1]+1;
}
for(int i=n-2; i>=0; i--)
{
if(a... |
#include "ARCH.h"
#include <intrin.h>
namespace ARCH {
unsigned long long GetCR3(void)
{
return __readcr3();
}
unsigned long long ReadMsr(unsigned long msrId)
{
return __readmsr(msrId);
}
void WriteMsr(unsigned long msrId, unsigned long long value)
{
__writemsr(msrId, value);
}
unsigned long GetCpuCou... |
/*
* Fichero de implementación listaPersonas.cc del módulo listaPersonas
*/
#include "../Persona/persona.h"
#include "listaPersonas.h"
/*
* Pre: ---
* Post: Devuelve una lista que no almacena ninguna persona, es decir,
* devuelve la lista <>
*/
ListaPersonas nuevaLista () {
ListaPersonas... |
// C++ program to implement recursive Binary Search
#include <bits/stdc++.h>
using namespace std;
// A recursive binary search function. It returns
// location of x in given array arr[l..r] is present,
// otherwise -1
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int... |
#pragma once
#include <stdint.h>
#include <math.h>
#include <vector>
#include "common.h"
#include "Sample.h"
template<typename T>
class SampleBuffer
{
public:
T Get(int index) const
{
if (index < 0)
{
if (m_samples.empty()) return T();
return m_samples.front... |
#include <iostream>
#include <vector>
using namespace std;
// o(n), with 2 ptr
void sortColors2(vector<int> &nums) {
int first = -1;
int second = nums.size();
if (second == 0)
return;
int cur = 0;
while (cur < second) {
if (nums[cur] < 1) {
first++;
swap(nums[first], nums[cur]);
cur++;
}
else i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.