text stringlengths 8 6.88M |
|---|
class Solution {
private:
int countSmaller(int m, int n, int target){
int count = 0;
for(int i=1;i<=n;i++){
if(m*i > target){
m--;
i--;
}
else
count += m;
}
return count;
}
public:
int findKthNumber(int m, int n, int k) {
int low = 1, high = m*n;
while(low <= high){
... |
#pragma once
#include "config/area_ip_ptts.hpp"
#include <string>
namespace pd = proto::data;
namespace pc = proto::config;
namespace nora {
namespace scene {
uint64_t parse_ip_to_int(const string& ip);
const pc::area_ip& fetch_area_ip_ptt(const string& ip);
}
}
|
//
// Created by 史浩 on 2020-01-12.
//
#ifndef NDK_OPENGLES_BASEEGLSURFACE_H
#define NDK_OPENGLES_BASEEGLSURFACE_H
#include "EGLCore.h"
#include <GLES2/gl2.h>
class BaseEGLSurface {
public:
BaseEGLSurface(EGLCore* eglCore);
~BaseEGLSurface();
//创建窗口Surface
void createWindowSurface(ANativeWindow* win... |
// Add the main
#define CATCH_CONFIG_MAIN
#include "externals/Catch/single_include/catch.hpp"
#undef CATCH_CONFIG_MAIN |
#include "pch.h"
//
union bgra8_t {
// v is ordered with blue being the least and alpha the most significant octett.
uint32_t v;
struct {
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
} c;
};
struct App : winrt::Windows::UI::Xaml::ApplicationT<App> {
void OnLaunched(const winrt::Windows::ApplicationModel::... |
#include "util.hpp"
#include <iostream>
void call() {
std::cout << "called" << std::endl;
} |
#include <iostream>
#include <vector>
using namespace std;
long long determinant(vector< vector<long long> > m)
{
long long ret = 0;
auto n = m.size();
if(n == 1) {
ret = m[0][0];
} else if(n == 2) {
ret = m[0][0] * m[1][1] - m[1][0] * m[0][1];
} else {
// 0 row expand
long long sign = 1ll;
// for eac... |
//Phoenix_RK
/*
https://leetcode.com/problems/rank-transform-of-an-array/
Given an array of integers arr, replace each element with its rank.
The rank represents how large the element is. The rank has the following rules:
Rank is an integer starting from 1.
The larger the element, the larger the rank. If two eleme... |
/*********************************************************************
** Author: Chris Matian
** Date: 07/20/2017
** Description: This is the class specification file for Taxicab which is included into Taxicab.cpp and possibly the int main() file.
*********************************************************************... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2008 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
*/
#include "core/pch.h"
#include "adjunct/quick/dialogs/SaveSessio... |
// Created on: 2014-10-20
// Created by: Denis BOGOLEPOV
// Copyright (c) 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 as pu... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2004 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
*/
#ifndef FORMVALUETEXTAREA_H
#define FORMVALUETEXTAREA_H
#incl... |
#ifndef __CAMERA_H__
#define __CAMERA_H__
#include "SDL/include/SDL.h"
#include "Obj_Player.h"
class Camera
{
public:
Camera();
void FollowPlayer(float dt, Obj_Player * player);
public:
SDL_Rect rect = { 0, 0, 0, 0 };//The actual camera coordinates in the world
SDL_Rect screen_section = { 0, 0, 0, 0 };//T... |
/*
* @lc app=leetcode.cn id=452 lang=cpp
*
* [452] 用最少数量的箭引爆气球
*/
// @lc code=start
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
int findMinArrowShots(vector<vector<int>>& points) {
int m = points.size();
if(m==0)return 0;
sort(... |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void out(vector<int> n){
for(auto i:n){
printf("%d ",i);
}
printf("\n");
}
int main(){
//int型の仮想配列を宣言
vector<int> n;
int youso[5] ={2,6,7,1,3};
for (int i = 0; i<5 ;i++){
//仮想配列に要素を詰め込む
... |
#include "worker.h"
Worker::Worker(int in_client) {
client = in_client;
//allocated buffer
buflen = 1024;
buf = new char[buflen+1];
cache = "";
}
Worker::~Worker() {}
vector<string>
Worker::split(const char *str, char c = ' ') {
vector<string> result;
do
{
const char *begin = str;
... |
// Created on: 1995-12-19
// Created by: Jean Yves LEBEY
// 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 GN... |
#include "appconfig.h"
AppConfig::AppConfig()
{
config = new QSettings(":/config.ini", QSettings::IniFormat);
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
config->setIniCodec(codec);
}
QStringList AppConfig::get(QString group)
{
qDebug() << "AppConfig::get -" << group;
this->config->begi... |
#include "ssVector4.h"
namespace ssMath
{
const Vector4 Vector4::ZERO(0,0,0,0);
} |
#pragma once
#include <iostream>
#include <map>
#include <string>
#include <variant>
#include <vector>
#include <iterator>
using namespace std;
namespace json {
class Node;
using Dict = map<string, Node>;
using Array = vector<Node>;
class ParsingError : public runtime_error {
public:
using runtime_error::runt... |
/*
* magpie_server.cpp
*
* Created on: 2019年8月27日
* Author: fxh7622
*/
#include <string.h>
#include "protocol.h"
#include "interface.h"
#include "main_thread.h"
#include "express_server.h"
const char* VERSION = "1.1.2";
#if defined(_WIN32)
EXPRESS_SERVER_LIB bool open_server(char *bind_ip, int listen_po... |
#ifndef LUA_SYSTEM_H
#define LUA_SYSTEM_H
#include "../Internal/SingletonTemplate.h"
#include <lua.hpp>
#include <map>
class LuaSystem : public SingletonTemplate<LuaSystem>
{
public:
LuaSystem();
~LuaSystem();
void Init();
void Exit();
float GetField(lua_State*, const char*);
int GetIntValue(lua_State*, cons... |
#include <iostream>
#include <sstream>
#include <bitset>
#include <vector>
using namespace std;
struct Tile {
//This tile object is flexible enough to represent
// 1. A wooden tile piece on our rack
// 2. A wooden tile piece placed on the board
// 3. A blank spot on the board
char letter; //tile... |
#if !defined(AFX_POLLINGPPG_H__D44628CF_9282_11D3_B19B_0000E87780F5__INCLUDED_)
#define AFX_POLLINGPPG_H__D44628CF_9282_11D3_B19B_0000E87780F5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PollingPpg.h : Declaration of the CPollingPropPage property page class.
/////////////////////////////... |
//
// Created by new on 2016/11/9.
//
#ifndef HTTPSVR_LIB_IP_H
#define HTTPSVR_LIB_IP_H
#include <string>
#include <vector>
#include <map>
using namespace std;
class Lib_Ip {
public:
static FILE* fp;
static map<string, vector<string> > cached;
static char *index;
static int offset;
static bool... |
#include "dds_uuid.h"
#include "rotate_state_publisher.h"
CRotateStatePublisher::CRotateStatePublisher()
{
}
CRotateStatePublisher::~CRotateStatePublisher()
{
DDS_String_free(m_pDataInstance->id);
}
bool CRotateStatePublisher::Initialize()
{
CDdsUuid uuid;
uuid.GenerateUuid();
m_pDataInstance->id = ... |
#include "transform.h"
#include <iostream>
namespace hdd::gamma
{
FormatType::FormatType() :
type(Undefined), inputs(0), outputs(0)
{}
FormatType::FormatType(Transformation_Type t, uint32_t in, uint32_t out) :
type(t), inputs(in), outputs(out)
{}
Transform::Transform(const RawDat... |
#include "TestGameSystem.h"
TestEntity::TestEntity(void)
{
}
TestEntity::~TestEntity(void)
{
}
void TestEntity::Init()
{
RegisterComponent(&tf);
//render.renderInfo.matrix = &tf.matrix;
// was model matrix, now coords...
//render.renderInfo.uniforms[0].valueFloat = &(render.renderInfo.matrix->m[0]);
Regi... |
#pragma once
#define _CRT_SECURE_NO_WARNINGS
enum LoggingMessageType {
Debug,
Info,
Error,
Warning
};
#ifndef LOGGER_H
#define LOGGER_H
#include <string>
#include <stdio.h>
#include <cstdarg>
using namespace std;
class cLogger
{
public:
cLogger();
~cLogger();
#ifdef _DEBUG
void Log(LoggingMessageType logT... |
#include <iostream>
using namespace std;
const int maxn = 10005;
int a[maxn], b[maxn];
int main() {
int n, l;
while(~scanf("%d %d", &n, &l)) {
int j = 0, cnt = 0;
for(int i = 0; i < n; i++) {
scanf("%d", a[i]);
}
for(int i = 0; i < n; i++) {
if(a[i] % 2 == 0)
b[j++] = a[i];
}
... |
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A0, INPUT);
auto ms = micros();
for (int i = 0; i < 1000; ++i)
analogRead(A0);
ms = micros() - ms;
Serial.println(ms);
ms = micros();
for (int i = 0; i < 1000; ++i)
digitalRead(A0);
ms = micros() - ms;
Se... |
#include "BaseDescriptor.h"
BaseDescriptor::BaseDescriptor()
{
}
BaseDescriptor::~BaseDescriptor()
{
}
|
#include "stdafx.h"
#include "FST.h"
#include <iostream>
FST::NODE::NODE()
{
n_relation = 0;
RELATION *relations = NULL;
}
FST::NODE::NODE(short n, RELATION rel, ...)
{
n_relation = n;
RELATION *ptrrel = &rel;
relations = new RELATION[n];
for (short i = 0; i < n; ++i)
relations[i] = ptrrel[i];... |
bool cmp(struct Job a, struct Job b) {
// if(a.dead == b.dead) return a.profit > b.profit;
return a.profit > b.profit;
}
pair<int,int> JobScheduling(Job arr[], int n)
{
// your code here
sort(arr, arr+n, cmp);
for(int i=0; i<n; i++) {
cout << arr[i].id << " " << arr[i].dead << " " << arr[... |
#include "cDalek.h"
#include <iostream>
#include "globalStuff.h"
DWORD WINAPI UpdateDalekPosition(void* pInitialData)
{
cDalek* pDalek = (cDalek*)pInitialData;
while (true)
{
pDalek->update(pDalek->dt);
}
return 0;
}
cDalek::cDalek(cGameObject * dalekOb, std::vector<glm::vec3> vecInBlocks, gl... |
int minimumNumberOfDeletions(string s1) {
int x=s1.size();
int y=s1.size();
string s2 = s1;
reverse(s2.begin(),s2.end());
int dp[x+1][y+1];
for(int i =0;i<x+1;i++) dp[i][0]=0;
for(int i =0;i<y+1;i++) dp[0][i]=0;
for(int i = 1;i<x+1;i++){
for(i... |
#pragma once
#include <map>
#include "bitmap.h"
class CartFile;
class LevelProperties;
class LevelStyle;
class TilePalette;
class TileParts :
public BitmapSurface
{
public:
TileParts();
~TileParts();
bool Load(CartFile& cart, HDC hdc, const LevelProperties& prop,
const LevelStyle& ... |
// This file was generated based on /Users/r0xstation/18app/src/.uno/ux13/app18.unoproj.g.uno.
// WARNING: Changes might be lost if you edit this file directly.
#include <_root.app18_TextInputPrice_Value_Property.h>
#include <_root.TextInputPrice.h>
#include <Uno.Bool.h>
#include <Uno.UX.IPropertyListener.h>
#include ... |
/**
* @file ADC_API.cpp
* @brief Contém as funções que retorna o valoro de uma porta ADC
*/
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iostream>
using namespace std;
/**
* Lê porta analógica de entrada AIN
* @param ain Número da porta em formato... |
#include<bits/stdc++.h>
using namespace std;
class CircularQueue{
public:
int rear,front,size,*arr;
CircularQueue(int s){
front = rear= -1;
size = s;
arr = new int[s];
}
void enqueue(int data){
if(front==0&&rear==size-1||(rear==(front-1)%(size-1))){
... |
//**************************************************************************
// File......... : ChannelManager.cpp
// Project...... : VR
// Author....... : Liu Zhi
// Date......... : 2018-10
// Description.. : implementation file for cla... |
#include "powerOfTwo.h"
long int recursTwoToTheN(long int n)
{
long int retVal;
if(n <= 0)
{
return 1;
}
retVal = recursTwoToTheN(n - 1) + recursTwoToTheN(n - 1);
return retVal;
}
void computeTwoToTheN()
{
printf("Enter in a value for n greater than or equal to 0: ");
char *usrIn = (char *) malloc(sizeof... |
/*
* 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... |
// Created on: 2002-12-12
// Created by: data exchange team
// Copyright (c) 2002-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... |
#pragma once
#include "PrologInterface.h"
namespace testcommon {
PrologFunctor is_alpha_pred(PrologTerm alpha);
PrologFunctor is_vowel_pred(PrologTerm alpha);
PrologFunctor next_alpha_pred(PrologTerm alpha, PrologTerm next);
void addTestFacts();
int numSolutionsFor(PrologFunctor functor);
}
|
#ifndef TRANF_ENTRADA
#define TRANF_ENTRADA
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int trans_entrada(string valor){
string str = valor;
for(int i=0; i< (int) str.size(); i++)
{ // Converte cada caracter de Str
str[i] = toupper ... |
/**
* @file np_sin_f4_sw.cc
* @author Gerbrand De Laender
* @date 04/05/2021
* @version 1.0
*
* @brief E091103, Master thesis
*
* @section DESCRIPTION
*
* Single precision (f4) implementation.
*
*/
#include <hls_math.h>
#include "np_sin_f4.h"
void np_sin_f4_sw(float *ina, float *outa, len... |
#include "gmock/gmock.h"
#include "simpleProtocolParser.h"
using namespace testing;
class SimpleProtocolParserStub : public SimpleProtocolParser
{
public:
SimpleProtocolParserStub() { trace = ""; }
std::string getTrace() { return trace; }
private:
std::string trace;
void receptionStart... |
#include "I2CRemoteControl.h"
I2CRemoteControl::I2CRemoteControl(uint8_t address): address(address) {
// blah blah
}
void I2CRemoteControl::init() {
Wire.begin(address);
}
void I2CRemoteControl::onReceive() {
type = Wire.read();
mode = Wire.read();
pin = Wire.read();
if (mode == 'W') {
pinMode(pin, OUTPUT);
... |
// Copyright (c) 2023 ETH Zurich
//
// 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)
#pragma once
#include <pika/config/export_definitions.hpp>
#include <pika/modules/logging... |
//
// Rock.h
// GetFish
//
// Created by zhusu on 15/3/11.
//
//
#ifndef __GetFish__Rock__
#define __GetFish__Rock__
#include "cocos2d.h"
#include "Actor.h"
USING_NS_CC;
class Rock : public Actor
{
public:
static Rock* create(const char* name,int hp);
virtual bool init(const char* name,int hp)... |
#include "MainScene.h"
#include "MyCube.h"
#include "AAInput.h"
MainScene::MainScene() : AAScene()
{
MyCube* cube = new MyCube("body");
this->objects.push_back(cube);
}
MainScene::~MainScene()
{
}
void MainScene::update()
{
for (AAObject* obj : this->objects)
obj->update();
if(AAInput::isKeyDown(GLFW_KEY_U... |
/* leetcode 142
*
*
*
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
if (!head) {
return false;
}
ListNo... |
// CalcFactorialNumb.cpp : This file contains the 'main' function. Program execution begins and ends there.
//When using for loops, you should know the number of itereation you will need.
#include <iostream>
using namespace std;
void main()
{
int number;
cout << "Number:";
cin >> number;
int factorial = 1;
if (... |
//
// EPITECH PROJECT, 2018
// nanotekspice
// File description:
// simulate chipsets
//
#include "Components.hpp"
Components::Components()
{
this->init_component_tab();
}
Components::~Components()
{
}
void Components::init_component_tab()
{
this->_my_components.push_back("4001");
this->_my_components.push_b... |
// loader.cc
// 1/27/2013
#include "config.h"
#include "loader.h"
#include "driver/maindriver.h"
#include "windbg/inject.h"
#include "windbg/util.h"
#include "hijack/hijackmodule.h"
#include "qtembedplugin/pluginmanager.h"
#include "util/location.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QTextCodec>
#ifd... |
#include <RcppArmadillo.h>
#include <RcppArmadilloExtensions/sample.h>
#include <Rmath.h>
#include <omp.h>
using namespace arma;
using namespace Rcpp;
using namespace std;
// [[Rcpp::plugins(openmp)]]
// [[Rcpp::depends("RcppArmadillo")]]
void update_theta(arma::mat &theta_t, const arma::mat &y_t, const arma::mat &m... |
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "../interpreter.h"
#include "standard.h"
#include "reference.h"
using namespace std;
void init_io(map<string, NFunction*> &native) {
native["write"] = new NFunction(&write);
native["get_i"] = new NFunction(&::get_int);
native["get_r"] = new NFunction... |
#include <iostream>
using namespace std;
int display(int (*arr)[3]){
return *(*arr + 1);
}
int main() {
int arr[3][3] = {1,2,3,4,5,6,7,8,9};
int * p = *arr;
cout << *(*arr + 1) << endl;
cout << "===============" << endl;
cout << display(arr) << endl;
return 0;
}
|
#pragma once
class UdpDealer;
class HVDev;
typedef boost::shared_ptr<boost::asio::deadline_timer> TimerPtr;
class AsyncIO : public FGST<AsyncIO>
{
static boost::asio::io_service _ioService;
boost::shared_ptr<boost::asio::deadline_timer> _timer;
boost::asio::ip::udp::resolver _resolver;
... |
#ifndef GREEDY_THINKER_H_INCLUDED
#define GREEDY_THINKER_H_INCLUDED
#include "tracker_thinker.h"
struct GreedyThinker final : TrackerThinker
{
protected:
Response decideResponse(int guess) const override;
};
#endif // GREEDY_THINKER_H_INCLUDED
|
vector<int> solution(string &S, vector<int> &P, vector<int> &Q) {
// write your code in C++14 (g++ 6.2.0)
vector<int> A((S.length()+1), 0);
vector<int> C((S.length()+1), 0);
vector<int> G((S.length()+1), 0);
vector<int> T((S.length()+1), 0);
for (size_t i =0; i<S.length(); i++){
//cout <... |
// 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 <iostream>
#include <cstring>
using namespace std;
int main() {
/*
* char* arr = {'a'};
char* arr2 = "abcd";
int iValue = 10;
int* ptr = {1,2,3,4};
*/
const char * charArray = "abcde";
charArray = "tuyr";
*charArray = 'o'; // run time error
cout << *charArray ... |
// 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 ... |
#pragma once
#include "../vector-all.h"
#include "provider.h"
#include <functional>
namespace sbg {
template <int n>
struct ComponentProvider {
ComponentProvider(Provider<Vector<n, double>> position, Provider<Vector<freedom(n), double>> orientation);
Vector<freedom(n), double> getOrientation() const;
Vector<n, ... |
#ifndef TEST_H
#define TEST_H
#include "init.h"
#include <algorithm>
int tipp = 0;
float ress = 0;
void test(int *sentence, int *testPositionE1, int *testPositionE2, int len, int e1, int e2, int r1, float &res, float *r) {
int tip[dimensionC];
for (int i = 0; i < dimensionC; i++) {
int last = i * dimension * w... |
/* -*- coding: utf-8 -*-
!@time: 2020/3/2 12:58
!@author: superMC @email: 18758266469@163.com
!@fileName: findIf_func.cpp
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
using namespace std;
struct C {
C() : v1(0), v2(0) {}
C(const int &val1, const int &val2) : v1(val1... |
#pragma once
#include "EverydayTools/Exception/CallAndRethrow.h"
#include "EverydayTools/Exception/ThrowIfFailed.h"
#include "Keng/Base/Serialization/Serialization.h"
#include "yasli/Archive.h"
namespace keng
{
template<typename T>
inline void SerializeMandatory(Archive& ar, T& val, const char* name = "") {
... |
#pragma once
#include <QMutex>
#include <QMap>
#include <QPoint>
#include "Bubble.h"
class BubbleManager: public QObject
{
Q_OBJECT
public:
BubbleManager(QWidget* parent = Q_NULLPTR);
~BubbleManager();
Bubble* addBubble();
void lock();
void unlock();
public slots:
void removeBubble(Bubble& bubble);
public... |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> soliDatos() ;
int factorial( int ) ;
vector<int> burbuja( vector<int> ) ;
void mostrarVector( vector<int> ) ;
int main()
{
vector<int> lista ;
int valor = 0 ;
lista = soliDatos() ;
cout << "... |
#include "stdafx.h"
#include "../EditTool.h"
#include "../Editor.h"
#include "../Resource.h"
#include "../TerrainPaintDialog.h"
#include "TerrainPaintTool.h"
IMPLEMENT_DYNCREATE(CTerrainPaintTool, CEditTool)
CTerrainPaintTool::CTerrainPaintTool()
: mBrushType(E_TERRAIN_PAINT_NULL_TYPE),
mbBeginEdit(... |
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;
struct path
{
int dest;
double time;
};
struct node
{
double shortest;
int pred;
bool flag;
path link[8];
};
struct stop
{
int index;
stop *next;
};
struct chromosome
... |
/*
ID: stevenh6
TASK: beads
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
#include <list>
#include <algorithm>
using namespace std;
int n;
int cutOff = 0;
int evalLeft(string beads) {
char set = 'w';
int count = 0;
for (int i = 0; i < n; i++) {
if (set == 'w') {
set = beads[i... |
#include <iostream>
#include "triangle.h"
Triangle::Triangle() {
t0 = Vector(0, 0, 0);
t1 = Vector(-1, -1, 0);
t2 = Vector(1, -1, 0);
tnormal = Vector(0, 0, 1);
col.x = col.y = col.z = 1.0f;
spec = 0.4f;
refl = 0.1f;
}
Triangle::Triangle(Vector a0, Vector a1, Vector a2, Vector nor) {
t0 = a0;
t1 = t1;
t2 =... |
#include "utils.hpp"
#include "achievement_ptts.hpp"
#include "quest_ptts.hpp"
namespace pc = proto::config;
namespace nora {
namespace config {
achievement_ptts& achievement_ptts_instance() {
static achievement_ptts inst;
return inst;
... |
// Copyright (c) 2016 peposso All Rights Reserved.
// Released under the MIT license
#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <memory>
#include "xlsx.hpp"
#include "utils.hpp"
#include "yaml_config.hpp"
#include "arg_config.hpp"
#... |
#pragma once
#include "../render/Program.h"
#include "../render/ScreenRectangle.h"
#include "../render/FrameBuffer.h"
#include "../render/Texture.h"
#include "../math/FourierTransform_GPU.h"
#include "../scene/Settings.h"
#include "Animator.h"
//----------------------------------------------------------------------... |
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 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
* the Free Software Foundati... |
#ifndef ROOT_THcDriftChamber
#define ROOT_THcDriftChamber
///////////////////////////////////////////////////////////////////////////////
// //
// THcDriftChamber //
// ... |
//: C10:NamespaceMath.h
// Kod zrodlowy pochodzacy z ksiazki
// "Thinking in C++. Edycja polska"
// (c) Bruce Eckel 2000
// Informacje o prawie autorskim znajduja sie w pliku Copyright.txt
#ifndef NAMESPACEMATH_H
#define NAMESPACEMATH_H
#include "NamespaceInt.h"
namespace Math {
using namespace Int;
Integ... |
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <string>
#include <random>
using namespace std;
/*
*** *** Function: kmeans算法的一般实现(C++)
*** *** Author : TheDetial
*** *** Platform: win10+vs2013/ macOs+g++11
*** *** Time : 2021/8/6、2021/8/9
*** *** Result : 已通过
*** *** W... |
#include "vulkan_shader.h"
#include "extern\glslang\SPIRV\CInterface\spirv_c_interface.cpp"
static_func bool LoadShader(char *filepath)
{
} |
/*
* Copyright (c) 2020 sayandipde
* Eindhoven University of Technology
* Eindhoven, The Netherlands
*
* Name : image_signal_processing.cpp
*
* Authors : Sayandip De (sayandip.de@tue.nl)
* Sajid Mohamed (s.mohamed@tue.nl)
*
* Date : March 26, 2020
*
* Function ... |
#include <dmsdk/sdk.h>
#include "defos_private.h"
#if defined(DM_PLATFORM_WINDOWS)
#include <atlbase.h>
#include <atlconv.h>
#include <WinUser.h>
#include <Windows.h>
// keep track of window placement when going to/from fullscreen or maximized
static WINDOWPLACEMENT placement = {sizeof(placement)};
// used to check... |
#include "Mage.h"
size_t MageHealth[] = { 0, 15, 100, 20, 24, 28, 30, 31, 33, 35, 37, 42, 47, 55, 60, 65, 71, 80, 81, 82, 85 };
size_t MageAttack[] = { 0, 15, 17, 19, 21, 25, 29, 34, 37, 40, 44, 50, 56, 64, 66, 70, 75, 80, 83, 84, 89 };
float MageDefence[] = { 0.f, 1.0f, 1.4f, 1.8f, 2.2f, 2.6f, 3.0f, 4.f, 4.4f, 4.8f,... |
/*
--------------------------------------------------------------------
CS215-401 Lab Exam 1 Practice - 401
Andrew Cassidy
--------------------------------------------------------------------
*/
#include<iostream>
#include<string>
using namespace std;
int main() {
// Prob... |
/*
* SpaceInvaders.cpp
*
* Created: 07.08.2015 21:41:01
* Author: Tobias Nuss
*/
#include <stdint.h>
#include "MyLedMatrix.h"
#ifndef __SPACEINVADERS_H__
#define __SPACEINVADERS_H__
class SpaceInvaders : public MyLedMatrix
{
public:
SpaceInvaders(char qb, uint8_t h, uint8_t w, uint8_t l, uint8_t p, uint8_t t=N... |
#ifndef ITEM_H
# define ITEM_H
# include "dice.h"
# include "dungeon.h"
class item {
public:
char symbol;
pair_t position;
int color;
int weight;
int hitpoints;
int damage;
int attribute;
int value;
int dodge;
int defence;
int speed;
int rarity;
bool artifact;
};
#endif
|
#ifndef AWS_REFERENCE_CPP
#define AWS_REFERENCE_CPP
/*
* aws/parser.cpp
* AwesomeScript Reference
* Author: Dominykas Djacenka
* Email: Chaosteil@gmail.com
*/
/* ==============================================================================
* R E F E R E N C E CLASS
* ========================================... |
// Created on: 1991-07-23
// Created by: Christophe MARION
// 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 ... |
/*
replay
Software Library
Copyright (c) 2010-2019 Marius Elvert
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<bits/stdc++.h>
using namespace std;
int m,n;
int a[101][101];
void input(){
cin >> m >> n;
for(int i = 0; i < m; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
}
bool isMaxInRow(int iC, int jC){
int c = a[iC][jC];
for(int i = 0; i < n; i++){
if(a[iC][i] > c)
return false;
}
... |
#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
#define N 1000
bool flagTable[N];// 第n列有没有
int P[N];// 第N个在P[n]列
int count = 0;
void generateP(int index, int n){ // index 行
if (index == n + 1) {
count ++;
return;
}
for (int x = 1; x <= n; x++) { // 列
if ... |
#include<iostream>
using namespace std;
class A
{
int a,b;
public:
A(int i,int j) {a=i;b=j;}
int c;
friend class B;
};
class B
{
public: int min(A x);
};
int B::min(A x)
{
x.c=30;
cout<<x.c<<endl;
return x.a < x.b ? x.a : x.b ;
}
int main()
{
A a(3,4);
B b;
cout<<b.min(a)<<endl;
}
|
#include<iostream>
#include<vector>
using namespace std;
//双指针法
class Solution1 {
public:
int removeDuplicates(vector<int>& nums) {
int i = 0, j; //两个指针i和j,i是慢指针,j是快指针
int len = nums.size();
if (len == 0)
return 0;
//循环扫描整个nums数组,遇到重复项j++跳过,遇到不重复项nums[j]复制到nums[i+1],所以最后0到i都是不重复项
for (j = 1; j < len; j++... |
// Created on: 1997-03-04
// Created by: Robert COUBLANC
// 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 GN... |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;
#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define r... |
#ifndef WINDOWSAVETEXTFILE_HH_
#define WINDOWSAVETEXTFILE_HH_
#include "WindowSaveFile.hh"
/** A pop-up window to save a text file. */
class WindowSaveTextFile : public WindowSaveFile
{
public:
WindowSaveTextFile(const PG_Widget *parent, const std::string &content)
: WindowSaveFile(parent, "Save Text File"... |
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<n;i++)
#define FORn1(i,n) for(ll i=1;i<=n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007;
using namespace std;
int main() {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.