blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 117 | path stringlengths 3 268 | src_encoding stringclasses 34
values | length_bytes int64 6 4.23M | score float64 2.52 5.19 | int_score int64 3 5 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | text stringlengths 13 4.23M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
da248a918585678883dd3c8f3b72a0b58675ebd1 | C++ | ardiprasetia/dw | /3.cpp | UTF-8 | 1,370 | 3.09375 | 3 | [] | no_license | #include <iostream>
using namespace std;
void bentukPersegi (int panjang_persegi){
int i,j;
double r = 2.0;
cout << "Hasil bentuk persegi dari panjang persegi (bilangan ganjil), " << panjang_persegi << " adalah : ";
//cin >> panjang_persegi;
cout << endl;
if (panjang_persegi % ... | true |
0379ae690e64d9ead2028cbada23e65c4c341560 | C++ | agus7803/Lab0 | /Tarea0/prog4-p4gr36/hpp/Sistema.hpp | UTF-8 | 1,457 | 2.5625 | 3 | [] | no_license | #ifndef SISTEMA_HPP
#define SISTEMA_HPP
#include <string>
#include <iostream>
#include "partida.hpp"
#include "videojuego.hpp"
#include "jugador.hpp"
#include "dataType/dtJugador.hpp"
#include "dataType/dtPartida.hpp"
#include "dataType/dtVideojuego.hpp"
using namespace std;
class Sistema {
private:... | true |
7ad1c4c48422d202d7310907355a946534a558c4 | C++ | saks1209am/C-Programs | /Datatypes/main.cpp | UTF-8 | 222 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
char grade= 'A';
string phrase="Giraffe Academy";
bool isMale=true;
int age=50;
double gpa=2.3;
cout<< grade <<endl;
return 0;
}
| true |
2576faaed45128587fcc27589c8829fe0037f795 | C++ | r1cebank/coding-challenge | /Helvetic Coding Contest 2016/collective-mindsets/medium.cpp | UTF-8 | 1,274 | 3.125 | 3 | [
"MIT"
] | permissive | /*
* Helvetic Coding Contest 2016, 690A1
* Status: submitted
* A1. Collective Mindsets (medium)
* Way to go! Heidi now knows how many brains there must be for her to get one. But throwing herself in the midst of a clutch of hungry zombies is quite a risky endeavor. Hence Heidi wonders: what is the smallest number o... | true |
eba3970fec73af681a57df5b8b1c1887fa077513 | C++ | wheder/jeskynepokladu | /mi-paa/batoh_bb/overkill_tfull.cpp | UTF-8 | 3,256 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <fstream>
#include <exception>
#include <cctype>
#include <iomanip>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
using namespace std;
int * C = NULL;
int * M = NULL;
int pocet = 0;
int max_hmotnost = 0;
bool * max_ar... | true |
41af2a2f79008a07b60456c3ec95b89b927f667f | C++ | XingGaoY/computer_graphics | /光线追踪/SphereTex.h | UTF-8 | 949 | 2.5625 | 3 | [] | no_license | //CLASS_TextureSphere
#ifndef _TEXSPHERE
#define _TEXSPHERE 1
#define M_PI 3.14159265358979323846
#include "Surface.h"
#include "Ray.h"
class TexSphere:public Surface
{
public:
Vector3 centre;
float radii;
TexSphere():Surface(){};
TexSphere(Vector3 centre1,float radii1,Vector3 DR,Vector3 SR,Vector3 AR,int RSP,V... | true |
29b407f7a0ff7127fa68c4c7bbf555223335d81a | C++ | avinashw50w/ds_algo | /Dynamic programming/DP on trees/directi2.cpp | UTF-8 | 1,184 | 3.59375 | 4 | [] | no_license | /*A tree is given in which each edge is having some weight associated with it and you are given a number K.
So starting from root in K-steps how much maximum weight you can collect.
You can traverse in any direction either from parent to child or child to parent.
You can visit a node multiple times.
Eg:
... | true |
6d2f859f53f79a4575f185876de689b02141505a | C++ | MaapleWaafles/PhysicsEngine2D | /dependencies/Matrix4.h | UTF-8 | 1,677 | 3.421875 | 3 | [] | no_license | #pragma once
//Included Vector4 to use its properties
#include "Vector4.h"
class Matrix4
{
public:
// Creating a union to allocate one large amount of memory
union {
//Struct is held within the union axis array of 4 x points, 4 y points, 4 z points and 4 w points
struct
{
//axis array holding the points
f... | true |
92086f7ab5301900b3aecbfbad0db61a51165354 | C++ | Austin-M1/2500-MTRN | /Assignment 2 V3.0/RectPrism.cpp | UTF-8 | 2,184 | 2.625 | 3 | [] | no_license | #ifdef __APPLE__
#include <OpenGL/gl.h>
#elif defined(WIN32)
#include <Windows.h>
#include <GL/gl.h>
#include <GL/glut.h>
#else
#include <GL/glut.h>
#endif
#include "Shape.hpp"
#include "RectPrism.hpp"
RectPrism::RectPrism(double x_length, double y_length, double z_length)
{
X_length = x_length;
... | true |
61a1f5df55996366fdfe6ad287adcffdc69d0985 | C++ | ragebiswas/algorepo | /practice/mergesort.cpp | UTF-8 | 1,252 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
using namespace std;
void print(int i)
{
cout<<i<<" ";
}
void merge(vector<int>& v, int l, int m, int r)
{
vector<int> buf1(v.begin() + l, v.begin() + m + 1);
vector<int> buf2(v.begin() + m + 1, v.begin() + r + 1);
i... | true |
8f4680aae7221c53a0e4eafe2007eb57c2344cc2 | C++ | DrStrangelove42/DreamOfaRidiculousMan | /Source/Characters/Monsters/Skeleton.h | UTF-8 | 448 | 2.765625 | 3 | [
"MIT"
] | permissive | #ifndef SKELETON_H
#define SKELETON_H
#include "../Monster.h"
/// <summary>
/// A Skeleton is a type of Monster. These will always have the same characteristics.
/// </summary>
class Skeleton : public Monster
{
protected:
public:
/// <summary>
///
/// </summary>
/// <param name="renderer"></param>
/// <param n... | true |
de1fcdf7c0b7fda9be13d2074c5b8479ba1022ee | C++ | frankxiaoq/praticeMethod | /algPratice/main.cpp | UTF-8 | 400 | 2.78125 | 3 | [] | no_license | #include "SortMethod.h"
#include "PraticeMethod.h"
int main(int argc, char **argv)
{
int arr[] = {-1, 3 -4, 1, 6};
int arr_sum = maxSumSubArr3(arr, 5);
cout << arr_sum << endl;
int aa(0);
int *pta = &aa;
int &rfa = aa;
double bb(0.0);
double *ptb = &bb;
double &rfb = bb;
cout << sizeof(pta) << " " << sizeof... | true |
192bf45c43aa03b9c2fd62306b45d649b14e2596 | C++ | PythonCodes1/Competitive-programming | /LeetCode/May LeetCode Challenge/C++/9 - Valid Perfect Square.cpp | UTF-8 | 524 | 3.015625 | 3 | [] | no_license | class Solution {
public:
bool isPerfectSquare(int num) {
int ld = num%10;
if(ld == 2 || ld == 3 || ld == 7 || ld == 8)
return false;
int l = 1;
int r = num;
while(l <= r){
long long int mid = l + (r-l)/2;
long long int sq = mid*mid... | true |
c64f396f761e998072daa3654dff7fb242f6f2f5 | C++ | kunalmittal51/cppcodes | /codechef_long/april_long.cpp | UTF-8 | 743 | 3.15625 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int min (int i , int j)
{
if ( i < j)
{
return i;
}
else return j;
}
int main()
{
int n;
cin>>n;
vector<int>c;
vector<int>t;
for ( int i = 0 ; i < n ; i++)
{
int j ;
cin>>j;
c.push_back(j);
}
for ( int i = 0 ; i < n ; i+... | true |
ce79931a677a3542e5bd240750a91dac4fd2ab0b | C++ | enrondata/microsoft-pst-sdk | /sourceCode/fairport/branch/ankopp/pstsdk/util/util.h | UTF-8 | 12,777 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | //! \file
//! \brief General utility functions and classes
//! \author Terry Mahaffey
//!
//! This is where any generalized utility classes and functions go which
//! are not directly related to MS-PST in some fashion. It is my hope that
//! this file stay as small as possible.
//! \ingroup util
#ifndef PSTSD... | true |
9cdc7082073b98af880a92312b2501bca1e23fb5 | C++ | atompacman/Xerof | /src/civ/human/RangeOfSight.cpp | UTF-8 | 5,007 | 3.015625 | 3 | [] | no_license | #include <iosfwd>
#include <FatalErrorDialog.h>
#include <RangeOfSight.h>
const std::string ERR_MSG("Invalid range of sight model file format: ");
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = //
// CONSTRUCTOR/DESTRUCTOR //
//- - - -... | true |
2d5292cb6c93e72c56d87c82da06a2e126c6a70c | C++ | benjamincarman/cpp-nfold-ILP | /nfold.cc | UTF-8 | 21,882 | 2.921875 | 3 | [] | no_license | /*******************************************************************************
*
* File: nfold.cc
*
* Author: Benjamin Carman
*
* Date: June 4, 2019
*
* Description: An implementation file of the NFold class which allows for the
* the creation of an ILP instance with the n-fold form. This class
... | true |
97c7f744bda82160a11a839df883e70c7ee33612 | C++ | Tatane/DrumPart | /partition.h | UTF-8 | 506 | 2.6875 | 3 | [] | no_license | #ifndef PARTITION_H
#define PARTITION_H
#include <list>
#include <memory>
#include "measure.h"
using namespace std;
class Partition
{
public:
using MeasuresContainer = list<unique_ptr<Measure>>;
Partition();
void play();
int getTempo() const {return tempo; }
Measure & insertMeasure(int posit... | true |
9ca58fd4848bd4825568ca3d5e6a88be2c81bf7e | C++ | mecha-rm/GDW_Y2-PJT-repos | /GDW_Y2 - CNZ/src/CSV.h | UTF-8 | 571 | 3.21875 | 3 | [] | no_license | // class used for construction of level map
#pragma once
#include <string>
#include <vector>
#include <iterator>
#include <iostream>
#include <fstream>
#include <sstream>
// Basically we're reconstructing the CSV into an object.
class CSV
{
public:
// constructor
CSV() = default;
// constructor
CSV(std::string c... | true |
7b003f97413db97e1ce635d51f3f4868fdfc04bd | C++ | vgb0332/HomeForC- | /project2/main.cpp | UHC | 3,546 | 2.859375 | 3 | [] | no_license | /*
* main.cpp
*
* Created on: Mar 30, 2012
* Author: cskim
*/
#include <iostream>
#include "String.h"
using namespace std;
#include "PhoneContactList.h"
#include "PhoneContactMap.h"
#include "CPhoneContact.h"
/********************* 5 ߰ **********************/
string nameData[] = {"Park SH", "K... | true |
55e9e63c08b9535ec0b4d70df9d91f0c0fcd1da7 | C++ | lmc110/GameOfLife | /life.h | UTF-8 | 730 | 2.90625 | 3 | [] | no_license | /****************************************************
This program reads an input file and adds the data
to a dynamically allocated grid. The grid consists of
live and dead cells. Once grid is populated with cells,
it is displayed to the screen. Each cell is then checked
for live neighbors and the rules are appli... | true |
ad23bfc72a77939143d44635e86e5751a2c31d75 | C++ | skygaofei/Code | /Luogu/P3385 【模板】负环.cpp | UTF-8 | 1,665 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | //
// SPFA.cpp
// CSP RP++
//
// Created by skygao on 2019/11/15.
// Copyright © 2019 skygao. All rights reserved.
//
#include <stdio.h>
#include <queue>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#define maxn 2005
using namespace std;
int n,m... | true |
6e960242c5d9980df37df1a29db4f17a5092fd33 | C++ | ShawnDordeJay/Benchmark_Primzahlen_2 | /Benchmark_Primzahlen_2/Config.h | UTF-8 | 224 | 2.515625 | 3 | [] | no_license | #pragma once
class Config
{
public:
~Config();
static Config *getInstance(int N, int howmanyvalues);
int getN();
int getHowManyValues();
private:
Config();
static Config *INSTANCE;
int N;
int howmanyvalues;
};
| true |
c2f12a0d1431ea7111f19d6aab31458af245c9c9 | C++ | worden-lee/bikh-on-network | /cascade.h | UTF-8 | 21,529 | 2.578125 | 3 | [] | no_license | #include "networks.h"
#include "CSVController.h"
#include "BoostDotDisplay.h"
#include "CascadeParameters.h"
#include <boost/random/bernoulli_distribution.hpp>
using namespace std;
// classes for doing the Bikhchandani and related update rules
// abstract base class for an object to update states of nodes on network,... | true |
c5b15e51ac30cf27fb55c5dd6725cbac141f08dd | C++ | danillshir/7.1 | /5/5.cpp | UTF-8 | 1,107 | 3.1875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
setlocale(0, "");
int array[10][10], a, b;
cout << "Введите количество строк: " << endl;
cin >> a;
cout << "Введите количество столбцов: " << endl;
cin >> b;
cout << "Введите элементы массива: " << endl;
for (int i = 0; i < a; i++)
... | true |
ab9c9bc7ed5e74218beefc0465baaf3275f3159b | C++ | mmorri22/cse20312 | /Lecture02/char4.cpp | UTF-8 | 1,069 | 3.78125 | 4 | [] | no_license | /**********************************************
* File: char4.cpp
* Author: Matthew Morrison
* Email: matt.morrison@nd.edu
*
* This is a basic program to show students how to
* allocate a char pointer and memory, sets all the characters
* to Hello, World, and then prints their addresses and values
*
* Lectur... | true |
bdd2a821c608adddc917994f60c98eefb6d26674 | C++ | mwerezak/MTE380 | /oliphaunt/action.cpp | UTF-8 | 478 | 2.59375 | 3 | [] | no_license | #include "action.h"
void Action::start(ActionArgs *args) {
if(proc_status != STOPPED) return;
proc_status = RUNNING;
setup(args);
}
void Action::stop() {
if(proc_status != RUNNING) return;
cleanup();
proc_status = STOPPED;
}
void Action::suspend() {
if(proc_status != RUN... | true |
3e1be75de6dfcc9da12acbf650267594b6dee04c | C++ | omerkatz1999/CS2B | /Assignment3_CS2b/Assignment3_CS2b/main.cpp | UTF-8 | 5,993 | 3.4375 | 3 | [] | no_license | //
// main.cpp
// Assignment3_CS2b
//
// Created by Omer Katz on 4/20/18.
// Copyright © 2018 Omer Katz. All rights reserved.
//
#include <iostream>
#include <string>
#include <iostream>
#include <sstream>
#include <cctype>
#include <cstdlib>
#include<iomanip>
using namespace std;
class Automaton
{
private:
... | true |
04ce5363d5bdcbafd476f5ee144757e85693bf4b | C++ | Weirb/scientific-computing | /project1/src/testing.h | UTF-8 | 14,135 | 3.140625 | 3 | [] | no_license | #ifndef TESTING_H
#define TESTING_H
#include <iostream>
#include <fstream>
#include "mvector.h"
#include "mmatrix.h"
#include "mbandedmatrix.h"
#include "functions.h"
#include "timing.h"
#include <vector>
#include <string>
const string DATAPATH = "/data";
// Task 3.2.1.3
void test_vector_overloads(){
/*
Test the add... | true |
46136f5fe6ffd422accf8a0669c7df604080c2b6 | C++ | dxiong2000/USACO-Gold | /StarLeague USACO Gold/Searching 1/bds/bds.cpp | UTF-8 | 1,027 | 3.265625 | 3 | [] | no_license | // bds.cpp
#include <iostream>
#include <cmath>
using namespace std;
int n, finalsum, arr[100], arr2[100];
bool mark[100];
int factorial(int a) {
if (a == 0) {
return 1;
}
return a*factorial(a - 1);
}
int comb(int a, int b) { //aCb
return (factorial(a)) / (factorial(b)*factorial(a - b));
}
int solve() { //u... | true |
d03416ed22382f0c4ae4b6b2d52744818a515b3d | C++ | SaberDa/LeetCode | /C++/3-longestSubstringWithoutRepeatingCharacters.cpp | UTF-8 | 720 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <unordered_map>
#include <algorithm>
using namespace std;
int main() {
string s;
s = "abcabcbb";
if (s.empty()) {
return 0;
}
int maxLength = 0;
int start = 0;
unordered_map<char, int> substr;
for (int end = 0; end < s.size... | true |
ec5823ed0dddc5719bd095b0dc7a6f9958a14cce | C++ | sarath1502/Programming_for_Engineers | /HW2/HW2_U107184/root_finding.cpp | UTF-8 | 837 | 2.75 | 3 | [] | no_license | #include<iostream>
#include<cmath>
int main()
{
int length, n;
double f, f_prime, i_root, f_root, thold_input, thold_calc;
std::cin >> length;
for (int i = 0; i < length; i++)
{
std::cin >> i_root >> n >> thold_input;
thold_calc = std::numeric_limits<double>::max();
std::cout << "Case " << i... | true |
fd5f2caacdbbde2708549cf31d70aad2db75c363 | C++ | jaidurn/Design-Tests-take-2 | /Design Tests/UIDeckGrid.h | UTF-8 | 801 | 2.5625 | 3 | [] | no_license | #pragma once
#include "UIMenu.h"
#include "Deck.h"
class InputMessage;
class UIDeckGrid : public UIMenu
{
public:
UIDeckGrid(Vector2D position,
int width,
int height,
string texturePath,
int cardPerRow,
int rowCount,
Deck *deck);
virtual ~UIDeckGrid();
virtual void setWidth(int width);
virtual void ... | true |
5e53018c643abe1b667bfcfeb4134c69f2099e46 | C++ | nnovoice/acmuva | /solutions/acm/AndysFirstDictionary10815/AndysFirstDictionary10815.cpp | UTF-8 | 2,017 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <set>
#include <string.h>
const int MAXCHARS = 1025;
using namespace std;
int main()
{
//int num = 0; /// LEARNING: this was not required
set<string> words;
set<string>::iterator iter;
set<string>::iterator iterEnd;
set<string> newWords;
set<string>::iterator ne... | true |
1aeb9f2db9426c1ef3ddb474ea001cb6fa7c315c | C++ | arijit91/sorting-networks | /inversion.cpp | UTF-8 | 1,177 | 3.0625 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
vector<int> a;
long long ret;
void merge(int lb , int mid , int ub)
{
int add = 0;
int lp = lb;
int rp = mid + 1;
vector<int> temp;
while( add <= ub - lb + 1 )
{
if( lp > mid )
temp.push_back( a[rp++] ... | true |
80433a973b5d5a1d090f6674081cb6bd8a1646b4 | C++ | Globidev/graph | /app/srcs/osm/loader.cpp | UTF-8 | 3,013 | 2.625 | 3 | [] | no_license | #include "loader.hpp"
#include "constants.hpp"
namespace osm {
struct Visitor: public osmium::handler::Handler {
Visitor(ParsedData & data):
data_ { data }
{ }
~Visitor() {
uint count = 0;
std::unordered_map<NodeId, uint> node_id_map;
// ... | true |
6abde5d475577b45a51fea81655780f22dd9802c | C++ | Guardian820/Teal | /include/util/util.inl | UTF-8 | 519 | 2.578125 | 3 | [
"MIT"
] | permissive | // Copyright (C) 2019 Samy Bensaid
// This file is part of the Teal project.
// For conditions of distribution and use, see copyright notice in LICENSE
#include <type_traits>
template<class T, class ReturnType = T>
ReturnType distance(const T& x, const T& y)
{
static_assert(std::is_arithmetic<ReturnType>... | true |
d847e13d707ef77a95e09615856bee180a547e83 | C++ | qanyue/code | /backup/AcmSkillTest.cpp | UTF-8 | 977 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <utility>
#include <cmath>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//交换a,b 不用第三个变量
int a{10}, b{20};
a ^= b, b ^= a, a ^= b;
cout << a << " " << b << endl;
// swap函数使用(包含在<utility>中
swap(a, b);
... | true |
30bca8dbe8b8f850fc27234fd1d5b2a9e9e7c863 | C++ | onurguner/HackerRank | /cpp/Insertion Sort - Part 1.cpp | UTF-8 | 1,184 | 2.703125 | 3 | [] | no_license | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
... | true |
49d19a911d3236ba58ac1a73e7489f16a7fb84a0 | C++ | IngoChou/Inline-Engine | /Engine/GameLogic/ContiguousVector.hpp | UTF-8 | 2,266 | 3.25 | 3 | [] | no_license | #pragma once
#include <vector>
#include <algorithm>
namespace inl::game {
template <class T, class Alloc = std::allocator<T>>
class ContiguousVector : private std::vector<T, Alloc> {
using VectorT = std::vector<T, Alloc>;
public:
using VectorT::allocator_type;
using VectorT::const_iterator;
using VectorT::cons... | true |
fe6926bfa0b8d2b46fd8e5b258dd5ad2e21e4576 | C++ | AmonJG/AdventOfCode2020 | /AdventOfCode2020/AdventOfCodeDay1.cpp | UTF-8 | 1,032 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include "AdventOfCodeDays.h"
AdventOfCodeTask1Day1::AdventOfCodeTask1Day1()
{
int inputEntry;
std::vector<int> inputList;
auto inputStream = GetInput("Day1.txt");
while (inputStream >> inputEntry)
{
inputList.push_back(inputEntry);
for (size_t i = 1; i < inputList.size(... | true |
85d67c3b9f1e39fedb1576fd986b08c3e07fa321 | C++ | vector-of-bool/leaf | /test/handle_basic_test.cpp | UTF-8 | 3,275 | 2.625 | 3 | [
"BSL-1.0"
] | permissive | // Copyright (c) 2018-2019 Emil Dotchevski and Reverge Studios, Inc.
// 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)
#include <boost/leaf/config.hpp>
#ifndef LEAF_NO_EXCEPTIONS
# include <boost/leaf/handle_excepti... | true |
73f070486c0edebd276340b294bd4f05fdfc2727 | C++ | mynick777/msdk | /msdk/mscom/managedb/managedb/connpool.h | GB18030 | 4,272 | 2.609375 | 3 | [] | no_license |
#pragma once
#include <vector>
#include <deque>
#include <database/genericdb.h>
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#include <assert.h>
class CONN_IMPL;
#define ASSERT assert
class CMyEvent
{
public:
CMyEvent()
{
m_hEvent = CreateEvent(
0,
TRUE,
FALSE,
NULL
);
AS... | true |
3db456e4f2344f32f3d8295a02a8bf104fec65e0 | C++ | GPDP2/vba-next | /src/sound_gb_apu.inl | UTF-8 | 13,461 | 2.703125 | 3 | [] | no_license | /*============================================================
GB APU
============================================================ */
/* 0: Square 1, 1: Square 2, 2: Wave, 3: Noise */
#define OSC_COUNT 4
/* Resets hardware to initial power on state BEFORE boot ROM runs. Mode selects*/
/* sound hardware. Additional A... | true |
c03fb0e99fba3c5b9f0a310871a79cb0c5c74d31 | C++ | Kale-Grabovski/cpp-patterns | /Command/Broker.cpp | UTF-8 | 353 | 2.71875 | 3 | [] | no_license | #include <memory>
#include <algorithm>
#include "Order.h"
#include "Broker.h"
void Broker::takeOrder(const std::shared_ptr<Order> order) {
orderList.push_back(order);
}
void Broker::placeOrders() {
std::for_each(orderList.begin(), orderList.end(), [](std::shared_ptr<Order> order) {
order->execute();
... | true |
ef2c741e47c51f283a5c15f5f2da993736d223a1 | C++ | LauraDiosan-CS/lab8-11-polimorfism-GRazvan12 | /IEntity.cpp | UTF-8 | 2,565 | 3.6875 | 4 | [] | no_license | #include "IEntity.h"
//Desc: creates a new object of type IEntity
//In: -
//Out: a new object of type IEntity with implicit values
IEntity::IEntity() {
this->id = 0;
this->name = "";
}
//Desc: creates a new object of type IEntity
//In: id, string - the id to be given to the new object
// name, string... | true |
d251470b4533c2b83cdb3bd3f7180ad6f762fe45 | C++ | marcinkociolek/CarrotMarker | /carrotdefect.h | UTF-8 | 1,267 | 2.625 | 3 | [] | no_license | #ifndef CARROTDEFECT_H
#define CARROTDEFECT_H
#include <string>
const int defectCount = 15;
const std::string DefectNames[defectCount] = {
"LargeBlackPatches - ",
"SmallBlackPatches - ",
"BlackEnd - ",
"RotEnd - ",
"RotOutEnd - ",
"Whi... | true |
6361206945bce1229790ba707f570e08a52d45d0 | C++ | cornell-brg/xloops-bmarks | /stdx/stdx-MiscUtils.inl | UTF-8 | 1,739 | 2.78125 | 3 | [] | no_license | //========================================================================
// stdx-MiscUtils.inl
//========================================================================
// We make the bit fields inline because often the msb and lsb are
// compile time constants so it is very likely that the compiler can
// optimize ... | true |
4f6d325b22d047cad613c303bb629137f6a9c154 | C++ | nicepepper/oop | /lab3/Car/Car/car.h | UTF-8 | 574 | 3.109375 | 3 | [] | no_license | #pragma once
#include <string>
class Car
{
public:
Car();
bool TurnOnEngine();
bool TurnOffEngine();
bool SetGear(int gear);
bool SetSpeed(int speed);
int GetGear() const;
int GetSpeed() const;
bool DoesEngineTurnedOn() const;
std::string GetMoveState() const;
private:
enum Move
{
STOP,
BACKWARD,
FOR... | true |
7bd0c20ee2dca00ed3de3859787f99f1fec9e79d | C++ | VidushiGupta80/leetcode | /solutions/validate-stack-sequences.cpp | UTF-8 | 497 | 3.453125 | 3 | [] | no_license | //Validate Stack Sequences -> 08/22/2020 11:59
class Solution {
public:
bool validateStackSequences(vector<int>& pushed, vector<int>& popped) {
stack<int> stk;
int popp = 0;
for(int pushh = 0; pushh < pushed.size(); pushh++)
{
stk.push(pushed[pushh]);
while(!s... | true |
7d3c279441c49383e088a9a584160f91a1ec4d79 | C++ | coolsuperman/Practice-Cpp | /P-YinZiGeShu/main.cc | UTF-8 | 677 | 2.984375 | 3 | [] | no_license | // write your code here cpp
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void DigitNum(vector<int>& back,int& num){
for(int i= 2;i*i<=num;i++){
if(num%i==0){
back.push_back(i);
num/=i;
DigitNum(back,num);
break;
}
}
return;
}
int main(){
int num... | true |
c9fab6e4b742b78004c4df84b6a949c5f2509065 | C++ | jeniffer9/ETHZ-AlgoLab-2020 | /9. BGL Advanced Flows/1. Real Estate Market.cpp | UTF-8 | 2,575 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/push_relabel_max_flow.hpp>
#include <boost/graph/successive_shortest_path_nonnegative_weights.hpp>
#include <boost/graph/find_flow_cost.hpp>
typedef boost::adjacency_list_traits<boost::vecS, boost::vecS, boost::directedS> traits;
type... | true |
968eeecfc0a3748ef69b9d41d97f6ada1ec61dfe | C++ | ZealousCynic/CppFilestreamV2 | /FilestreamV2/Filestream.h | UTF-8 | 1,365 | 2.828125 | 3 | [] | no_license | #pragma once
#include <fstream>
#include <string>
#include <vector>
#include "rapidxml/rapidxml.hpp"
#include "rapidxml/rapidxml_print.hpp"
class Filestream
{
public:
Filestream();
~Filestream();
//FILE ACCESS
void Filepick(std::string input);
void OpenFile();
void Read();
//XML FUNCTIONALITY
void ChangeCurr... | true |
8a81169043615c72d3414132393ab9ed3e996e78 | C++ | mmorshed99/dynamic_programming | /word_break.cpp | UTF-8 | 956 | 3.375 | 3 | [] | no_license | /*Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
#
#For example, given
#
#s = "myinterviewtrainer",
#dict = ["trainer", "my", "interview"].
#Return 1 ( corresponding to true ) because "myinterviewtrainer" can be segmented... | true |
7de7a233512a9a604375d61005bdf46ac405760e | C++ | gnafit/gna | /core/parameters/changeable.hh | UTF-8 | 8,358 | 2.703125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <typeinfo>
#include <functional>
#include <deque>
#include <initializer_list>
#include <set>
#include <cstring>
#include <string>
#include "arrayview.hh"
class changeable;
struct references {
using Container = std::vector<changeable>;
bool has(changeable obj) const;
size_t index(chang... | true |
475dd8d34629ef196cbe80664d93865d512e1d27 | C++ | idovelemon/simplepathtracer | /spt/spt/spt/sptcamera.h | UTF-8 | 1,175 | 2.5625 | 3 | [] | no_license | //----------------------------------------------------------
// Declaration: Copyright (c), by i_dovelemon, 2017. All right reserved.
// Author: i_dovelemon[1322600812@qq.com]
// Date: 2017 / 05 / 04
// Brief: Use this camera to view the world
//----------------------------------------------------------
#ifndef _SPT_SP... | true |
154d1c5a3f3f69ddb1d1581e93d4681b324ff065 | C++ | edubeckha/Compiladores | /TrabalhoI/st.h | UTF-8 | 2,357 | 3.1875 | 3 | [] | no_license | /*Ja previamente definido por Laércio Lima Pilla e ampliado para aceitar funcoes e outros tipos de estruturas*/
#pragma once
#include <map>
#include "ast.h"
extern void yyerror(const char* s, ...);
namespace AST {class Node;}
namespace ST {
class Symbol;
enum Kind { variable, arranjo, function };
typedef std::map<... | true |
4217d0c1fb98434307d754995f9eabd12caba76e | C++ | YoddleK/teme | /T_3dec2013_5.cpp | UTF-8 | 759 | 2.953125 | 3 | [
"Artistic-2.0"
] | permissive | #include <iostream>
#include <math.h>
using namespace std;
//5. Se citesc numere atata timp cat sunt mai mari decat 100.
//Numarati cate dintre valorile citite sunt numere prime.
int main (int argc, char* argv[])
{
const int N = 5;
int a[N] = {131, 111, 171, 200, 101};
int count = 0, n;
for(n = 0... | true |
76aea38d1c305738b85f356b7e4c8041d818490a | C++ | hoou/mitmProject | /src/Group.cpp | UTF-8 | 299 | 3.078125 | 3 | [] | no_license | #include "Group.h"
Group::Group(const string &name, const vector<Host> &hosts) : name(name), hosts(hosts) {}
void Group::addHost(Host host) {
hosts.push_back(host);
}
const string &Group::getName() const {
return name;
}
const vector<Host> &Group::getHosts() const {
return hosts;
}
| true |
3d1b259f302b851e1da866a89767a3f067266e71 | C++ | jclundy/MTE_380_Code | /spool_control/spool.h | UTF-8 | 548 | 2.796875 | 3 | [] | no_license | #ifndef SPOOL_H
#define SPOOL_H
#include <Servo.h>
#include <Arduino.h>
// spool servo values
#define RESTING_uS 1525
#define UNWIND_uS 1510
#define TAKE_IN_FAST_uS 1600
#define TAKE_IN_SLOW_uS 1560
class spool {
public:
spool(Servo* servo);
~spool();
// sends signal to servo to stop rotation
void stopRotating(... | true |
6c3699fbfdaf25dc276e3e0bdd00565592d9d7b5 | C++ | yzcmf/oicode | /codeforces/555B.cpp | UTF-8 | 1,382 | 3.09375 | 3 | [] | no_license | /* Codeforces 555B. Case of Fugitive
* Sortings */
#include <cstdio>
#include <iostream>
#include <set>
#include <algorithm>
const int MaxN = 200010;
int n, m;
long long L[MaxN], R[MaxN];
struct range_t
{
int id;
long long l, r;
bool operator < (const range_t& z) const
{
if(l <= z.l && z.r <= r)
return fa... | true |
c9647c6ee500a8609c8bf8d51c0da3666368e3a8 | C++ | Beldex-Coin/beldex-core-custom | /external/loki-mq/tests/common.h | UTF-8 | 2,261 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | #pragma once
#include "oxenmq/oxenmq.h"
#include <catch2/catch.hpp>
#include <chrono>
using namespace oxenmq;
static auto startup = std::chrono::steady_clock::now();
/// Returns a localhost connection string to listen on. It can be considered random, though in
/// practice in the current implementation is sequentia... | true |
fdeba2e8981ac1da1160fd37822d3e5ea70140e4 | C++ | mchchiang/phase_field_model | /c/benjamin_model/analysis/src/pair_corr.cpp | UTF-8 | 4,056 | 2.796875 | 3 | [] | no_license | // pair_corr.cpp
// A program to compute the pair correlation function
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <omp.h>
#include "position.hpp"
using std::cout;
using std::endl;
using std::ifstream;
usi... | true |
ede4a05166180202489e87dbc934bf1cb4c077bc | C++ | elshift/ezcompile | /src/minics/cs_state.h | UTF-8 | 3,141 | 2.9375 | 3 | [] | no_license | #pragma once
#include "cs_object.h"
#include "cs_string.h"
#include "cs_bool.h"
#include "cs_int.h"
#include <vector>
#include <stack>
#include <assert.h>
class CS_Object;
#ifdef _DEBUG
#define CS_DBG_STATE(state, newHandleName) size_t newHandleName = state.Size()
#define CS_DBG_STATE_END(state, handleName) \
ass... | true |
84c18319a3ce391d1219bd64a6f8e725998f43eb | C++ | Robert170/Prograc-on_II_2019B_Roberto_Ramirez_Ontiveros | /Parcial_2/Practicas/Proyecto_Segundo_Parcial/Node.cpp | ISO-8859-10 | 2,954 | 3.578125 | 4 | [] | no_license | #include "Node.h"
const std::string Node::getName()
{
return name;
}
void Node::setName(std::string Nom)
{
name = Nom;
}
const std::string Node::getLastName()
{
return lastName;
}
void Node::setLastName(std::string Last)
{
lastName = Last;
}
const std::string Node::getEmail()
{
return email;
}
void Node::s... | true |
27b489f43d35abb7461ba7e9e8d524c6b8d6a061 | C++ | woniuge/basicCode_C-Cpp | /贪吃蛇网络版/Client/SocketClient.cpp | UTF-8 | 1,647 | 3.078125 | 3 | [] | no_license | /*程序名:SocketClient.cpp
*功能:完成客户端Socket的类实现
*作者:袁海峰
*日期:2017年11月11日
*/
#include "SocketClient.h"
#include <cstdio>
#include <sys/socket.h>
#include <cstring>
#include <arpa/inet.h>
#include <cstdlib>
#include <unistd.h>
#define LENGTH_OF_LISTEN_QUEUE 20
int SocketClient::clientGetConnection(const char * serverIP, int... | true |
8164f2c0eb42b3225e8b9953aa5aa952108e5c48 | C++ | ponxosio/protocolGraph | /protocolGraph/operations/cpuoperation.h | UTF-8 | 403 | 2.71875 | 3 | [] | no_license | #ifndef CPUOPERATION_H
#define CPUOPERATION_H
#include <graph/Node.h>
class CPUOperation : public Node {
public:
CPUOperation() :
Node()
{
}
CPUOperation(const CPUOperation & obj) :
Node(obj)
{
}
CPUOperation(int idContainer) :
Node(idContainer)
{
}
virt... | true |
43466b4a04e5f03140a7482617c5899c829c6676 | C++ | JosephPai/LeetCode | /646. Maximum Length of Pair Chain.cpp | WINDOWS-1252 | 856 | 2.6875 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include<algorithm>
// Solution: https://leetcode.com/problems/maximum-length-of-pair-chain/discuss/105602
// ̬滮
using namespace std;
class Solution {
public:
int findLongestChain(vector< vector<int> > & pairs) {
... | true |
221bb2d525270811f63c36557fe5282992c50a23 | C++ | ProjectAsura/rt_study | /RealisticRayTracing/Chapter6/uv_sphere.h | UTF-8 | 459 | 2.625 | 3 | [
"MIT"
] | permissive | // UVSphere.h
#pragma once
#include "shape.h"
#include "ray.h"
#include "texture.h"
class UVSphere : public Shape
{
public:
UVSphere(const Vector3& c, float r, Texture* tex);
bool hit(const Ray& ray, float tmin, float tmax, float time, HitRecord& record) const override;
bool shadowHit(const... | true |
d9a68052da8f0b0c4a25b3cd6e524f9cc5eff2fc | C++ | xdfc1745/GWNU-Junior | /Algorithm/qsort/test.cpp | UTF-8 | 621 | 3.5625 | 4 | [] | no_license | #include <iostream>
#include <cstdlib>
using namespace std;
int compare(const void* a, const void* b)
{
const int* x = (int*)a;
const int* y = (int*)b;
if (*x > *y)
return 1;
else if (*x < *y)
return -1;
return 0;
}
int main()
{
const int num = 10;
int arr[num] = { 9,0,19,-1,7,9,5,15,... | true |
2d8c549e6bb0db7ee146c5c71c3f974f317eecca | C++ | mohammadbutt/42_cpp_piscine | /rush00/ft_retro/finished_part/Bullet.cpp | UTF-8 | 2,194 | 3 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Bullet.cpp :+: :+: :+: ... | true |
a145eb095a0615e7522eadc00b944612faf36def | C++ | iot-linti/doa-sketchs | /archivos_emilio/BlinkESP/BlinkESP.ino | UTF-8 | 511 | 3.171875 | 3 | [] | no_license | #define LED_BUILTIN 2
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
Serial.println();
Serial.println("Bienvenido al Blinky!!!");
}
void loop() {
Serial.print("HIGH,");
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); ... | true |
f77c5fb3df308d8b6ea3a0a794d2cc9cd23e6d26 | C++ | abdelhakeem/8puzzle | /src/Solver.cpp | UTF-8 | 1,755 | 2.734375 | 3 | [] | no_license | #include <unordered_set>
#include "Solver.h"
Result Solver::solve(const Board& board, FringePolicy::sptr policy,
size_t maxNodes, size_t maxDepth) {
Result res = {
.solved = false,
.initialBoard = board,
.path = std::vector<Direction>(),
.nodesExpanded = 0,
... | true |
0a068bd4dd1949c485dc3d518532d2c643234b3c | C++ | ExternalRepositories/tm | /src/tm_print/int_backend_crt.cpp | UTF-8 | 1,643 | 2.765625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | static PrintFormattedResult tmp_print_value(char* dest, tm_size_t maxlen, uint32_t value, const PrintFormat& format) {
TM_ASSERT(!dest || maxlen > 0);
TM_ASSERT_VALID_SIZE(maxlen);
PrintFormattedResult result = {maxlen, TM_EOVERFLOW};
const char* format_string = "%" PRIu32;
if (format.base == 16) {... | true |
5494047c20225d75d448014b3ea268e76b3c55cc | C++ | axeng/ml-lib | /tests/unit_tests/data_structure/matrix/matrix_print.cc | UTF-8 | 2,578 | 3.1875 | 3 | [] | no_license | /**
** @file tests/unit_tests/data_structure/matrix/matrix_print.cc
** @brief Tests for Print functions of ml::data_structure::matrix::Matrix
*/
#include "data_structure/matrix/matrix.hh"
#include "gtest/gtest.h"
namespace tests::unit_tests
{
TEST(DataStructureMatrix, Print)
{
ml::data_structure::m... | true |
544bebe26194aab38b644d1194aca9afbef5dc72 | C++ | Nelson-Chacon/cpp | /Ejercicios/Ejercicio29-funciones-INT/Funcion-int.cpp | UTF-8 | 461 | 3.359375 | 3 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
int suma(int a,int b){// a representa el 5 y b representa el 7 que se colocaron en la funcion main
return a + b;//realiza la operacion
}
int main(int argc, char const *argv[])
{
system("cls");
cout<<"Los resultados de la suma son: "<<endl;
cout<<suma(5,7);
... | true |
d75f9a55e07560d6676c2248707e46001fd7fff0 | C++ | ajsewell/Final-Project | /PredatorPrey.h | UTF-8 | 1,333 | 2.65625 | 3 | [] | no_license | // Project Name: Final Project
// Name: Allysa Sewell
// Date: 6/8/18
// Class: CS 172
#ifndef PREDATORPREY_H_
#define PREDATORPREY_H_
#include "Species.h"
class PredatorPrey: public Species
{
public:
PredatorPrey();
PredatorPrey(string name, double size, double time, double growthRate,
double pAl... | true |
c67988caefd8ed15b5133224453bb2327d8eeadd | C++ | alexZalachenko/Roland | /Roland/ShadersManager.cpp | UTF-8 | 3,130 | 3.265625 | 3 | [] | no_license | #include "ShadersManager.h"
#include <fstream>
#include <iostream>
#include <string>
ShadersManager::ShadersManager()
{
}
ShadersManager::~ShadersManager()
{
//std::map<std::string, GLuint>::iterator t_iterator;
for (auto t_iterator = c_programs.begin(); t_iterator != c_programs.end(); ++t_iterator)
glDeletePro... | true |
e833919b2fc96db16b685d74242fecd3e72cb8d0 | C++ | dungkaito/TTUD2020 | /0/11.cpp | UTF-8 | 588 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void rec(string s, int k, string &maxx) {
if (k==0) return;
for (int i=0; i<s.size(); i++) {
for (int j=i+1; j<s.size(); j++) {
if (s[i]<s[j]){
swap(s[i],s[j]);
if (s.compare(maxx)>0) maxx=s;
rec(s... | true |
77fff992d364f8ba2bccc70caa6b919edd819091 | C++ | AnnaEnakieva/zadachi | /26.12.18/7.cpp | UTF-8 | 648 | 3.359375 | 3 | [] | no_license | /*Напишите программу переводящую число в систему счисления с основанием k, где k не превышает 30.*/
#include <iostream>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
int amount = 0; //количество цифр в записи данной системы счисления
for (int i = k; i < n; i*=k)
{
amount ++;
} ... | true |
565a74fd068ce6750fc784e030034ee18eaf3cbd | C++ | subnr01/subs-practice | /leet_code/arrays/2Darray/maximal/maximal_square.cpp | UTF-8 | 4,571 | 3.734375 | 4 | [] | no_license | /*
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.
For example, given the following matrix:
1101
1101
1111
Return 4.
*/
//Brute force
class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
/*
if (matrix.size() == 0) {
... | true |
10c49e8ec5e5bdda4ae6ed3b822d098b984ef0c7 | C++ | MaxCarlson/Containers | /Containers/UnorderedSet.h | UTF-8 | 1,090 | 2.859375 | 3 | [] | no_license | #pragma once
#include <utility>
#include "RobinHood.h"
template<class Key,
class Hash,
class KeyEqual,
class Allocator>
struct USetTraits
{
using key_type = Key;
using value_type = Key;
using hasher = Hash;
using key_equal = KeyEqual;
using allocator_type = Allocator;
using node_type = key_type;
st... | true |
6b52731905cb523c0529c442eb62f85ab4b5c1d7 | C++ | mlekon/Qboy | /Z80.cpp | UTF-8 | 5,049 | 2.59375 | 3 | [] | no_license | #include "Z80.h"
#include "allegro.h"
#include <fstream>
Z80::Z80()
{
reset();
}
Z80::~Z80()
{
#ifdef DEBUG
logger.close();
#endif
}
/////////////////////////////////
//reset all registers and control variables
//so that it behaves as if the system experienced a hard reset
void Z80::reset()
{
instructionsExecu... | true |
95d9436dbdae8a8da9e15423cbacbb371429a4de | C++ | aa10402tw/interview_prepare | /Coding(c++)/4_STL/stack-queue/152. Maximum Product Subarray.cpp | UTF-8 | 1,207 | 3.609375 | 4 | [] | no_license | /* [Question Description]
Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product.
# Example 1
Input: [2,3,-2,4]
Output: 6
Explanation: [2,3] has the largest product 6.
# Example 2
Input: [-2,0,-1]
Output: 0
Explanation: The result canno... | true |
bc6064c6a37183ede4ef2abe5d74b24b429e1871 | C++ | louiswins/sendit | /client/recv_buf.h | UTF-8 | 745 | 2.9375 | 3 | [
"MIT"
] | permissive | #ifndef RECV_BUF_H
#define RECV_BUF_H
#include <streambuf>
#include <vector>
#include <cstdlib> /* std::size_t */
#include <sys/socket.h>
/**
* Usage:
* recv_buf buf(socket);
* istream is(&buf);
* (Now you can use is as any other istream, e.g. is >> variable, is.get(), &c.
*/
class recv_buf : public std::stream... | true |
f43042995eefdb38fb1eaaa29b1f1f09cafab3e4 | C++ | aka0909/Data-Structures-and-Algorithms | /DATA STRUCTURES/MATRIX/Transpose_Efficient.cpp | UTF-8 | 549 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#include <climits>
#include <deque>
using namespace std;
const int R=4,C=4;
void Transpose(int arr[R][C])
{
for(int i=0;i<R;i++)
{
for(int j=i+1;j<C;j++)
swap(arr[i][j],arr[j][i]);
}
}
int main()
{
int arr[R][C] = {{1, 2, 3, 4},
... | true |
1cfbf1614f2b563a532f97746a1cb0c426d0d101 | C++ | sw15-algorithm-study/algorithm_study | /영재/8주차/8_3_1932.cpp | UTF-8 | 1,054 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
// 0번째는 사용하지 않고 1 ~ n 번째 인덱스만 사용
int** dp = new int*[n+1]();
vector<vector<int> > triangle;
for(int i = 0; i <= n; i++)
{
dp[i] = new int[n+1];
vector<int> tmpVector;
triangle... | true |
239f288f9f0909c45f7067dab943fe28f4401e3b | C++ | GlassyYang/leetcode-cplusplus | /Solution97.cpp | UTF-8 | 858 | 3.171875 | 3 | [] | no_license | //
// Created by zhang on 2021/5/10.
//
// 五分钟解决
#include <string>
#include <iostream>
#include <cstring>
using namespace std;
class Solution {
public:
bool isInterleave(string s1, string s2, string s3) {
const int s1Length = s1.length(), s2Length = s2.length();
bool dp[s2.length() + 1];
me... | true |
a38fd2ee023e2bdfd2fa15c50c1801687d1200d9 | C++ | Vaishu2001/Guess-the-number-c- | /guess.cpp | UTF-8 | 489 | 3.421875 | 3 | [] | no_license | //Guessing a number
#include<iostream>
using namespace std;
int main()
{
int snum=30,num,x=0,chance=5;
while(x!=5)
{
cout<<"Guess a number out of "<<chance <<" chances"<<endl;
cout<<"Enter a number in the range of 1 to 100 :"<<endl;
cin>>num;
if(num==snum)
{
cout<<"Right answer!!!You nailed it!!!";
break;... | true |
aa160e191e1db9990c4cf91c632287131463b594 | C++ | YangRT/About_C- | /八皇后问题.cpp | UTF-8 | 520 | 2.640625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int ans[20],b[20],c[2][28];
int n,sum=0;
void search(int i){
if(i>n){
sum++;
if(sum>3){
return;
}else{
for(int j=1;j<=n;j++){
cout<<ans[j]<<" ";
}
cout<<endl;
return;
}
}
for(int k=1;k<=n;k++){
if((!b[k])&&(!c[0][i+k])&&(!c[1][i-k+n])){
ans[i... | true |
e5c560030160769c07a0b3e03f649c2782eb0a0a | C++ | hjchai/ECS60 | /p5/TripsRunner.cpp | UTF-8 | 4,079 | 2.796875 | 3 | [] | no_license | // Author: Sean Davis
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include "TripsRunner.h"
#include "router.h"
#include "CPUTimer.h"
typedef struct
{
int originIndex;
int destinationIndex;
} CityIndices;
using namespace std;
void readFile(Flight **flights2, T... | true |
414d73533dfef43ae4d9de01c954f1c0b938afbf | C++ | whhpc19891120/algorithm | /LetCode26.cpp | UTF-8 | 643 | 3.046875 | 3 | [] | no_license | #include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
auto itpos = unique(nums.begin(), nums.end());
nums.erase(itpos, nums.end());
return itpos - nums.begin();
}
int removeDuplicates2(vector<int>& nums) {
if (nums.size() == 0) retur... | true |
0254f8727037418fbbdb5ebb29afaf96594507aa | C++ | YanzeChu/MyDataStructureAndAlgorithm | /图/vector_search_binary_a.h | GB18030 | 336 | 3.21875 | 3 | [] | no_license | #pragma once
#include "vector.h"
/*
ֲңǰźvector
*/
template<typename T>
static Rank Bin_Search(T* A, T const& e, Rank lo, Rank hi)
{
while (lo < hi)
{
Rank mi = (lo + hi) >> 1;
if (e < A[mi]) //[lo,mi)
hi = mi;
else if (e > A[mi]) //(mi,hi)
lo = mi + 1;
else
return mi;
}
}
| true |
1f2cc5cc3a49367489d97e5a878ffd713868009e | C++ | liaorongfan/GoDataStructure | /dataStructure/16.AVL_tree.cpp | UTF-8 | 2,298 | 3.09375 | 3 | [] | no_license | /*************************************************************************
> File Name: 16.AVL_tree.cpp
> Author:
> Mail:
> Created Time: Sat 17 Apr 2021 07:47:55 PM CST
************************************************************************/
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#define max(a,... | true |
f878463531dd1c6a368f5e0518f2efe409be2fd7 | C++ | fionser/YELL | /include/yell/utils/math.hpp | UTF-8 | 965 | 2.859375 | 3 | [] | no_license | #pragma once
#include "yell/ops.hpp"
#include <cmath>
namespace yell {
namespace math {
// compute a^{-1} mod prime
// i.e., a^{prime - 2}
template <typename T>
T inv_mod_prime(T a, size_t cm)
{
yell::ops::mulmod mulmod;
T ret{1};
T y = yell::params::P[cm] - 2;
while (y > 0) {
if (y & 1)
ret = mulmod(... | true |
b5f21d9142d32d11e4e6e3e95494fd1060239a86 | C++ | malysz/Algorithms-and-Data-Structures | /DataStructures/hashTable.cpp | UTF-8 | 1,302 | 3.84375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class hashTable{
private:
int size;
int *key = new int[size];
int *state = new int[size];
//0-empty, 1-occupied, -1-deleted
public:
hashTable(int s);
void insert(int k);
bool search(int k);
void remove(int k);
};
int h(int key, i... | true |
270142db9b842fa4c9d5f29d7bd6647cbbf19b20 | C++ | duchevich/c-plus-plus-VS2017-course | /Проект1/Проект1/Source.cpp | UTF-8 | 2,554 | 3.40625 | 3 | [] | no_license | /*
10. Написати програму, яка шукає індекси всіх сідлових точок матриці.
Сідлова точка – елемент матриці, який є найбільшим у рядку і одночасно
найменший в стовпці, або навпаки.
*/
#include <iostream>
using namespace std;
#define N 100
#define M 100
void dots(int arr[N][M]);
void matr(int arr[N][M]);
int ... | true |
6e66a7a4c6a67039ddbab1f1c244c7b1db02ea76 | C++ | alaneos777/club | /spoj/PROBLEM4.cpp | UTF-8 | 737 | 2.796875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
vector<int> primos;
vector<bool> es_primo;
void criba(int n){
es_primo.resize(n + 1, true);
es_primo[0] = es_primo[1] = false;
for(int i = 4; i <= n; i += 2){
es_primo[i] = false;
}
primos.push_back(2);
int limit = sqrt(n);
for(int i = 3; i <= n; i += 2){
if(es... | true |
10a71e4d9de1d8b2c8e59a9b212e1320601212e0 | C++ | mdclyburn/rfm69hcw | /src/metrics.h | UTF-8 | 910 | 2.75 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /** @file
*
* Reading statistics
*/
#ifndef RFM69_METRICS_H
#define RFM69_METRICS_H
#include "core.h"
#include "registers.h"
namespace mardev::rfm69
{
/** Returns the RSSI value.
*
* \returns RSSI value.
*/
inline int16_t rssi()
{
return - read(registers::RSSIValue) / 2;
}
... | true |
7d28378beffb926f85660680fbf8d969c3851251 | C++ | fish-ball/acm.zju.edu.cn | /24XX/zoj.2420.src.1.cpp | UTF-8 | 1,089 | 3.15625 | 3 | [] | no_license | #include <cstdio>
const int dayInYear[] = { 365, 366 };
const int dayInMonth[2][13] = {
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } };
inline bool isLeap( int year ) {
return year % 400 == 0 ||
year % 4 == 0 &&
year % 1... | true |