text stringlengths 8 6.88M |
|---|
/*
Expression Evaluator Library (NS-EEL) v2
Copyright (C) 2004-2008 Cockos Incorporated
Copyright (C) 1999-2003 Nullsoft, Inc.
nseel-lextab.c
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... |
#include<stdio.h>
int main()
{
int i,m[5],n[5],c[5];
//clrscr();
printf("\nReading the 1st array\n");
for (i=0;i<5;i++)
{
printf("Enter the value");
scanf("%d",&m[i]);
}
printf("\nReading the 2nd array\n");
for (i=0;i<5;i++)
{
printf("Enter the value");
scanf("%d",&n[i]);
... |
//================================================================//
// //
//$Id:$ //
// //
// stdafx.h : ... |
/*************************************************
Copyright:CFSC
Author: Souleep
Date:2020-06-02
Description:通过CAS/Memory_Order分别实现无锁消息队列
**************************************************/
/*todo:linux kernel的kfifo机制好像更优雅*/
#ifndef __LFQUEUE_H__
#define __LFQUEUE_H__
#include <thread>
#include <iostream>
... |
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Name: Braydon Hampton
// File: main.cpp
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <iostream>
#include <limits>
#include "mystring.h"
const int MAX_BUF = 1024;
void test_str_cmp()
{
char... |
#include<vector>
using std::vector;
class test
{
public:
int max_output(vector<int> &prices)
{
int final_cost = 0;
for(auto i = prices.begin();i!= prices.end();++i)
{
if(i+1 != prices.end() && *(i+1) > *i)
{
final_cost += *(i+1) - *i;
... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,e,f,i,m,maxi,mm,n,j,p;
cin>>n;
while(n--){
cin>>a;
for(i=0;i<a-1;i++){ {cin>>b>>c; p=-100;
d=b; c=e; f=d-e; m=f; if(m>p) {maxi=m;} else maxi=p;
e=f+m; if(maxi>e) {mm=maxi ;} else mm=e;
}}
printf("case %d: %d",i+1,mm);... |
#include "DXUT.h"
#include "cVirus.h"
cVirus::cVirus(void)
:m_nCount( 0 )
{
}
cVirus::~cVirus(void)
{
}
void cVirus::Init()
{
m_vScale *= 0.4f;
cMonster::Init();
m_fOriMoveSpeed = 10.0f;
m_fHp = 500.0f;
m_fBulletSpeed = 25.0f;
m_pResourceFile = _GETSINGLE( cResourceMgr )->GetResourceFile( "virus" );
m_... |
//------------------------------------------------------------------------------
// ConicalSensor
//------------------------------------------------------------------------------
// GMAT: General Mission Analysis Tool.
//
// Copyright (c) 2002 - 2015 United States Government as represented by ... |
#pragma once
#include <array>
#include "../exceptions.hpp"
#include "DomainBase.hpp"
#include "PointSet.hpp"
#include "types.hpp"
namespace fantom
{
template < size_t Dim >
DomainBase::Bounds computeBounds( const ValueArray< Tensor< double, Dim > >& points )
{
if( auto p = dynamic_cast< const Po... |
#pragma once
#include "Unit.h"
/**Class that derives from Unit. It has special abilites for cavalry. */
class Cavalry :
public Unit
{
public:
/*Constructor for Cavalry*/
Cavalry();
/*Destructor for Cavalry*/
~Cavalry();
/*The method returns the unit type as the first character of the unit name*/
char type_of_uni... |
#pragma once
#include "ArgumentForwardIter.hpp"
#include <iterator>
#include <vector>
#include <cstring>
class Arguments
{
public:
Arguments(int argc, char** argv)
{
for(int i = 0; i < argc; i++)
{
m_argv.emplace_back(argv[i]);
}
}
... |
#include "Bit_Field.h"
void main()
{
ExampleFile();
} |
//
// Created by 梁栋 on 2019-11-22.
//
#include <string>
#include <iostream>
using namespace std;
class Solution {
public:
int lengthOfLastWord(string s) {
int len = s.length();
if(len == 0)
return 0;
while(s[len-1] == ' '){
s = s.substr(0, len-1);
len = le... |
#ifndef ASSIGN_H
#define ASSIGN_H
#include <iostream>
#include <string>
#include "statement.h"
#include "expression.h"
#include "lexp.h"
#include "../visitors/treevisitor.h"
using namespace std;
class Assignment: public Statement {
public:
Assignment(LExpression* target, Expression* exp):
target_(tar... |
/*************************************************************
* > File Name : CF1248A.cpp
* > Author : Tony
* > Created Time : 2019/10/21 16:43:01
* > Algorithm :
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
inline ... |
/*
pxCore Copyright 2005-2021 John Robinson
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 agreed to in writing, s... |
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include "globals.h"
#include "mc68328.h"
#include ".obj/stubs/getsp_stub.h"
void cmd_getsp(char** argv)
{
if (argv[0])
error("syntax error: getsp");
Bytes stub(_obj_stubs_getsp_bin, _obj_stubs_getsp_bin_len);
pad... |
#include <bits/stdc++.h>
using namespace std;
class RLEIterator
{
public:
RLEIterator(vector<int> &A)
{
evector.assign(A.begin(), A.end());
}
int next(int n)
{
int count = 0, ssize = evector.size(), i = 0, minus = 0, ret = -1;
for (; i < ssize - 1; i = i + 2)
{
... |
#include "randomizer_world.hpp"
#include "world_teleport_tree.hpp"
#include "spawn_location.hpp"
#include <landstalker-lib/model/world.hpp>
#include <landstalker-lib/tools/game_text.hpp>
#include <landstalker-lib/exceptions.hpp>
#include "world_node.hpp"
#include "world_path.hpp"
#include "world_region.hpp"
#include "... |
/**
* Prevents object from implementing copy operations.
* class foo : public noncopyable {
* };
*
*/
#ifndef FISHY_NON_COPYABLE_H
#define FISHY_NON_COPYABLE_H
namespace core {
namespace util {
/**
* Classes inheriting from this will result in compile errors
* if they are attempted to be copied.
*/
class ... |
#ifndef Plane_h
#define Plane_h
#include "Geometry.hpp"
class Plane : public Geometry {
public:
Plane(float size) {
this->size = size;
indicesNum = 0;
boundingBoxLength = size;
}
void createVBOs() {
int vertexBufferLen, indexBufferLen;
getPlaneVbIbLen(vertexBu... |
// clang-format off
/* =============================================================================
* BEGIN Template file SIMPLModuleCodeTemplate.in.cpp
* ========================================================================== */
#include <pybind11/numpy.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl_b... |
#include <iostream>
#include <cstring>
int main()
{
char stra[] = "Hello,";
char strb[] = " world!";
char strc[50];
std::strcpy(strc, stra);
std::strcat(strc, strb);
std::cout << strc << std::endl;
return 0;
}
|
#include <iostream>
#include <string>
using namespace std;
int main (){
//cout << "Hello world" << endl;
// string s1;
// cout << s1 << endl;
// string s2 {"Frank"};
// cout << s2 << endl;
// string s3 {s2};
// cout << s3<< endl;
// string s4 {"Frank" , 3};
// cout << s4<< endl;
// string s5 {s3 , 0, 1};
// cout <<... |
#if !defined(ATBASH_CIPHER_H)
#define ATBASH_CIPHER_H
#include <string>
#include <cctype>
#include <algorithm>
namespace atbash_cipher {
std::string encode(std::string);
std::string decode(std::string);
} // namespace atbash_cipher
#endif // ATBASH_CIPHER_H |
#include "Reader.h"
namespace screenDNS {
Reader::Reader(int id, DBManager* db_manager) {
m_db_manager = db_manager;
m_id = id;
}
void Reader::operator () () {
while (true)
{
try {
sleep(3); // sleep 3s before each read
// Read the content of DB by invoking DBMan... |
/*
* Pinhole.h
*
*
*/
#ifndef PINHOLE_H_
#define PINHOLE_H_
#include "core/Camera.h"
namespace rt {
class Pinhole : public Camera {
public:
//
// Constructors
//
Pinhole();
Pinhole(int width, int height, int fov);
//
// Destructor
//
~Pinhole() {};
//
// print fu... |
//
// Copyright Jason Rice 2017
// 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)
//
#ifndef NBDL_DETAIL_DEFAULT_CONSTRUCTIBLE_LAMBDA_HPP
#define NBDL_DETAIL_DEFAULT_CONSTRUCTIBLE_LAMBDA_HPP
#include <type_traits>... |
// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.
#include "core/CompileConfig.h"
#if OUZEL_SUPPORTS_OPENGL
#include "TextureResourceOGL.h"
#include "core/Engine.h"
#include "RendererOGL.h"
#include "utils/Log.h"
namespace ouzel
{
namespace graphics
{
static GLint getO... |
#include <memory>
#include <string>
#include <gtest/gtest.h>
#include <Expected.h>
#include <Errors.h>
#include <ForceAllErrors.h>
#include "Common.h"
#include "CustomError.h"
#ifndef NDEBUG
static int ForceAllErrors_sideEffects0_value = 0;
static int ForceAllErrors_sideEffects1_value = 0;
// --------------------... |
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int N = 10000, K = 100;
struct Table {
int time = 8 * 3600, sum = 0;
bool isVip = false;
};
struct Player {
int atime, stime = -1, p;
Player(int at, int _p)
{
atime = at; p = _p;
}
};
Table tables[K];
vector<Player> players;
... |
#include "include/materialdata.h"
#include "json/json.h"
#include <fstream>
using namespace cilender;
MaterialData::MaterialData()
{
}
MaterialData* MaterialData::loadJSON(std::string fileName)
{
MaterialData* mat = new MaterialData();
Json::Value root;
Json::Reader reader;
std::ifstream file( file... |
//
// UIHomeLayer.cpp
// Boids
//
// Created by Yanjie Chen on 3/3/15.
//
//
#include "UIHomeLayer.h"
#include "../Utils.h"
#include "../manager/SceneManager.h"
#include "../manager/ResourceManager.h"
#include "../data/PlayerInfo.h"
#include "UIHeroManageLayer.h"
#include "UITeamTalentLayer.h"
#include "../util/Coc... |
//
// request_parser.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
//
#ifndef HTTP_REQUEST_PARSER_H
#... |
#include "../Include/Factory_Btn_Line.h"
#include "../Include/Botton.h"
Botton * Factory_Btn_Line::generate()
{
Botton* tmp = new Botton;
tmp = new Botton;
tmp->setSize(60, 30);
tmp->setPos(1170, 600);
tmp->loadTexture("Textures/Line.bmp");
tmp->setKey(7);
return tmp;
}
|
#define LED_GREEN 9
#define SWITCH 8
void setup() {
pinMode(LED_GREEN, OUTPUT);
pinMode(SWITCH, INPUT);
Serial.begin(9600);
Serial.println("start");
}
void loop() {
if(digitalRead(SWITCH) == LOW){
Serial.println("Switch ON.");
digitalWrite(LED_GREEN, HIGH);
}
else{
Serial.println("Switch OFF... |
#include <iostream>
#include <cstdio>
#include <string.h>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int m,n,f;
char *str;
int A[4010][4010];
long long int findla(int hist[],int n)
{
stack<int> height;
stack<int> index;
long long lA=0;
int li,lh;
for(int ... |
/* --- CYCLE DETECTION --- */
#include <bits/stdc++.h>
using namespace std;
/*
Given ADJ LIST as graph representation, find if the graph
is acyclic or not.
We can use DFS. Once we initialize DFS, and maintain a "cycle
stack". If we visit a node that has already been pushed to the stack,
it means we found a cycle.
*/... |
#include "Node.h"
Node::Node(int v)
{
value = v;
left = NULL;
right = NULL;
next = NULL;
prev = NULL;
parent = NULL;
}
// Recursively delete all child nodes
Node::~Node()
{
if(left)
delete left;
if(right)
delete right;
}
// This function will remove a node from its parent
void Node::removeFromParent()
{
... |
//
// MapData.h
// Boids
//
// Created by Xin Xu on 11/18/14.
//
//
#ifndef __Boids__MapData__
#define __Boids__MapData__
#include "cocos2d.h"
enum class TMXObjectLayerFlag {
Background = 1,
OnGround = 2,
Object = 4
};
class MapData : public cocos2d::Ref {
public:
MapData();
virtual ~MapData(... |
#include "sa_lcp.hpp"
#include <unordered_set>
#include <cassert>
#include <divsufsort.h>
#include <divsufsort64.h>
namespace stool
{
uint64_t intervalTotalCount = 0;
uint64_t rlcpCounter = 0;
void constructSA(string &text, vector<uint64_t> &sa)
{
uint64_t n = text.size();
sa.resize(n... |
#include "dialog.h"
#include "ui_dialog.h"
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QDebug>
#include <QtWidgets>
#include <cstdint>
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
dotrgb_is_available = false;
dotrgb_port_name = "";
... |
#ifndef __DUI_RES_LOADER_H__
#define __DUI_RES_LOADER_H__
#include "DUIImage.h"
#include "DUICursor.h"
DUI_BGN_NAMESPCE
class DUILIB_API CResLoader
{
public:
CResLoader();
~CResLoader();
void CResLoader::ToAbsolutePath(CDUIString& lpszFileName);
CRefPtr<CImageList> LoadImageFromFile(const CDUIString& strFileNam... |
#ifndef _MYEXCEPTION_H_
#define _MYEXCEPTION_H_
#include <iostream>
#include <cstring>
class MyException
{
public:
std::string message;
int type;
MyException()
{
message.clear();
type = 0;
}
MyException(const char* s, int e)
{
message = s;
type = e;
}
};
#endif
|
/*Manager.cpp
* Created by Chris Marques, Ryan Cox, and Nikolay Radaev
*/
#include <iostream>
#include <thread>
#include <chrono>
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
#include <cstring>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdli... |
#pragma once
#include "SecureFixedLengthArray.h"
template<unsigned int arraySize>
class SecureArray
{
public:
SecureArray() : data(arraySize) {}
void Zero()
{
data.Zero();
}
unsigned int Size() const
{
return arraySize;
}
uint8_t& operator[](unsigned int i)
{
return data[i];
}
uint8_t* Get()
{
... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.Media.Ocr.1.h"
WINRT_EXPORT namespace winrt {
namespace ABI::Windows::Foundation {
#ifndef WINRT_GENERIC_2f2d6c29_5473_5f3e_92e7_96572bb990e2
#define WINRT_GENERIC_2f2d6c29... |
/***************************************************************************
Copyright (c) 2020 Philip Fortier
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 version 2
of the License, or... |
#pragma once
#include "value.h"
class cBaseShader;
class IObj;
class cResourceFile
{
public:
_SYNTHESIZE_INHER( char*, m_pKey, Key );
public:
virtual void Render( IObj* pObj, bool IsAni = false,
cBaseShader* pShader = NULL ) PURE;
public:
cResourceFile(void);
virtual ~cResourceFile(void);
};
|
//
// Item.cpp
// cocos2d_samples
//
// Created by 龚畅优 on 14-6-21.
//
//
#include "Item.h"
Item::Item(){
m_pic = NULL;
m_b2fixture = NULL;
m_type = 0;
m_tmpBox2dPos = Point::ZERO;
m_originPoint = Point::ZERO;
m_isLocked = false;
}
Item::~Item(){
CC_SAFE_RELEASE(m_pic);
}
bool Item::in... |
// -*- 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... |
#ifndef PMMAP_H
#define PMMAP_H
#include <Structs/Arrays/packedMemoryArray.h>
template <typename KeyType, typename DataType>
class PMMapItem;
/**
* @class PMDictionary
*
* @brief
*
* @author Panos Michail
*
*/
template <typename KeyType, typename DataType>
class PMMap
{
public:
typedef PMMapItem<KeyTyp... |
/* stl map */
#include<algorithm>
#include<map>
#include<string.h>
#include<string>
#include<unordered_map>
using namespace std;
#define MAXLEN (5)
struct Character {
int sid, uid, point;
map<int, int>::iterator pos;
}cha[100003];
int ucnt, scnt;
unordered_map<string, int> utab, stab;
map<int, int> user[3000... |
#include "wmaskeditwindow.h"
WMaskEditWindow::WMaskEditWindow(QWidget *parent) : QMainWindow(parent)
{
}
|
#include <iostream>
#include <utility>
#include "graph.h"
using namespace std;
int main(){
Graph g(10);
pair<int,int> a(0,1);
pair<int,int> b(2,1);
g.addline(a);
g.addline(b);
g.addline(pair<int,int>(1,4));
g.addline(pair<int,int>(2,4));
g.addline(pair<int,int>(2,5));
g.addline(pair<int,int>(1,6));
g.addline(... |
//
// Created by Steven Smith on 2020-04-04.
// A class created to help and simplify the main driver into something more simple
// and easier to manage.
//
#ifndef INC_371PROCEDURALFOREST_WINDOWMANAGER_H
#define INC_371PROCEDURALFOREST_WINDOWMANAGER_H
#include "GLFW/glfw3.h"
#include <string>
class WindowManager {
... |
#include <iostream>
using namespace std;
class Box
{
public:
// Constructor definition
Box()
{
cout <<"Constructor called." << endl;
}
double Volume()
{
return length * breadth * height;
}
int value()
{
return this->Volume();
}
... |
// ASMloadcameras.cpp
// Load in Configure parameters
// Bai, Gang.
// March 22ed, 2010.
#include <stdafx.h>
#include <cstdio>
#include <tinyxml.h>
#include "ASModeling.h"
namespace
{
#define TXFloatValue( p, v ) (p)->QueryFloatAttribute("value", (v));
#define TXIntValue( p, v ) (p)->QueryIntAttribute(... |
/*
* Copyright 2016-2017 Flatiron Institute, Simons Foundation
*
* 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 ... |
#ifndef PCB_H
#define PCB_H
#include <string>
#include "global_variables.h"
#include <iostream>
using namespace std;
/*
* This document describe the node of a process
* the action taken here as well as criteria for determining
* each situation is before the tick
*/
class PCB{
public:
int priority; // priotit... |
#include "MainMenu.h"
#include "../Game.h"
#include "../entity/Player.h"
#include <QApplication>
extern Game *game;
MainMenu::MainMenu(QGraphicsView *parent) : QGraphicsSceneSized(parent)
{
title = new QGraphicsTextItem(QString("YASRL"));
title->setFont(QFont("Perfect DOS VGA 437", 80));
title->setPos((p... |
#ifndef BIDIRECTIONALDIJKSTRA_H
#define BIDIRECTIONALDIJKSTRA_H
#include <Structs/Trees/priorityQueue.h>
/**
* @class BidirectionalDijkstra
*
* @brief Bidirectional Dijkstra algorithm implementation
*
* This class supports running queries between source and target nodes by building two search trees, one startin... |
/*****************************************************************************/
/*! \file option.hh
* \author AV
* \date 2010-03
*
* \brief A simple template to mimic ML's option/None/Some
*****************************************************************************/
#ifndef OPTION_HH
#define OPTION_H... |
/***************************************************************************
Copyright (c) 2020 Philip Fortier
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 version 2
of the License, or... |
/***************************************************************************
Copyright (c) 2020 Philip Fortier
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 version 2
of the License, or... |
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QTimer>
#include <QDataStream>
#include <QTextStream>
#include <QtNetwork/QUdpSocket>
#include <QQueue>
#include "qcustomplot.h"
namespace Ui {
class... |
// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.
#include "Sound.h"
#include "SoundResource.h"
#include "core/Engine.h"
namespace ouzel
{
namespace audio
{
Sound::Sound()
{
resource = sharedEngine->getAudio()->createSound();
}
Sound:... |
/* @brief G2.cpp
* Programa que contiene las implementaciones
* de las funciones contenidas en GF2.h
*/
#include <bits/stdc++.h>
#include "defs.h"
using namespace std;
void getPolynomial( int n, string *polynomialString ){
ifstream filetoOpen;
string read;
register int contador = 0;
filetoOpen... |
#include "pch.h"
#include "PhoneBookDB.h"
//-Считывает данные с файла
//-Создает и заполняет хэш-таблицы
DATABASE_API void __cdecl CreateDB()
{
InitializeCriticalSection(&criticalSection);
surnameHashTable = new HashTable(BY_SURNAME);
streetHashTable = new HashTable(BY_STREET);
phoneHashTable = new H... |
#pragma once
#include "event_system.hpp"
#include "../Renderer/Shader.hpp"
#include "audio_system.hpp"
#include <iostream>
const static int NUM_SCORES = 10;
namespace sf
{
class Window;
};
struct lua_State;
class GraphicsSystem;
class Camera;
struct State
{
lua_State* luaState;
GraphicsSyst... |
// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.
#pragma once
#include <cstddef>
#include "core/CompileConfig.h"
#if OUZEL_SUPPORTS_SSE
#include <xmmintrin.h>
#endif
namespace ouzel
{
class Vector2;
class Vector3;
class Color;
class Vector4
{
public:
... |
#include <iostream>
using namespace std;
class Queue
{
private:
int size;
int front;
int rear;
int *arr;
public:
Queue();
Queue(int);
void enQueue(int);
int deQueue();
void display();
};
Queue::Queue()
{
size = 10;
front = rear = -1;
arr = new int[size];
}
Queue::Queue(int size)
{
this->size = size;
fr... |
#include <cstdio>
// 送分 print frequency
// 9 8 5 1 7 2 8 2 9 10 1 7 8 9 5 6 9 0 1 9
const int num = 20;
int main() {
int arr[20] = {0};
int tmp;
for(int i = 0; i < num; i++) {
scanf("%d", &tmp);
arr[tmp]++;
}
for(int i = 0; i < 11; i++) {
printf("%d:%d\n", i, arr[i]);
}
return 0;
} |
#include<iostream>
#include<stack>
using namespace std;
bool is_correct(string);
int main(){
cout<<"Enter parenthesis"<<endl;
string s;
cin>>s;
cout<<endl<<is_correct(s);
return 0;
}
bool is_correct(string s){
stack<char> estack;
int i=0;
while(s[i]!='\0'){
if( s[i]=='[' || s[i]=='{' || s[i]=... |
#include <iostream>
using namespace std;
int main()
{
int a;
cout << "입력: ";
cin >>hex>> a;
cout << "10진수: " <<dec<<a << endl;
cout << "8진수: " << oct << a << endl;
}
|
#pragma once
/*
문제:
1 부터 N 까지 차례대로 수를 쓰내려갈 때 특정수의 빈도수를 구하는 것이 문제이다.
예를 들어, N = 11 이고 조사할 수가 1 인 경우
1234567891011
빈도 수는 4 이다.
입력:
N 과 한 자리 수(0 ~ 9)가 주어진다. N 은 100 000 000 이하의 자연수이다.
출력:
빈도 수를 출력한다. 답은 32 비트 정수 범위를 넘어가지 않는다.
예제 입력 1:
11 1
예제 출력 1:
4
나의 방법:
1)
1~9와 0은 계산법이 약간 다르다.
2)
스터디 풀이 방법들:
1.
2.
3.
*... |
#include <objects/health_potion.h>
using namespace lab3::objects;
Health_Potion::Health_Potion(const std::string &name, int extra_points, int price, int weight, int volume)
: Potion(name, "You recover some life points", extra_points, price, weight, volume)
{}
Health_Potion::~Health_Potion()
{}
ActionResult Hea... |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)
#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>
int main() {
double n, m, d;
... |
class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
unordered_map<int, int> table;
int sum = 0;
int count = 0;
for (int i = 0; i < nums.size(); i++) {
sum += nums[i];
if (sum == k)
count++;
i... |
// 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::Globalization::PhoneNumberFormatting {
struct IPhoneNumberFormatter;
struct IPhoneNumberFormatterStatics;
struct IPhoneNumberInfo;
stru... |
//----------------------------- Problem 4
#include <iostream>
using namespace std;
int main(){
char first,second,third,fourth,fifth;
cout << "Enter first char of your name ";
cin >> first;
cout << "Enter second char of your name ";
cin >> second;
cout << "Enter third char of your name ";
cin >> third;
cout << "Enter fo... |
#include <bits/stdc++.h>
using namespace std;
// LCS,Longest Common Sequence,最长公共子序列
// 还是序列的问题,所以状态还是跟序列最末元素有关,但是有两个字符串
// 动态规划的好处就是你可以屏蔽掉其他的一些细节,
// 专注于两个状态切换时的动作,把这个用递推式表达出来,加上初始状态,我们就得到这个问题的解
// 所以这题很自然能够想到的状态切换时的样子,
// 第一个是 if A[i]==B[j], dp[i][j] = dp[i - 1][j - 1] + 1, else dp[i][j] = max(dp[i - 1][j], dp[i][j ... |
/*
* File: File.h
* Author: gmena
*
* Created on 23 de agosto de 2014, 02:51 PM
*/
#include <string>
#include <sstream>
#include <iostream>
#include <cstring>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#ifndef FILE_H
#define FILE_H
using namespace std;
class File {
public:
string re... |
#include "pch.h"
#include "DependencyInjector.h"
#include "Renderer.h"
#include "Window.h"
#include "Camera.h"
DependencyInjector* DependencyInjector::m_pInstance = nullptr;
DependencyInjector::~DependencyInjector()
{
delete m_pWindow;
delete m_pCamera;
m_pInstance = nullptr;
}
Renderer* DependencyInjector::Inje... |
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <std_msgs/Int16.h>
#include <std_msgs/Float32.h>
#include "white_ticket/Distance.h"
#include <stdio.h>
#include <string>
#include <vector>
#include <time.h>
#include <iostream>
using namespace std;
const int LIMIT = 3;
const int ALL = 6;
const int SAME = 3;
c... |
class Solution {
public:
int getFood(vector<vector<char>>& grid) {
int m = grid.size(), n = grid[0].size();
queue<vector<int>> q; // <i, j>
vector<vector<int>> dirs = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
for (int i = 0; i < m; i++) {
for (int j = 0; j < n... |
// github.com/andy489
// https://www.hackerrank.com/contests/practice-3-sda/challenges/balloons-and-candy
#include <cstdio>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;
const int mxN = 100005;
ll n, m, l, r = 1e18, mid, s;
pair<ll, ll> A[mxN];
int main() {
scanf("%lld%ll... |
#ifndef RECTANGLE_H
#define RECTANGLE_H
class Rectangle{
public:
Rectangle();
int getWidth();
void setWidth(int);
double getHeight();
void setHeight(double);
private:
int width;
double height;
};
#endif
|
#include "stdafx.h"
#include "Reader.h"
#include "Data.h"
using namespace std;
namespace
{
istringstream getLineStrm(istream & in)
{
string str;
getline(in, str);
return istringstream(str);
}
void readLine(istream && in, Data & d, size_t y)
{
char ch;
size_... |
/*
* SPDX-FileCopyrightText: (C) 2018 Daniel Nicoletti <dantti12@gmail.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PROTOCOLHTTP2_H
#define PROTOCOLHTTP2_H
#include "hpack.h"
#include "protocol.h"
#include "socket.h"
#include <context.h>
#include <enginerequest.h>
#include <QObject>
// namespace Cutel... |
#ifndef PROGRESS_H
#define PROGRESS_H
#include <QDialog>
#include <QString>
#include <QSerialPortInfo>
#include <QWidget>
#include <QProgressBar>
#include "ui_progress.h"
class Progress : public QDialog, protected Ui::Progress
{
Q_OBJECT
public:
Progress(QString info, QSerialPortInfo portInfo, QWidget *parent=nul... |
#pragma once
//////////////////////////////////////////////////////////////////////////
#include "geometry.h"
#include "wgeometry.h"
#include "operators.h"
#include "TVView.h"
//////////////////////////////////////////////////////////////////////////
enum _TVN
{
TVFN_LAST = 0u-100u,
TVFN_FIRST = 0u-200u,
... |
//
// Created by utec on 12/11/19.
//
#ifndef AVA_PREGADRO_H
#define AVA_PREGADRO_H
#include <iostream>
#include <string>
#include "CAlumno.h"
using namespace std;
class Pregrado : public Alumno{
private:
int practica;
public:
Pregrado(int ,string , int , string ,int, int);
void mostrarPregrado();
};
Pre... |
#include <cmath>
#include <functional>
#include <future>
#include <iostream>
#include <thread>
#include <random>
using namespace std;
int fun(int a, int b)
{
// std::default_random_engine dre;
return std::pow(a, b);
}
void task_lambda()
{
std::packaged_task<int(int, int)> p([](int a, int b) {
retu... |
#include <iostream>
int main()
{
/**
* Commas act as separators in this line, not as an operator.
* Results: a=1, b=2, c=3, i=0
*/
int a = 1, b = 2, c = 3, i = 0;
/**
* Assigns value of b into i.
* Results: a=1, b=2, c=3, i=2
*/
int a = 1, b = 2, c = 3;
int i = (a, b);
/**
* Assigns valu... |
#include "Complex.h"
#include<iostream>
using namespace std;
Complex::Complex(float x, float y): re(x), im(y)
{
cout<<"Complex\n";
}
Complex::~Complex()
{
cout<<"Distruge complex\n";
}
Complex::Complex(const Complex& other)
{
this->re=other.re;
this->im=other.im;
cout<<"Copiaza Complex\n";
}
void Com... |
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
struct Node {
char c;
Node *lc, *rc;
Node() { lc = rc = NULL; }
};
Node node[30];
// 出现过则+1,为孩子则-1
int root[30] = { 0 }, n;
void preOrder(Node* r) {
if (r == NULL)
return;
cout << r->c;
preOrder(r->lc);
... |
#ifndef SIMMETHODS_SEMIIMPLICITEULER_HEADER
#define SIMMETHODS_SEMIIMPLICITEULER_HEADER
#include "SimMethod.h"
#include "Source/Common/Timing.h"
#include <fstream>
namespace solar
{
//Simulates data using semi-implicit Euler integration method
//Expects data to be in following units:
// -pos in AU units
// -vel... |
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <list>
#include <cassert>
class CNode
{
CNode * next_[27]; //\0, a - z
public:
CNode(){
memset(next_, 0, sizeof next_);
}
CNode * next(char c){
if(!c)
return next_[0];
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.