text stringlengths 8 6.88M |
|---|
class Solution {
public:
double myPow(double x, int n) {
if(n == 0 || x == 1.0) return 1;
if(x == 0.0 && n < 0) return x; // 当x是0而n是负数的时候,特殊情况
double res = 1.0;
long exp = n; // 必须是long,否则如果n=INT_MIN,-n就会越界
if(n < 0)
{
x = 1 / x;
exp = - exp;
... |
/**
*
* @file KondoB3MControlTable.hpp
* @brief Kondo B3M device control table
* @auther Yasuo Hayashibara
*
**/
#pragma once
#include "../../../Communicator/Protocols/KondoB3M.hpp"
namespace IO {
namespace Device {
namespace Actuator {
namespace ServoMotor {
namespace B3MSC1170AControlTable {... |
#include <stdio.h>
#include <iostream>
#include <assert.h>
#include <string.h>
#include <queue>
#include <vector>
#include <sys/time.h>
#include <time.h>
#include "sample_receiver.h"
#include "../shared/protocol.h"
#include "log.h"
#include "ring_buffer.h"
using namespace std;
using namespace base;
SampleReceiver::S... |
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <string>
#include <vector>
#include "Bote.h"
using namespace std;
enum TamanioBote { Submarino = 2, Destruidor = 3, Battleship = 4, Carrier = 5 };
void impBorda(int m[][10]);
void inMatriz(int m[][10]);
void impBordaJuego(int m[][10]);
int co... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
string a;
vector<int> b(0);
int c[201]={0};
cin>>a;
for(int i=0;i<a.length();i++)
{
int count =0,index ;
for(int j=0;j<b.size();j++)
{
if(a[i] == b[... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int const N = 55;
string g[N];
int row[N][N], col[N][N];
void solve(){
int n;
cin >> n;
memset(row, 0, sizeof row);
memset(col, 0, sizeof col);
for(int i = 0; i < n; i++){
cin >> g[i] ;
}
for(int r = n - 1; r >= ... |
#ifndef ENEMY_H
#define ENEMY_H
#include <QImage>
#include <QRect>
class enemy
{ //TEMPLATE ENEMY CLASS
public:
enemy();
enemy(int, int);
~enemy();
int getXDir();
int getYDir(); // X AND Y GETS AND SETS
void setXDir(int);
void... |
#include <iostream>
#include <queue>
#include <set>
#include "Graph.h"
using namespace std;
template <typename T>
bool hasLoops(const Graph<T>& g)
{
for (const T& v : g.vertices())
{
if (g.hasEdge(v, v))
{
return true;
}
}
return false;
}
template... |
../../Lib/matrix.cpp |
#ifndef PNRD_H
#define PNRD_H
#include "PetriNet.h"
#ifndef MAX_NUM_OF_TAG_HISTORY_ENTRIES
#define MAX_NUM_OF_TAG_HISTORY_ENTRIES 10
#endif
enum class PetriNetInformation {
TOKEN_VECTOR = 0,
ADJACENCY_LIST = 1,
FIRE_VECTOR = 2,
CONDITIONS = 3,
TAG_HISTORY = 4,
DESIRED_STATE = 5
};
enum c... |
/*
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 "Combat.h"
#include "Bitmap.h"
#include "ScreenMainGame.h"
#include "ActionExecutor.h"
#include "CombatUI.h"
#include "CombatSuccess.h"
#include "ResLevelupChain.h"
#include "ActionPhysicalAttackAll.h"
#include "ActionPhysicalAttackOne.h"
#include "SaveLoadStream.h"
Combat::Combat()
:mIsEnable(false), mI... |
#include "CEndSuccess.h"
#include "CLabel.h"
#include "CText.h"
#include "CButton.h"
#include "CBaseEngine.h"
#include "CSubmitScore.h"
CEndSuccess::CEndSuccess():
CCenteredWindow(vec2d(500,350),"",65.,false)
{
addChild(new CLabel(vec2d(20.,20.), vec2d(getW()-40., 60.), "Výborně!", true, CLabel::ALIGN_... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
WINRT_EXPORT namespace winrt {
namespace ABI::Windows::Security::Authentication::Web::Core {
struct IWebAccountEventArgs;
struct IWebAccountMonitor;
struct IWebAuthenticationCoreManagerStati... |
#ifndef __DailyBonus_H__
#define __DailyBonus_H__
#include "cocos2d.h"
#include "LBLibraryBase.h"
#include "TipDialog.h"
class DailyBonus : public TipDialog
{
private:
bool m_completed;
static int checkDays();
static int getDays();
int m_days;
static DailyBonus *create(int days);
//void s... |
//
// Compiler/Diagnostics/FileRange.cpp
//
// Brian T. Kelley <brian@briantkelley.com>
// Copyright (c) 2011 Brian T. Kelley
//
// This software is licensed as described in the file LICENSE, which you should have received as part of this distribution.
//
#include "Compiler/Diagnostics/FileRange.h"
#include <sstream>
... |
// This file has been generated by Py++.
#include "boost/python.hpp"
#include "generators/include/python_CEGUI.h"
#include "MouseCursorEventArgs.pypp.hpp"
namespace bp = boost::python;
struct MouseCursorEventArgs_wrapper : CEGUI::MouseCursorEventArgs, bp::wrapper< CEGUI::MouseCursorEventArgs > {
MouseCursorEven... |
/*
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... |
// reverse stack
#include<iostream>
#include<stack>
using namespace std;
stack<int> reverseStack(stack<int> s1){
stack<int> s2;
while(!s1.empty()){
s2.push(s1.top());
s1.pop();
}
return s2;
}
void display(stack<int> s){
while(!s.empty()){
cout<<s.top()<<" ";
s.pop(... |
//输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。例如,输入”They are students.”和”aeiou”,
//则删除之后的第一个字符串变成”Thy r stdnts.”
#if 0
#include<iostream>
#include<string>
int main()
{
std::string s1, s2, res;
std::getline(std::cin, s1);
std::getline(std::cin, s2);
int hashtable[256] = { 0 };
for (int i = 0; i < s2.size(); i++)
hashtable[s2[... |
/***********************************************************************
* created: 11/6/2011
* author: Martin Preisler
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2011 P... |
#ifndef _INC_RPG2K__AUDIO__AUDIO_2D__HPP
#define _INC_RPG2K__AUDIO__AUDIO_2D__HPP
#include <SDL_mixer.h>
#include <set>
#include <map>
#include "Material.hpp"
namespace rpg2kLib
{
class Main;
namespace structure
{
class Music;
class Sound;
}
#define PP_allSoundType(func) func(wav)
#define PP_allMusicTy... |
// ----------------------------------------------------------------------
// Filename Compression.cpp
// Created by Rakkar Software (rakkar@jenkinssoftware.com) September 25, 2003
// Demonstrates how to use compression with the standard chat example.
// The first time you run this you won't have frequency tables, s... |
#pragma once
#include <cstddef>
namespace Lynx
{
namespace SmartPtr
{
template<typename T>
class ScopedArr
{
public:
ScopedArr(ScopedArr&) noexcept = delete;
ScopedArr(ScopedArr&&) noexcept = delete;
ScopedArr(const ScopedArr&) noexcept = delete;
ScopedArr(const ScopedArr&&) noexcept = delet... |
/*=========================================================================
Library : packages
Module : $RCSfile: shreg.cc,v $
Authors : Daniel Rueckert
Copyright : Imperial College, Department of Computing
Visual Information Processing (VIP), 2000-2001
Purpose :
Date : $Date: 2... |
#pragma once
#include "viewport.h"
namespace GLPlay {
class PerspectiveViewport : public Viewport {
public:
PerspectiveViewport(int width, int height, float fov);
virtual void Update();
private:
float fov_;
};
} |
#ifndef BSCHEDULER_DAEMON_FACTORY_SOCKET_HH
#define BSCHEDULER_DAEMON_FACTORY_SOCKET_HH
#define BSCHEDULER_UNIX_DOMAIN_SOCKET "\0BSCHEDULER"
#endif // vim:filetype=cpp
|
#include "CGame.h"
#include "CBaseEngine.h"
#include "DescriptorList.h"
#include "gui/CEndFailure.h"
#include "gui/CEndSuccess.h"
void CGame::init(){
isBackground = false;
m_time = 0;
}
void CGame::spawn(){
engine->map->setMapAsBackground(isBackground);
CGuiPanel* hud = engine->gui->getHud();
... |
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "db/filename.h"
#include <ctype.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <iostream>
#include "db/dbformat.h"
#incl... |
#include <vector>
using namespace std;
class Solution {
public:
bool valid_num(int val) {
int ival = val;
while (ival) {
int tmp = ival % 10;
if (tmp == 0 || val % tmp != 0) return false;
ival /= 10;
}
return true;
}
vector<int> selfDividingNumbers(int left, int right) {
ve... |
#include <stdio.h>
#if defined flagWIN32 && defined flagMSC
#include <corecrt_io.h>
#endif
#ifdef flagPOSIX
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <sys/stat.h>
#endif
#ifdef flagWIN32
#define _WINSOCKAPI_
#include <windows.h>
#include <fi... |
#include "kernels/kernel_cpu.hpp"
#include "kernels/kernel_v2.hpp"
#if OCTORAD_HAVE_CUDA
#include "kernels/kernel_gpu.hpp"
#endif
#include "utils/fx_case.hpp"
#include "utils/fx_compare.hpp"
#include "utils/scoped_timer.hpp"
#include "utils/util.hpp"
#include <chrono>
#include <cstdio>
#include <random>
#include <rati... |
#include "stdafx.h"
#include"AktivesVO.h"
#include <iostream>
#include <list>
#include <map>
#include <string>
#include "ExceptionHandler.h"
using namespace std;
map <string, AktivesVO*> AktivesVO::mapAllObjects;
extern double dGlobaleZeit;
int AktivesVO::p_iMaxID = 1;
AktivesVO::AktivesVO() : p_sName(""), lokaleZeit... |
#pragma once
#ifdef _WIN32_WCE
# error CallStack cannot be used under Windows CE!
#endif
// includes
#include <vector>
#ifdef UNICODE
#define DBGHELP_TRANSLATE_TCHAR
#endif
#pragma warning(push)
#pragma warning(disable: 4091) // 'typedef ': ignored on left of '' when no variable is declared
#include <dbghelp.h>
#pr... |
class DisjointSet { // 并查集模板
public:
int father[1005];
void init(int n) {
for (int i = 0; i < n; i++) {
father[i] = i;
}
}
int find(int x) {
return x == father[x] ? x : father[x] = find(father[x]);
}
void union2(int x, int y) {
int rootX... |
/*=========================================================================
Library : packages
Module : $RCSfile: volumechange.cc,v $
Authors : Daniel Rueckert
Copyright : Imperial College, Department of Computing
Visual Information Processing (VIP), 2000-2004
Purpose :
Date : ... |
#include "Benchmark.hpp"
#include <algorithm>
#include <exception>
#include <iomanip>
#include <iostream>
#include <tuple>
using namespace std::chrono;
namespace Utils {
namespace Timing {
/* Static variables */
Benchmark * Benchmark::current = NULL;
Benchmark::Benchmark(Benchmark * f, const std::str... |
#ifndef ELEMENT_EXECUTOR_H
#define ELEMENT_EXECUTOR_H
#include <elements/element.h>
/**
* @brief Will perform the action on a given element
*/
class ElementExecutor {
public:
struct Data {
Element::ConstPtr element;
};
public:
/**
* @brief executes the given element
* @param data... |
#pragma once
#include <vector>
class RuleSet
{
public:
int getAmtOfNeighbours(int i, std::vector<bool*> field, int fieldWidth, int fieldHeight);
virtual std::vector<bool*> applyRules(std::vector<bool*> field, int fieldWidth, int fieldHeight) = 0;
RuleSet();
~RuleSet();
private:
std::vector<int> nrs1;
std::vecto... |
/*
Author: Градобоева Елизавета
Group: СБС-001-о-01
Task#: 9.11
*/
#include <iostream>
using namespace std;
class V_Coss {
public:
int n;
double* p;
V_Coss(int i, double x) {
n = i;
p = new double[n + 1];
p[0] = 1;
for (int k = 1; k <= n; k++) p[k] = p[k - 1] * -x * x / (2 * k * (2 * k - 1));
... |
//
// UnitNode.cpp
// Boids
//
// Created by Yanjie Chen on 3/2/15.
//
//
#include "UnitNode.h"
#include "../manager/ResourceManager.h"
#include "../scene/BattleLayer.h"
#include "../manager/AudioManager.h"
#include "../ArmatureManager.h"
#include "../BoidsMath.h"
#include "../AI/Terrain.h"
#include "../AI/Path.h"
... |
#include "DrawingBezierCycle.h"
#include "Logic.h"
#include <math.h>
DrawingBezierCycle::DrawingBezierCycle()
{
}
DrawingBezierCycle::DrawingBezierCycle(sf::Vector2f* position)
{
this->position = position;
}
DrawingBezierCycle::DrawingBezierCycle( float radius ,float x, float y, sf::Color color )
{
cycle = sf::Cir... |
#pragma once
#include <string>
using namespace std;
template<typename DT>
void readMatrix(string path, const string filename, DT*& arr, int* size, int dim);
template<typename DT>
void writeMatrix(string path, const string filename, DT* arr, int* size, int dim);
#include "io_implementation.h" |
/*********************************************************************
Matt Marchant 2014 - 2016
http://trederia.blogspot.com
xygine - Zlib license.
This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
liable for any damages arising from the use of this soft... |
#ifndef PATHAL
#define PATHAL
#include "Path.h"
#include "Pos.h"
#include "Map.h"
//#include "SMap.h"
#include "Util.h"
#define isInRange(i, j) (i > 0 && j > 0 && i < 29 && j < 32)
#define isValid(a) (a[0] > 0 && a[2] > 0 && a[1] < 28 && a[3] < 31)
class PathAl {
public:
// Path* getPath(set<Node*>* star, char... |
// This file has been generated by Py++.
#ifndef WindowFactoryIterator_hpp__pyplusplus_wrapper
#define WindowFactoryIterator_hpp__pyplusplus_wrapper
void register_WindowFactoryIterator_class();
#endif//WindowFactoryIterator_hpp__pyplusplus_wrapper
|
#include "parser.h"
#include "condenser.h"
#include "draw.h"
#include "labeller.h"
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[]) {
map<string, list<pair<string, int> > > callee_graph = parse(argv);
//We create a string to int indexing and use it fro... |
#include <stdio.h>
#include <string.h>
bool containsString(char *source, char *b){
//printf("%s %s\n", source, b);
char * found = strstr(source, b); /* should return 0x18 */
if (found != NULL) /* strstr returns NULL if item not found */
{
return true;
}
return false... |
//
// Created by twome on 08/05/2020.
//
#ifndef GAMEOFLIFE_OPENGL_MENUSCREEN_H
#define GAMEOFLIFE_OPENGL_MENUSCREEN_H
#include "../base/Screen.h"
class MenuScreen : public Screen {
public:
MenuScreen();
};
#endif //GAMEOFLIFE_OPENGL_MENUSCREEN_H
|
#include <iostream>
#define FMT_HEADER_ONLY 1
#include <cxxopts.hpp>
#include <fmt/format.h>
#include <stdexcept>
#include <string_view>
#include "matrix.h"
#include "utils.h"
#include "sort.h"
#include "utils.h"
#include "gpu_sort_driver.h"
#include "cpu_sort_driver.h"
#include "timer.h"
bool test_cpu(size_t rows,... |
#pragma once
#include <type_traits>
namespace MissionImpossible
{
template <typename T>
struct Always_True : std::true_type
{
};
template <typename T>
inline constexpr bool Always_True_v = Always_True<T>::value;
template <typename T>
struct Always_False : std::false_type
{
};
template <typena... |
/*
Copyright (c) 2013-2014 Sam Hardeman
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, dist... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,n) for (ll i=0;i<n;i++)
#define fr1(i,n) for(ll i=1;i<=n;i++)
int main()
{
ll m,n,i,j,k ,t;
cin>>t;
while(t--)
{
string s;
cin>>s;
n=s.size();
ll cntl=0, cntr=0, cntd=0, ... |
#include "../include/TextQuery.h"
#include "../include/Configure.h"
#include "../include/ReadFile.h"
#include "../include/EditDistance.h"
#include "../include/Redis.h"
#include <iostream>
#include <set>
#include <json/json.h>
#include <hiredis/hiredis.h>
using std::cout;
using std::endl;
using std::set;
using namespac... |
#pragma once
#include "headers.h"
void slashAtk(GameObject* obj, int dmg);
class Player : public Actor
{
private:
TIMER dodgeTimer;
bool dodge;
public:
Player(POINT p);
virtual void draw(HDC& hdc);
bool isDodge() { return dodge; }
void setDodge() { dodge = true; }
void unsetDodge() { dodge = false; }
bool ... |
#include <I2Cdev.h>
#include <MPU6050.h>
// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include <Wire.h>
#endif
// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter her... |
#include <iostream>
#include <exception>
#include <typeinfo>
using namespace std;
class A{virtual f(){};};
int main()
{
try
{
A *a=NULL;
typeid(*a);
}
catch(exception &e)
{
cout<<"Standard Exception "<<e.what();
}
system("pause");
return 0;
}
|
#ifndef __Block_H__
#define __Block_H__
#include "cocos2d.h"
USING_NS_CC;
class Block :public CCSprite
{
public:
//! block的尺寸.颜色. 字体内容.大小.颜色
static Block * create(CCSize size, ccColor3B color,
CCString str, float strSize, ccColor3B strColor);
bool init(CCSize size, ccColor3B color,
CCString str, float ... |
#ifndef CAMERA3D_H
#define CAMERA3D_H
#include "ICamera.h"
#include "DemoUtils/GLInclude.h"
class Camera3D : public ICamera
{
private:
float X = 20.0;
float Y = -20.0;
float Z = 20.0;
float CameraAngle = 0.0;
public:
virtual void Move(float dx,float dy,float dz) override
{
X += dx;
Y += dy;
Z += dz;... |
#include "ConvertSortedListToBinarySearchTree.hpp"
TreeNode *ConvertSortedListToBinarySearchTree::sortedListToBST(ListNode *head) {
this->head = head;
int len = list_len(head);
return sortedListToBST(0, len - 1);
}
TreeNode *ConvertSortedListToBinarySearchTree::sortedListToBST(int start,
... |
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... |
#include <iostream>
#include <fstream>
#include "Assignment4.h"
using namespace std;
//WORKS
void CommunicationNetwork::addCity(std::string newCityName, std::string previousCityName){
//cout << newCityName << " " << previousCityName << endl;
//INITIALIZE A CITY TO BE ADDED
City *nn = new City;
nn -> cityName... |
#include "SecretDoor/SecretDoor.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
// declare and initialize variables
SecretDoor game;
int playCount = 0;
int timesWon = 0;
string playerName;
// ask for player name and store into playerName
cout << "What is y... |
#include <Windows.h>
#include <TlHelp32.h>
#include <tchar.h>
#include "HOOK/HookAPIX.h"
XLIB::CXHookAPI g_hookLog;
XLIB::CXHookAPI g_hookMacFunc;
XLIB::CXHookAPI g_hookProcess32First;
XLIB::CXHookAPI g_hookProcess32FirstW;
int __cdecl Log(char *x1, int x2, int x3, char x4);
extern "C" __declspec(dllexport) void Test... |
#pragma once
#include <map>
#include "../utility/entity.h"
#include "../load/LoadFile.h"
#include "../load/AdditionalParsing.h"
class EntityManager : public LoadFile, public AdditionalParsing
{
typedef std::map<std::string, Entity> EntityMap;
typedef std::map<std::string, Entity>::iterator EntityMapIter;
std::strin... |
#ifndef PARSER_H
#define PARSER_H
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
#include <string.h>
#include <map>
#include <vector>
#include <errno.h>
#include <time.h>
#include <stdint.h>
#include <algorithm... |
#include "card.h"
#include <QString>
#include <QDebug>
Card::Card(size_t const& value, size_t const& suit, bool const& upsided): mUpSided(upsided), mValue(value), mSuit(suit) {
mUpSideTextureId = (mSuit * 13) + value;
normal.setWidth(70);
normal.setHeight(90);
min.setWidth(63);
min.setHeight(81... |
//**************************************************************************
//**
//** 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 ... |
#ifndef __FGInvincibilityPickUp__H__
#define __FGInvincibilityPickUp__H__
class FGInvincibilityPickUp:public LivingObject
{
protected:
AudioCue* m_pPickedUpAudio;
double m_bonusTime;
public:
FGInvincibilityPickUp(double invincibilityTime, const char* cameraName = GAME_DEFAULT_CAMERA_NAME, unsigned int dra... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "../base.h"
#include "Windows.Web.Http.Diagnostics.0.h"
#include "Windows.Foundation.0.h"
#include "Windows.System.Diagnostics.0.h"
#include "Windows.Web.Http.0.h"
#include "Windows.Fo... |
/* GPA2 - IFC
Criado Por: Natalia Kelim Thiel
Data: 01/04/2016
Descrição:
Código fonte (source) da biblioteca para o uso do Sensor DS18B20 (Temperatura)
*/
#include "Arduino.h"
#include "Temperatura.h"
Temperatura::Temperatura() {
_indice = 0;
_titulo = "TEMPERATURA";
_arquivo = "tmp";... |
#include<stdio.h>
#include<unordered_set>
#include<set>
using namespace std;
char str[13];
unordered_set<string> member, active; // O(1+a)
//set<string> member, active; // O(log n)
int validate() {
return member.count(str);
}
int activate() {
return active.count(str);
}
int signup() {
member.insert(str);
retur... |
#include <stdio.h>
//2
/*(2,0) Mostre na tabela abaixo todos os passos (teste de mesa)
e identifique qual será a saída
do programa em C,
para os valores lidos (x = 5 e y = 10).
*/
/* // 5 10
void func(int *px, int *py) {
//endereço de memoria de py vai em px;
printf("ANTES DA ATRIBUICAO \n px = ... |
#include <iostream>
using namespace std;
int main() {
int t,a=0,b=0;
cin>>t;
int p,m=0;
for( int i=0; i<t;i++)
{
int pa,pb;
cin>>pa>>pb;
a = a+pa;
b = b+pb;
if(a>b)
{
if(a-b>m )
{
m = a-b;
p=1;
}
}
else
... |
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
for (int i = 0; i<matrix.size(); i++) {
if (matrix[i].front()<=target&&matrix[i].back()>=target) {
for (int l = 0,r = int(matrix[i].size())-1,mid = (l+r)/2; l<=r;mid = (l+r)/2) {
... |
/*******************************************************************************
* Cristian Alexandrescu *
* 2163013577ba2bc237f22b3f4d006856 *
* 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ... |
#ifndef BUY_WIN_CUT_H
#define BUY_WIN_CUT_H
#include <QDialog>
#include <QtSql>
#include<QCompleter>
#include<QMenuBar>
#include<QMenu>
#include<QDate>
#include<QSqlQuery>
#include<QMessageBox>
#include<QByteArray>
#include<QtNetwork/QNetworkInterface>
#include<QBuffer>
#include<QFile>
#include<QIODevic... |
#pragma once
#include <Windows.h>
#include "Common.h"
#include "Loading.h"
#ifndef __CV_INCLUDE_
#define __CV_INCLUDE_
#include <opencv\cv.h>
#include <opencv\cvaux.h>
#include <opencv\highgui.h>
#include "GlobalVars.h"
using namespace cv;
#endif // #! __CV_INCLUDE
#include "NewPerson.h"
#include "AcceptFace.h"
#inclu... |
#include "DummyDecompressor.h"
DummyDecompressor::DummyDecompressor(FILE* inputFile) {
file = inputFile;
}
int DummyDecompressor::decompressNextByte() {
Byte tmp;
assert(1 == fread(&tmp, sizeof(Byte), 1, file));
return tmp;
}
void DummyDecompressor::close() {
fclose(file);
}
|
#include<iostream>
using namespace std;
class cDemo
{
int M_iNo1;
int M_iNo2;
public:
cDemo()
{
}
void fun1()
{
}
void fun2() const
{
}
void fun3 (cDemo *pPtr)
{
}
void fun4(cDemo const *pPtr)
{
}
};
int main ()
{
cDemo obj1;
const cDemo obj2;
obj1.fun1();
o... |
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
... |
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main()
{
double ne,na,nf;
printf("Ingrese la nota de acumulados: \n");
scanf("%lf", &na);
printf("Ingrese la nota de Examen: \n");
scanf("%lf", &ne);
na=na*0.3;
ne=ne*0.7;
nf=na+ne;
if (nf>=60)
... |
// Fill out your copyright notice in the Description page of Project Settings.
#include "EscapeGame.h"
#include "OpenDoorActor.h"
// Sets default values for this component's properties
UOpenDoorActor::UOpenDoorActor()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You... |
#ifndef PE_EDITOR_H
#define PE_EDITOR_H
/*
* @author Paradoxon powered by Jesus Christ
*/
#include <app/Message.h>
#include <interface/View.h>
#include <support/List.h>
#ifdef B_ZETA_VERSION_1_0_0
#include <locale/Locale.h>
#include <locale/LanguageNotifier.h>
#else
#define _T(a) a
#endif
#include "PEditor.h"
#in... |
#include <iostream>
const double Inch_per_feet = 12.0;
const double Meter_per_inch = 0.0254;
const double Pound_per_kilogram = 2.2;
int main(void)
{
using namespace std;
cout << "Eenter your height of feet:____\b\b\b\b";
double ht_feet;
cin >> ht_feet;
cout << "Enter height of inch:____\... |
#include "stdafx.h"
#include <iostream>
#include "attack.h"
#include "person.h"
using namespace std;
/**
* Comment out the argc and argv, so we don't get
* any compiler warnings.
* @brief main
* @return
*/
int main(int /*argc*/, char /**argv[]*/)
{
Person person("Mismis");
person.addWeightLog(WeightEntry... |
//==============================================
// Name : AKSHAY MUKESHBHAI KATRODIYA
// Email : amkatrodiya@myseneca.ca
// Student ID : 125298208
// Section : NAA
// Date : 06/05/2021
//==============================================
//I have done all the coding by myself and on... |
#include <iostream>
using namespace std;
int main()
{
string str1,str2;
cin >> str1 >> str2;
if(str1.length()>str2.length())
cout<<str1;
else
cout << str2;
return 0;
}
|
#include "LambdaExpression.h"
namespace txt
{
LambdaExpression::LambdaExpression(const std::function<std::string()>& func)
: m_func(func)
{
}
LambdaExpression::~LambdaExpression()
{
}
std::string LambdaExpression::ExecImpl() const
{
return m_func();
}
} // namespace txt
|
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
void solve(){
ll n;
cin >> n;
ll t = 0, f = 0, s = 0;
t = n / 3; n %= 3;
if(n == 2){
if(t) {
t--, f++;
}
else {
cout << "-1\n"; return;
}
}
else if(n == 1){
... |
#pragma once
#include <iostream>
#include <cmath>
#include "Vector.h"
using namespace std;
class Sphere
{
public:
Vector center;
Vector albedo;
double r;
bool miroir;
bool transparent;
// constructeur
Sphere(Vector c, Vector couleur, double r, bool mirror = false, bool transp = false) : c... |
#ifndef __UBLAS_JFLIB_EXTENSIONS_OPER_HPP__
#define __UBLAS_JFLIB_EXTENSIONS_OPER_HPP__
#include <jflib/jflib.hpp>
#include <boost/numeric/ublas/vector.hpp>
namespace boost { namespace numeric { namespace ublas {
/*
* \brief Define a new scalar operation which calculate square root of a number
*
*/
template<... |
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include"manage.h"
#include"client.h"
#include"order.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
void changeClient();
... |
#include "inc/utility.hpp"
#include <sstream>
namespace astroblaster {
std::string texture_not_found(std::string_view texture) {
std::stringstream ss;
ss << u8"Texture " << texture << u8" not found in manager.";
return ss.str();
}
std::string file_not_found(std::string_view file) {
std::stringstream ss;
... |
#include <iostream>
#include <stdlib.h>
using namespace std;
#define GET_MSG_TYPE(BYTE) ((BYTE & 0x300) >> 6)
#define GET_INSTR_TYPE(BYTE) ((BYTE & 0x38) >> 3)
#define IS_LOAD(INSTR) (INSTR == 0x00 ? 1:0)
#define IS_STOP(INSTR) (INSTR == 0... |
#include "PEngine/graphics/shader.h"
#include "PEngine/string_constants.h"
#include "PEngine/utilities/error.h"
#include "PEngine/utilities/load_text_file.h"
#include "PEngine/utilities/string_manipulations.h"
#include <iostream>
#include <fstream>
#include <cstring>
namespace pear { namespace graphics {
unsigned... |
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
#define scl(n) cin>>n;
#define scc(c) cin>>c;
#define fr(i,n) for (ll i=0;i<n;i++)
#define fr1(i,n) for(ll i=1;i<=n;i++)
#define pfl(x) printf("%lld\n",x)
#... |
#ifndef COURSE_H
#define COURSE_H
#include <iostream>
#include <vector> //vector unlike List, allows us to work with [] !!!!!
#include "Student.h"
class Course{
private:
std::string name;
int id;
int creditPoints;
std::vector<Student*> students;
public:
Course(int _id, std::string _name, int _creditPoints);
fr... |
#include "pch.h"
#include "Product.h"
#include <string>
using namespace std;
Product::Product()
{
}
Product::Product(string name, int qty, double price)
{
this->name = name;
this->qty = qty;
this->price = price;
}
Product::~Product()
{
}
void Product::calculateAmount()
{
this->amount = qty * price;
}
string P... |
#if 1
#include <opencv2/opencv.hpp>
#include <iostream>
# include <deque>
#include <stdio.h>
using namespace std;
using namespace cv;
#define D_USE_IPCAM 1
/** Function Headers */
void detectAndDisplay(Mat frame,double );
/** Global variables */
//String face_cascade_name = "/Users/dengyan/Desk... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.