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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d0f59dfd4a3093d3d008c8f4c626f18200bad289 | C++ | hardcookies/dsaalgs | /binary_tree/traversal_BFS.cpp | UTF-8 | 2,755 | 4.375 | 4 | [] | no_license | /*******************************************************************
Copyright(c) 2018, James Fan
All rights reserved.
*******************************************************************/
// 二叉树的遍历算法
// C++实现二叉树广度优先遍历(BFS)又称层遍历
// 分别使用两种方法实现:1.使用输出某层的函数 2.使用队列
// 参考代码:https://www.geeksforgeeks.org/level-order-tree-tra... | true |
8d2eb963ec99064741b6bc17cf9494f8c2b77764 | C++ | Abhishek2401/data-structures | /stack.cpp | UTF-8 | 2,374 | 3.09375 | 3 | [] | no_license | // Copyright 2019 Souvik Biswas
//
// 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, dis... | true |
9864ddfaa5aebb34c6b6884a587c285288841f54 | C++ | AstyCo/eqmpi | /iterations.cpp | UTF-8 | 19,059 | 2.515625 | 3 | [] | no_license | #include "iterations.hpp"
#include <algorithm>
#include <string.h>
//#include <mem.h>
void Iterations::Requests::append(Iterations::Requests::Info info, uint sz)
{
iv.push_back(info);
v.push_back(MPI_REQUEST_NULL);
buffs.push_back(RealVector());
buffs.back().resize(sz);
statuses.push_back(MPI_... | true |
fea94db31b2d6bd043f60611f16e9776945f3272 | C++ | asd-g11-2019/LAB4 | /stack.h | UTF-8 | 647 | 3.03125 | 3 | [] | no_license | #include <cstddef> // serve per il NULL
#include <iostream>
#include <stdexcept>
#include "token.h"
using namespace std;
// Implementa STACK
namespace stack{
struct stackCell {
token token;
stackCell* next;
};
typedef stackCell* Stack;
const token EMPTY_ELEM = { "", VUOTO };
const token ERROR = { "", ERRORE ... | true |
63789f82cee51377a4142282ffdab897713ae374 | C++ | CJRMoore/CS246A5 | /basement.cc | UTF-8 | 1,344 | 2.71875 | 3 | [] | no_license | #include "basement.h"
#include "subscriptions.h"
#include "buildingtypes.h"
#include "info.h"
#include "residence.h"
#include "builder.h"
#include <memory>
using namespace std;
#include <iostream>
Basement::Basement(shared_ptr<AbstractAddress> aa)
: Residence(aa)
{
shared_ptr<Basement> tmp{this};
aa->atta... | true |
ae28694e02b31f4d5ecad23da6ab39492dd75bb3 | C++ | hustaoyang/algorithm | /greedy_algorithm/longest_palin_substr.cpp | UTF-8 | 796 | 3.265625 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
class Solution {
public:
string longestPalindrome(string s) {
size_t len = s.size();
string result;
int max_len = 0;
int max_left = 0 , max_right = 0;
for(int i = 0; i < len; i++)
{
int left = i -1;
int right = i + 1;
... | true |
42c6fc52ac2f71543e8185a2b4eac4d337d3d6e9 | C++ | shakhub/Interview | /Interview/sorting.cpp | UTF-8 | 4,012 | 3.25 | 3 | [] | no_license | #include<iostream>
#include<time.h>
#include"sorting.hpp"
#define __SORT
#define SIZE 40000
template <class T>
inline void swapSort(T *a,T *b)
{
/*
*a = *a ^ *b;
*b = *a ^ *b;
*a = *a ^ *b;
*/
T temp;
temp = *a;
*a = *b;
*b = temp;
}
template <class T>
T binarySearch(T *a,const int size, const T data)
{
/*
... | true |
03d9ea8450fc6a1534b197665f2e104d82306d4e | C++ | miuhui/LeetCode | /easy/344.cpp | UTF-8 | 571 | 3.28125 | 3 | [] | no_license | // leetcode.cpp : Defines the entry point for the console application.
//
#include <vector>
#include <iostream>
#include <string>
using namespace std;
class Solution {
public:
static string reverseString(string s)
{
int len = s.length();
if (len <= 1)
{
return s;
}
auto swapCount = len / 2;
auto fro... | true |
569a20fbb2220763f84538554934443e05c3fd35 | C++ | alexshen/raytracinginoneweekend | /dielectric.h | UTF-8 | 358 | 2.546875 | 3 | [] | no_license | #ifndef DIELECTRIC_H
#define DIELECTRIC_H
#include "material.h"
class dielectric : public material
{
public:
dielectric(float index = 1.0f)
: index(index)
{}
bool scatter(const ray3& r_in, const hit_record& rec, vec3& attenuation,
ray3& scattered) const override;
float index;... | true |
5fdb14fd747c2d80cc0f47829db1c9ee106bd6fe | C++ | nachogoro/simple-chess-games | /src/details/moves/RookMove.cpp | UTF-8 | 1,428 | 2.796875 | 3 | [
"MIT"
] | permissive | #include "RookMove.h"
#include <details/BoardAnalyzer.h>
using namespace simplechess;
using namespace simplechess::details;
std::set<PieceMove> simplechess::details::rookMovesUnfiltered(
const Board& board,
const Color color,
const Square& square)
{
const Piece rook = {PieceType::Rook, color};
std::set<Squa... | true |
244a9ed898f144d748d8edbd1760197982f82e44 | C++ | MisakaGeek/c-cpp-projects | /数据结构/冒泡排序/main.cpp | GB18030 | 787 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
using namespace std;
int main()
{
int *R, n;
cout << "Ԫظ:";
cin >> n;
R = new int[n];
for(int i = 0; i < n; i++)
cin >> R[i];
int Bound=n-1;//ȼѭ
while(Bound!=0)
{
int t=0;//t¼ÿѭĽλ,˺ֻҪСtIJ,t=0ʾ
for(int i=0;i<Bound;i++)
... | true |
7b60385c002a1903fadcd581d795561cb2765ad1 | C++ | goncasmage1/OpenGL | /CGJProject/CGJProject/src/PPFilterMesh.cpp | UTF-8 | 1,518 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "PPFilterMesh.h"
PPFilterMesh::PPFilterMesh(GLuint v_coord_id) :
v_coord(v_coord_id)
{
}
void PPFilterMesh::CreateBufferObjects()
{
GLfloat fbo_vertices[] = {
-1, -1,
1, -1,
-1, 1,
1, 1,
};
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
{
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARR... | true |
ffdd3fe6d1f653a2a4af5fb369aef21b725bddca | C++ | ZhuYuJin/ros_code | /src/car_move/RobotBasicController.h | UTF-8 | 2,138 | 3.109375 | 3 | [] | no_license |
#include <stdio.h>
#include <wiringPi.h>
#include <softPwm.h>
#define uchar unsigned char
#define HIGH 1
#define LOW 0
#define LEFT_IN_PIN 7
#define LEFT_OUT_PIN 0
#define RIGHT_IN_PIN 2
#define RIGHT_OUT_PIN 3
#define LEFT_EN_PWM 1
#define RIGHT_EN_PWM 4
using namespace std;
class RaspiRobot
{
private:
... | true |
af918f07bbaf0cc0618c680c31fb8ed82a038af0 | C++ | zmillard/385-Algorithms | /PrimesSieve/sieve.cpp | UTF-8 | 4,171 | 3.375 | 3 | [] | no_license | /*
* sieve.cpp
*
* Created on: May 23, 2016
* Author: O236
*/
/*******************************************************************************
* Name : sieve.cpp
* Author : Zoe Millard
* Date : 5/25/16
* Description : Sieve of Eratosthenes
* Pledge : "I pledge ... | true |
20ecc17e62b9d656362e75e53bb08ae724a0d6c6 | C++ | zzz0906/LeetCode | /Scripts/9.cpp | UTF-8 | 486 | 2.84375 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int answer[10000];
class Solution {
public:
static bool isPalindrome(int x) {
if (x<0) return false;
memset(answer,0,sizeof(answer));
int mid = x;
int w = 0;
int remainder;
while (mid != 0){
remainder = mid % 10;
mid = m... | true |
fa964746a153097b246dc7e8a85f329a6f05df5e | C++ | renair/BankServer | /Protocol/Packets/UserLogoutPacket.cpp | UTF-8 | 1,378 | 2.515625 | 3 | [] | no_license | #include "UserLogoutPacket.h"
#include "ErrorPacket.h"
#include "SuccessPacket.h"
#include "DataBase/Access/session_table.h"
#include <iostream>
using namespace std;
UserLogoutPacket::UserLogoutPacket(quint64 token, quint32 machineId):
_token(token),
_machineId(machineId)
{}
UserLogoutPacket::~UserLogoutPack... | true |
e3575884f64cfa5a42792bf7a95d1c8cfd4763fc | C++ | hjain5164/Competitive-Programming-Concepts-and-Algorithms | /String Matching Algorithms/KMP String Matching Algorithm.cpp | UTF-8 | 841 | 3.078125 | 3 | [] | no_license | #include <iostream>
#define MAX_N 100005
int reset[MAX_N];
using namespace std;
void KMPpreprocess(string pat)
{
int i = 0, j = -1;
reset[0] = -1;
while (i < pat.size())
{
//Check for resetting
while (j >= 0 && pat[i] != pat[j])
j = reset[j];
i++;
j++;
... | true |
777e5ee7318c15fb3ab13b2dc82a04bd387943d0 | C++ | HanmingZhang/ray-tracer | /basecode/src/scene/geometry/square.cpp | UTF-8 | 3,906 | 2.671875 | 3 | [] | no_license | #include <scene/geometry/square.h>
Intersection SquarePlane::GetIntersection(Ray r)
{
//TODO
//Transform Ray to objecet space
glm::mat4 inverse_modelMatrix = this->transform.invT();
Ray objSpace_Ray = r.GetTransformedCopy(inverse_modelMatrix);
glm::vec3 origin = objSpace_Ray.origin;
glm::vec... | true |
180ca1aa5a7f93875890aec2f38ccafd0d09831d | C++ | CsacsoBacsi/VS2019 | /Tutorial/Console/Btree/Btree.cpp | UTF-8 | 5,656 | 3.40625 | 3 | [] | no_license | // Btree.cpp : Defines the entry point for the console application.
//
#include <iostream>
//#include <iomanip>
#define MAX_ELEMS 10
using std::cout;
using std::cin;
using std::endl;
struct bst // Each node's structure.
{
int key ; // Key value from the table. Serves a base for sorting
in... | true |
da63cbbf7102e861a6ea2744ae1b1df931790ff9 | C++ | avcopan/cpppractice | /accelerated_cpp/08algorithms/03rbegin.cpp | UTF-8 | 922 | 3.71875 | 4 | [] | no_license | #include <string>
#include <algorithm>
#include <iostream>
bool is_palindrome(const std::string& s) { return std::equal(s.begin(), s.end(), s.rbegin()); }
int main()
{
std::cout << "Is it a palindrome?" << std::endl;
std::string s1("madam");
std::string s2("rotor");
std::string s3("bilbo");
std::string s4("... | true |
1c110368a6d5e5ceb00fcdb4a5d94dbf5b5c9cd9 | C++ | Himanshu-Negi8/Data-Structure-and-Algorithms | /Leetcode/Array/cords.cpp | UTF-8 | 701 | 3.109375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
bool isReachable(int x, int y,long long dy, long long dx)
{
if (x > dx || y > dy)
return false;
if (x == dx && y == dy)
return true;
return (isReachable(x + y, y, dy, dx) ||
isReachable(x, y + x, dy, dx));
... | true |
b1211c7223705f3b6367eca584ca421602ee3f3e | C++ | DjPasco/Mag | /Detours/XFileMonitor/XFileMonitor.Hook/XFileMonitor.Hook.cpp | UTF-8 | 11,780 | 2.5625 | 3 | [] | no_license | #include "stdafx.h"
#include "XFileMonitor.Hook.h"
#include "..\detours\detours.h" // Detours header
#include <map> // std::map
#include <atlstr.h> // for CString
using namespace std;
// Just a way for us to track what the client did, eg open/close/write to a file
enum FileAction
{
File_Unknown = 0,
File_Creat... | true |
49a34690dd8803aa7d35d5661591b2e5439f9ac1 | C++ | dishbreak/wende-project | /Laser/source/Laser_control.ino | UTF-8 | 2,918 | 3.078125 | 3 | [] | no_license | #include <SPI.h>
#include <Servo.h>
#define ON 1
#define OFF 0
#define MIN_SERVO 544
#define MAX_SERVO 2400
// Control pins
#define LASER_PIN 2
#define AZ_SERVO_PIN 5
#define EL_SERVO_PIN 6
// Communication pins
#define SS_PIN 10
#define MOSI_PIN 11
#define MISO_PIN 12
#define SCK_PIN 13
// Manual mode pins
#define... | true |
cf9d61ff3410f349c008721080e31e45bfcbb324 | C++ | 916-Maria-Popescu/Data-Structures-and-Algorithms | /ADT FixedCapBiMap/ExtendedTest.cpp | UTF-8 | 7,936 | 3.125 | 3 | [
"MIT"
] | permissive | #include "ExtendedTest.h"
#include "FixedCapBiMap.h"
#include "FixedCapBiMapIterator.h"
#include <cassert>
#include <iostream>
using namespace std;
void testIteratorSteps(FixedCapBiMap& m) {
FixedCapBiMapIterator mi = m.iterator();
int count = 0;
while (mi.valid()) {
count++;
mi.next();
}
assert(count == m.... | true |
3fed0a6d545497913844a9bfe09a7e1a9ada97b0 | C++ | echolite1/ESP32-CrawlerRobot-FH-Dortmund | /src/motorDriver.cpp | UTF-8 | 2,468 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | /**
* ESP32 Motor Library
*
* Functions to set motor speed
*
* Authors: Vipul Deshpande, Jaime Burbano
*/
#include "Arduino.h"
#include "motorDriver.h"
static uint8_t inA1 = 16; /* Pin for Motor 0 */
static uint8_t inA2 = 17; /* Pin for Motor 0 */
static uint8_t inB1 = 19; /* Pin... | true |
5e38054f5f5c0dd9573b67c8e8678220cadb4d2f | C++ | Chrivent/Yechan-Ha | /해전 게임/Shell.cpp | UTF-8 | 674 | 2.96875 | 3 | [] | no_license | #include "Shell.h"
Shell::Shell()
{
target = NULL;
breakaway = false;
}
void Shell::SetColor(COLORREF color)
{
this->color = color;
}
void Shell::SetTarget(Unit* target)
{
this->target = target;
}
COLORREF Shell::GetColor()
{
return color;
}
string Shell::GetType()
{
return type;
}
... | true |
a0c54c8168c922ee824759eee125606ec39be95c | C++ | nanWarez/BTC_Xpert | /BTC_Xpert_test.cpp | UTF-8 | 1,948 | 3.03125 | 3 | [] | no_license | //created by Cr4shOv3rrid3 under the https://github.com/Cr4shOv3rrid3/1337_General_Public_BTC_Banking_license
// feel free to copy, hack, destroy or create new things with it
// P.S. if you don't like i created that for you. just replace first line with your own cool stylish hacker name ;)
#include <iostream>
#include... | true |
13b2e634f97c2ae23124ac293250b55f16c5eaf4 | C++ | Magiczne/MidiCreator | /MidiCreator/Util/Util.cpp | UTF-8 | 5,224 | 3.046875 | 3 | [] | no_license | #include "Util.h"
using namespace UI;
using namespace std;
ConsoleSize Util::getConsoleSize()
{
ConsoleSize size;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
size.cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
size.rows = csbi.srWindow.Bottom - csb... | true |
86ef2d7c8497406ae17af4d9fa963fa24676a7e0 | C++ | smiljanaspasic/Algorithms-and-data-structures | /Hashing/Hesfunkcija.cpp | UTF-8 | 7,583 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <math.h>
#include <fstream>
#define MAX 700000
#define c 2
using namespace std;
int konverzijaosnove(string s,int n) {
int q=13;
int mul = 0;
int num = 0;
int sum = 0;
for (int i = s.length()-1; i>=0 ; i--) {
sum=sum + pow(q, num) * (int)s[i];
num++;
}
sum=sum ... | true |
ee5d03996d1b82ce95fa3e2369e32169c81092ca | C++ | ashanka234/interviewPrep | /revision/arrays/removeAdjDuplicates.cpp | UTF-8 | 564 | 3.1875 | 3 | [] | no_license | #include<iostream>
using namespace std;
void removeAdjDuplicates(char *str) {
if(str[0] == '\0')
return;
if(str[0] == str[1]) { //adj duplicate found
//shift left
int i=0;
while(str[i] != '\0') {
str[i] = str[i+1];
i++;
}
removeAdjDu... | true |
a16006b74189bc9259341d324d6ae272bd4b9427 | C++ | SimonBFrank/TGA_Picture_Editor | /Pixel.cpp | UTF-8 | 412 | 2.96875 | 3 | [] | no_license | #include "Pixel.h"
Pixel::Pixel(unsigned char redIN, unsigned char blueIN, unsigned char greenIN)
{
this->redAmount = redIN;
this->blueAmount = blueIN;
this->greenAmount = greenIN;
}
unsigned char Pixel::getBlueAmount()
{
return this->blueAmount;
}
unsigned char Pixel::getRedAmount()
{
return th... | true |
4030ca1fa8680f709c812efd7b3ca769efe8acf8 | C++ | Matheus7OP/sudokuSolver | /sudoku_solver.cpp | UTF-8 | 4,675 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <ctime>
#include <set>
using namespace std;
bool isUnknown(int value) {
return (value == 0);
}
void initialize(set<int> &possibilities) {
for(int i = 1; i <= 9; i++)
possibilities.insert(i);
}
void removeInconsistenciesFromLine(int line, set<int> &possibilities, ... | true |
69a6d451cd895dbbc81dbda30511d8032780c58b | C++ | anhero/BaconBox | /BaconBox/Helper/Timer.cpp | UTF-8 | 878 | 2.859375 | 3 | [] | no_license | #include "BaconBox/Helper/Timer.h"
#include "BaconBox/Core/Engine.h"
#include "BaconBox/Helper/TimerManager.h"
using namespace BaconBox;
Timer::Timer() : started(false), interval(0.0), timeCounter(0.0) {
TimerManager::addTimer(this);
}
Timer::Timer(double newInterval) : started(false), interval(newInterval),
timeC... | true |
fe8a90dacc1f3948a20e29eecbd612413d15fec5 | C++ | cmguo/just-just-export | /Error.h | UTF-8 | 3,890 | 2.5625 | 3 | [] | no_license | // Error.h
#ifndef _JUST_EXPORT_ERROR_H_
#define _JUST_EXPORT_ERROR_H_
namespace just
{
namespace error {
enum errors
{
success = 0,
not_start,
already_start,
not_open,
already_open,
operation_canceled,... | true |
61be4a90173b358b9ffbed1e7e28537960896e80 | C++ | yazici/minecraft-texture-viewer | /src/render/renderable.h | UTF-8 | 601 | 2.84375 | 3 | [] | no_license | #ifndef RENDERABLE_H
#define RENDERABLE_H
#include <memory>
#include "glad.h"
#include "material.h"
#include <glm\glm.hpp>
struct vertex {
glm::vec3 position;
glm::vec3 normal;
glm::vec3 tangent;
glm::vec2 uv;
vertex(glm::vec3 position, glm::vec3 normal, glm::vec3 tangent, glm::vec2 uv);
};
/*!
* \brief Some... | true |
116123ce8db9c3456eb3ab7b47abd5e62573c8c5 | C++ | arelli/bosch-BME280-lib | /bme280_register_read.ino | UTF-8 | 4,398 | 2.515625 | 3 | [] | no_license | #include <Wire.h>
// this sketch polls data out of the pressure/barometer sensor GY-BME280
// the direct register polling method was chosen to remove the need of external
// libraries(like adafruit) that will potentially slow down the execution of the
// integrated program. Refer to the bst-bme280-ds002.pdf datash... | true |
1ff48e0b2ad59dfd6634d984319db26b20f72469 | C++ | kochol/kge | /Include/math/Frustum.h | UTF-8 | 2,239 | 2.6875 | 3 | [
"MIT"
] | permissive | // File name: Frustum.h
// Des: This class is for calculate frustum views.
// Date: 16/11/1386
// Programmer: Ali Akbar Mohamadi(Kochol)
#ifndef FRUSTUM_H
#define FRUSTUM_H
#include "Plane.h"
namespace kge
{
namespace math
{
enum FrustumSide
{
//! The RIGHT side of the frustum
EFS_Right = 0,
//! The LEFT side ... | true |
f1b99412da0fa56247e11efb9f7294775f6703f5 | C++ | linuxemb/datastructure | /Chapter02/SearchAndSortAdvanced/Main.cpp | UTF-8 | 14,926 | 3.140625 | 3 | [
"MIT"
] | permissive | #include <IOStream>
#include <CStdLib>
#include <CAssert>
using namespace std;
#include "ArrayList.h"
#include "..\\ListAdvanced\\List.h"
#include "Search.h"
#include "Sort.h"
void linkedList();
void main() {
linkedList();
}
void linkedList() {
LinkedList<double> list;
cin >> list;
for (LinkedList<double>... | true |
618eea2ffe1ecebb2c957ab2d5ac4ea4dc6c010d | C++ | wangzhezhe/Gorilla | /blockManager/rawmemobj/rawmemobj.h | UTF-8 | 1,403 | 2.609375 | 3 | [] | no_license |
#ifndef RAWMEMOBJ_H
#define RAWMEMOBJ_H
#include <blockManager/blockManager.h>
#include <iostream>
namespace GORILLA
{
struct RawMemObj : public DataBlockInterface
{
RawMemObj(const char* blockid)
: DataBlockInterface(blockid){
// std::cout << "RawMemObj is initialised" << std::endl;
};
BlockSu... | true |
a733867299a26a1cb4024fe45c6beb86b846a141 | C++ | tnordenmark/UU | /00.Kompendium_C++/Exempel/v3.0/kap6ex/power3.cc | UTF-8 | 437 | 3.453125 | 3 | [] | no_license | // Filnamn: .../power3.cc
#include <iostream>
using namespace std;
double power( double x, int n=2 ); // default here!!
int main() {
cout << "Call 1 : " << power( 3.5 , 3 ) << endl;
cout << "Call 2 : " << power( 3.5 , 2 ) << endl;
cout << "Call 3 : " << power( 3.5 ) << endl;
return 0;
}
double power( d... | true |
f17d1fa8e981f909d47f1d1b74c75592ada6f72a | C++ | whigg/point-and-surface-registration | /research-computing-with-cpp-demo/Code/SurfaceBasedRegistration/pointbasedregistration.tpp | UTF-8 | 5,738 | 3 | 3 | [] | no_license | /**
* @brief Implementation of the templated class PointBasedRegistration. Note that this tenmplate
* file is included in the header file.
*
* @author Luis Carlos Garcia-Peraza Herrera (luis.herrera.14@ucl.ac.uk).
* @date 14 Mar 2015.
*/
// My includes
// #include "pointbasedregistration.h"
#include ... | true |
7ff77b75483bbe5d89fdd1e67b79faad365d7a8b | C++ | charlenemariscal/UVA_Judge | /11764 Jumping Mario.cpp | UTF-8 | 619 | 2.9375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int t,n, low, high;
cin>> t;
for (int i =1; i<=t; i++){
cin >>n;
int height[n];
for (int j=0;j< n; j++){
cin >>height[j];
}
high =0;
low = 0;
for (int j=0;j< n-1; j++){
if (height[j]<height[j+1]){
high +=1;
low... | true |
26f637036b9965cf33f80d84bfbd28d5bdf982c7 | C++ | Jerry-Terrasse/Programming | /比赛/清北学堂/入学测试0715/2018715/2018715/src/泰安二中袁傲慕飞/count.cpp | UTF-8 | 2,854 | 2.515625 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char ru[3][3], temp[3];
bool peo[27], grp[27][27];
int ans1, ans2;
int main()
{
freopen("count.in", "r", stdin);
freopen("count.out", "w", stdout);
for(int i = 0; i <= 2; i++)
{
cin>>ru[i];
}
for(int i = 0; i <= 2; i++... | true |
b19f5b7c6de1e6aaef5a114154e211098f3243e6 | C++ | dementrock/acm | /poj/Archives/1679/7091111_WA.cpp | UTF-8 | 2,846 | 2.84375 | 3 | [] | no_license | #include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
const int MAXV=105;
const int MAXE=5465;
const int INF=0x7fffffff;
int set[MAXV];
int rank[MAXV];
int num;//记录最小生成树边的个数
int st,ed;
typedef struct Edge
{
int st;
int ed;
int distance;
}Edge;
Edge edge[MAXE];
Edge edge1[MAXE];
... | true |
120e0107d03f51ff2ec7bff3c2e6a7513f69e688 | C++ | wangsiyao1009/BIDE | /BIDE.cpp | UTF-8 | 2,032 | 2.84375 | 3 | [] | no_license | #include "BIDE.h"
size_t hashCode(const Sequence &sequence) {
size_t h = 17;
for (const auto &str : sequence.sequence) {
for (const auto &c : str) {
h = 37 * h + c;
}
}
return h;
}
BIDE::BIDE(Database &database)
: database(database), frequentOneItemsCou... | true |
a6f32394a9722cf9be2f1fc2b95034cc43ae3329 | C++ | clovervnd/Learning | /C++_LEARNING/access.cpp | UTF-8 | 553 | 3.75 | 4 | [] | no_license | #include <iostream>
// access modifier
using namespace std;
struct student{
private:
int id;
char *name;
float percentage;
public:
void Show();
void SetInfo (int _id, char* _name, float _percentage);
};
void student::Show(){
cout<<"아이디: " <<id<<endl;
cout<<"이름: " <<name<<endl;
cout<<"백분율: " <<percenta... | true |
1dbc423c1e3fd26b2b42c060b79e021fadbb1343 | C++ | Benner727/RPG-Graphics | /Alpha/ItemBonusDefinition.h | UTF-8 | 954 | 3.1875 | 3 | [] | no_license | #ifndef ITEMBONUSDEFINITION_H
#define ITEMBONUSDEFINITION_H
class ItemBonusDefinition
{
public:
ItemBonusDefinition() {};
ItemBonusDefinition(int _id, int _meleeatt, int _magicatt, int _rangeatt, int _meleedef, int _magicdef, int _rangedef, int _str, int _prayer)
{
id = _id;
bonus[0] = _meleeatt;
bonus[1] = ... | true |
a1a23674b7a406ba0db4d2c789355ba3a187a108 | C++ | Freebee2day/myTextBox | /cmake_modules/myBase.cpp | UTF-8 | 500 | 2.640625 | 3 | [] | no_license | //
// Created by 16262 on 4/1/2021.
//
#include "myBase.h"
myBase::myBase(char s, float xPos){
font.loadFromFile("../cmake_modules/OpenSans-Bold.ttf");
msg.setFont(font);
msg.setFillColor(sf::Color::White);
msg.setCharacterSize(50);
msg.setPosition(xPos,300);
msg.setString(s);
}
... | true |
e2791e5451132319347f8361144fa67d2a4dc5e9 | C++ | avast/retdec | /tests/serdes/class_tests.cpp | UTF-8 | 1,995 | 2.703125 | 3 | [
"MIT",
"Zlib",
"JSON",
"LicenseRef-scancode-unknown-license-reference",
"MPL-2.0",
"BSD-3-Clause",
"GPL-2.0-only",
"NCSA",
"WTFPL",
"BSL-1.0",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | permissive | /**
* @file tests/serdes/classe_tests.cpp
* @brief Tests for the class module.
* @copyright (c) 2019 Avast Software, licensed under the MIT license
*/
#include <gtest/gtest.h>
#include <rapidjson/error/en.h>
#include <rapidjson/document.h>
#include <rapidjson/prettywriter.h>
#include <rapidjson/stringbuffer.h>
#... | true |
bd3582297ee85a9b6390d571dcf8e7d6648bbd31 | C++ | LayerXcom/libSTARK | /libstark/src/common/Utils/specsPrint.cpp | UTF-8 | 1,303 | 3.09375 | 3 | [
"MIT"
] | permissive | #include "specsPrint.hpp"
#include <iostream>
#include <iomanip>
#include<algorithm>
namespace libstark{
using std::vector;
using std::string;
using std::pair;
using std::max;
specsPrinter::specsPrinter(const string title):title_(title),data_(0){};
void specsPrinter::addLine(const string name... | true |
2dfe927e8b76ce74f70946999212da3b16245d08 | C++ | Blue-Xin/CPP | /CPP类/重载类型转换运算符.cpp | UTF-8 | 496 | 3.484375 | 3 | [] | no_license | #include<iostream>
using namespace std;
class change
{
private:
double real;
double imag;
public:
change(double r,double i):real(r),imag(i) // 初始化列表
{
}
operator int () //不需要写返回值类型 将double类型的转换为int类型
{
return real;
}
};
int main()
{
change c(1.2,1.3);
cout << (int... | true |
5f6cc8b38750b7768e264dff5dd455492112716e | C++ | ye-luo/openmp-target | /tests/target_task/omp-task-bug.cpp | UTF-8 | 2,635 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | #include <iostream>
#include <memory>
#include <numeric>
#include <vector>
#ifdef _OPENMP
#include <omp.h>
#else
int omp_get_thread_num() { return 0; }
int omp_get_num_threads() { return 1; }
int omp_get_max_threads() { return 1; }
#endif
template<typename T>
struct MyProblem
{
int M = 16;
int N = 16;
int ... | true |
da375bced7f6d110a3fb49cda7a340b48949524c | C++ | ajl2612/GarageDoorSimulator | /GarageDoorSimulator/thread.h | UTF-8 | 1,829 | 3.3125 | 3 | [] | no_license | #ifndef THREAD_H
#define THREAD_H
#include <string>
#include <pthread.h>
#include "mutex.h"
/**
* pthread wrapper classes.
* Provides a set of wrapper classes around various pthread constructs.
* These allow proper object oriented programming when working with pthreads.
*/
namespace PThreads
{
/**
* Abst... | true |
e22fdf27ecee58fe883e6d48dcbdd3b300f775a6 | C++ | LeeNJU/LeetCode | /LeetCode/convertToTitle.cpp | GB18030 | 357 | 3.375 | 3 | [] | no_license | #include <string>
#include <algorithm>
std::string convertToTitle(int n)//ʮת26 Ҫת
{
int Base = 26;
std::string result = "";
while (n)
{
if (n % Base)
{
result += n % Base - 1 + 'A';
n /= Base;
}
else
{
result += 'Z';
n = n / Base - 1;
}
}
reverse(result.begin(), result.end());
return re... | true |
949139fdfcdb0d5e300ae46a3375199546e9fa33 | C++ | frobro98/School-Projects | /RAD Engine/Game/RAD/Visualizer.cpp | UTF-8 | 2,200 | 2.84375 | 3 | [] | no_license |
#include "Visualizer.h"
#include "AssetManager.h"
#include "Azul.h"
Visualizer& Visualizer::instance()
{
static Visualizer vis;
return vis;
}
void Visualizer::initialize()
{
instance().unitBox = new GraphicsObjectWireFrame(AssetManager::retrieveModel("box"));
instance().unitSphere = new GraphicsObjectWireFrame... | true |
bb4a19eced3d963bdf9d8dde17311af2e17dd5d2 | C++ | Yuessiah/Destiny_Record | /UVa_Online_Judge/908_Re-connecting_Computer_Sites.cpp | UTF-8 | 1,176 | 2.96875 | 3 | [] | no_license | #include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn = 1e4 + 10, INF = 0x3f3f3f3f;
struct node {
int n, w;
bool operator<(const node &lhs) const {
return w > lhs.w; // min heap
}
};
int N, K, M;
bool vis[maxn];
int main()
{
bool nl = false;
while(~scanf("... | true |
4078b13f3dd47349f2041dcae8cc34cf382ea57a | C++ | ericlin1001/offlineJudge | /hws/problem2/16308110/main.cpp | UTF-8 | 501 | 3.0625 | 3 | [] | no_license | // 19.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main(int argc, char* argv[])
{
int a,b,c,d;
float x,y;
cout<<"Please input 4 integer:";
cin>>a>>b>>c>>d;
x=(a+b+c+d)/4.0;
y=sqrt((... | true |
a4ec41c7e8cff4d97c65c52a41cd9c7582cea5c1 | C++ | amedlin/AlgoLab | /AlgoLabCore/cast.h | UTF-8 | 554 | 2.8125 | 3 | [] | no_license | #pragma once
#include <cassert>
namespace algolab
{
// Assert cast on pointers
template<typename T, typename U>
inline T* assert_cast(U* obj)
{
#ifdef NDEBUG
return static_cast<T*>(obj);
#else
T* result = dynamic_cast<T*>(obj);
assert(result != nullptr);
return result;
#endif
}
// Assert cast on ref... | true |
385f50115a8f277d46a1173202b6ca364ea01414 | C++ | Themandunord/TD_Dictionnary | /src/DictionaryException.cpp | UTF-8 | 280 | 2.640625 | 3 | [] | no_license | #include "../include/DictionaryException.h"
DictionaryException::DictionaryException(const std::string& _message) : m_message(_message)
{}
DictionaryException::~DictionaryException() throw()
{}
std::string DictionaryException::message() const throw()
{
return m_message;
}
| true |
bd2af912fddb1f76895685f9a04965cc3ae74a8e | C++ | macoro/CG_projects | /Deforming/src/mesh.cpp | UTF-8 | 9,405 | 2.546875 | 3 | [] | no_license | #include "mesh.h"
#include <iostream>
Mesh::Mesh(const std::vector<Point3D>& verts,
const std::vector< std::vector<int> >& faces)
: m_verts(verts),
m_faces(faces)
{
m_bbox= bounding_box();
m_chainmail = new DeformObject;
m_chainmail->objSize = 0;
m_chainmail->maxDeform = 1.5;
m_cha... | true |
a9a3a131463a4e742a051751d56a9ba5ade364fe | C++ | Enginek29/Study | /DZ1-1/DZ1-1.cpp | UTF-8 | 820 | 2.796875 | 3 | [] | no_license | // DZ1-1.cpp набрать программу
#include <stdio.h>
int main (void)
{
int a,b = 5, c;
double x, y = -5, z;
printf("a=");
scanf("%d", &a);
x = c = a;
printf("a=%d, c=%d, x=%f\n", a, c, x);
a += b;
printf("a=%d\n", a);
x += b+a;
printf("x=%f\n", x);
b += a--;
printf("b=%d\n", b);
x -= ++c;
printf("x=%f\n... | true |
3c6368e39637003a2b9566a50a2e33c4212f1ccd | C++ | alexandraback/datacollection | /solutions_5648941810974720_1/C++/boqun/a.cc | UTF-8 | 2,197 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int T;
string tmp;
int S[256];
int n[10];
void count(int S[], const char *s)
{
char c;
while (c = *s++)
S[c]++;
}
int zero(int *S)
{
int result = S['Z'];
if (result != 0) {
S['Z'] -= result;
S['E'] -= result;
S['R'] -= result;
S['O'] -= re... | true |
14ecf237d3011a9e75830558d3da04d05a9c0879 | C++ | dh434/leetcode | /hot100/538. 把二叉搜索树转换为累加树.cpp | UTF-8 | 1,072 | 3.921875 | 4 | [] | no_license | /*
给定一个二叉搜索树(Binary Search Tree),把它转换成为累加树(Greater Tree),
使得每个节点的值是原来的节点值加上所有大于它的节点值之和。
例如:
输入: 二叉搜索树:
5
/ \
2 13
输出: 转换为累加树:
18
/ \
20 13
*/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* Tre... | true |
2e53abd932045b1af819f2cf2366f947ac97a0ef | C++ | jxzhsiwuxie/cppPrimer | /chap18/exercises/ex_18.1.cpp | UTF-8 | 449 | 3.25 | 3 | [] | no_license | //练习 18.1:在下列 throw 语句中异常对象的类型是什么?
// (a) range_error r("error"); (b) exception *p = &r;
// throw r; throw *p
//如果将 (b) 中的 throw 语句写成 throw p 将发生什么情况?
/*
* (a) range_error
* (b) exception
* 如果将 throw 语句写成 throw p,则泡泡出异常后 r 的析构函数被调用,在 catch 语句中不能再访问异常对象。
*/
| true |
f587f6005927aaac108d7f438b02283c70d17dc9 | C++ | mt2522577/TranMelvin_CSC5_40717 | /Hmwk/Assignment3/Gaddis_8thEd_Ch4_Q6/main.cpp | UTF-8 | 885 | 3.390625 | 3 | [] | no_license | /*
* File: main.cpp
* Author: Melvin Tran
* Created on January 19, 2015, 10:06 PM
*/
//System Libraries
#include <cstdlib> //Randon srand(), rand()
#include <iostream> //Keyboard/Monitor I/O
#include <cmath> //Math Function Libraries
#include <iomanip>
using namespace std;
//User Libraries
//Global Constants
... | true |
6cb8cebe8b598309f995bab7c164f9ba458609f7 | C++ | MariaCholakova/Ecosystem | /Object.h | UTF-8 | 618 | 3.234375 | 3 | [] | no_license | #ifndef OBJECT_H
#define OBJECT_H
class Object
{
public:
static int rows;
static int cols;
private:
struct Coordinate
{
int x;
int y;
Coordinate(int a, int b);
Coordinate();
bool operator == (const Coordinate& c) const;
};
protected:
... | true |
ead2813f614b51af706d857ad315e5874c950c6e | C++ | BRAINIAC2677/Lightoj-Solutions | /1053 - Higher Math.cpp | UTF-8 | 493 | 2.875 | 3 | [
"MIT"
] | permissive | /*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
for (int i= 1;i <= t;i++)
{
int arr[3];
cin >> arr[0] >> arr[1] >> arr[2];
sort(arr, arr+3);
int dif = arr[2] * arr[... | true |
02feffa184b7f655626dbad2a951358d3d49d5bd | C++ | IrishCoffee/AlgorithmCode | /ACM/LeetCode/addTwoNumbers.cpp | UTF-8 | 1,515 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x): val(x),next(NULL){}
};
class Solution
{
public:
ListNode *addTwoNumbers(ListNode *L1, ListNode *L2)
{
ListNode *L = new ListNode((L1->val + L2->val) % 10);
ListNode *head = L;
int tm... | true |
8ba6fbd3b81d267cc53aea1d27d304b0a64819c8 | C++ | BenGamliel/wet1ShayBen | /HoursAndCounters.h | UTF-8 | 1,327 | 3.40625 | 3 | [] | no_license | //
// Created by Ben on 4/25/2019.
//
#ifndef DSWET1SHAY_HOURSANDCOUNTERS_H
#define DSWET1SHAY_HOURSANDCOUNTERS_H
class HoursAndCounters {
int _hours;
unsigned int* _hoursCounters;
unsigned int _totalSum;
public:
//HoursAndCounter Counstractor input: a given value to init the array
// O(n) as n i... | true |
11816a8a05b35938d24f670ef3fee5c88b146b95 | C++ | AzamAzam/PfLabsAssignments | /assing5/bcsf15m024(assig5)/Q4.cpp | UTF-8 | 361 | 2.671875 | 3 | [] | no_license | //#include <iostream>
//#include <string>
//using namespace std;
//int main()
//{
// string s;
//
// getline(cin,s);
//
// int count=0;
//
// for(int i=0 ; i<=s.length(); i++)
//
// {
//
// if(s[i]==' ' || s[i]=='\n' || s[i]=='\t' || s[i]=='\0')
// count++;
//
//
// }
// cout... | true |
cf084a914bc06f4ec496cc333f592d6bbf8c55bb | C++ | Ukio-G/study_cpp | /stepik_cpp/First_Course/strstr/main.cpp | UTF-8 | 6,709 | 2.75 | 3 | [] | no_license | #include <iostream>
using namespace std;
int strstr(const char *text, const char *pattern);
void test()
{
(0 == strstr("","")) ? cout<<"OK : 1"<< " (" << 0 << " : " << (0 == strstr("","")) << " )" << endl : cout<< "Failed : 1"<< " (" << 0 << " : " << (0 == strstr("","")) << " )" << endl ;
(0 == strstr("a", "")... | true |
41690c1abb29ae903457a68d9640c4b1adb94a6e | C++ | ATinyBanana233/HashTable | /linkedlist.cpp | UTF-8 | 3,337 | 3.578125 | 4 | [] | no_license | //CMPT 225 assignment 5
//Author: Bei Bei Li
//implementation for linkedlist.h
#pragma once
#include <cstdlib>
#include <string>
#include <vector>
#include "linkedlist.h"
using namespace std;
// helper method for deep copy
void LinkedList::CopyList(const LinkedList& ll)
{
if (size){ ... | true |
b055083f3aa4720f3b513c3f986576751c01b061 | C++ | jjjasperd/Cpp-Primer-Exercise | /Exercise5.14.cpp | UTF-8 | 1,471 | 3.21875 | 3 | [] | no_license | //
// main.cpp
// Statement
//
// Created by DuanYujia on 1/9/15.
// Copyright (c) 2015 DuanYujia. All rights reserved.
//
#include <iostream>
#include <string>
#include <vector>
using std::cout;
using std::cin;
using std::string;
using std::vector;
using std::endl;
int main(int argc, const char * argv[]) {
... | true |
d99480ebd2f63b304401db00bb2148e6be148ea8 | C++ | rm3028/Monster-Killer | /Monster-Killer/Vector.h | UTF-8 | 1,407 | 3.203125 | 3 | [] | no_license | /*
* Vector.h: Basic vector class
* Author: Wei-Yun
* Email: rm3028@hotmail.com.tw
* Copyright © 2021 Wei-Yun.
* All rights reserved.
*/
#pragma once
#include <GL\glut.h>
class CVector
{
public:
CVector(GLvoid); //Construct a vector
CVector(GLfloat vVector_x, GLfloat vVector_y, GLfloat vVector_z); //Const... | true |
d165f75a95970824e33734fc9cc1d6bcc841a178 | C++ | SayaUrobuchi/uvachan | /UVa/11926.cpp | UTF-8 | 1,274 | 2.5625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#define M 1000000
int st[256], ed[256], inv[256], idx[256];
int comp(const void *p, const void *q)
{
return inv[*(int*)p] > inv[*(int*)q] ? 1 : -1;
}
int main()
{
int n, m, i, j, k, p, q, r, a, over;
while (scanf("%d%d", &n, &m) == 2)
{
if (!n && !m)
{
break;
}
... | true |
f75443e79019e00794af03b782b40c4c902c6fc5 | C++ | ajmarin/coding | /uva/Volume CXII/11227.cpp | UTF-8 | 1,049 | 2.609375 | 3 | [] | no_license | #include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
int x[128], y[128];
double s[128];
int main(void){
int dset = 1, lx, ly, n, rx, ry, t;
for(scanf("%d", &t); t--; dset++){
scanf("%d", &n);
for(int i = 0; i < n; ++i){
scanf("%d.%d %d.%d", &lx, &rx, &ly, &ry);
x[i] = 100 * lx + rx;... | true |
042c6867035aeb2b31a4801d12f637baa6dbd7db | C++ | doggydigit/miniprojet1 | /mini-projet1-empty/src/signal.hpp | UTF-8 | 650 | 3.0625 | 3 | [] | no_license | #ifndef SIGNAL_H
#define SIGNAL_H
#include "types.hpp"
using namespace std;
class Signal
{
public:
Signal(bool presence);
~Signal();
bool presence();
// une méthode getSignal() qui retournera un référence constante sur le signal courant (*this).
impl::signal_t getSignal();
protected:... | true |
1133954a5fd54f82a84ade6f1fffbce58889e784 | C++ | ssprl/Direction-of-arrival-estimation-using-deep-neural-network | /DOA_DNN_Android_app/app/src/main/cpp/Transforms.cpp | UTF-8 | 5,432 | 2.875 | 3 | [
"MIT"
] | permissive | #include "Transforms.h"
//#include "stdafx.h"
void FFT(Transform* fft, float* input);
void IFFT(Transform* fft, float* inputreal, float* inputimaginary);
Transform*
newTransform(int points)
{
Transform* newTransform = (Transform*)malloc(sizeof(Transform));
newTransform->points = points;
newTransform->rea... | true |
fa3a42b3bc6471f0ffe1d5523bf617ff70bf3264 | C++ | Swizzman/Project_Zumo | /CodePC/MainProgram/Logo.cpp | UTF-8 | 651 | 2.96875 | 3 | [] | no_license | #include "Logo.h"
Logo::Logo()
{
this->texture.loadFromFile("../images/logo.png");
intRect = sf::IntRect(0, 0, this->texture.getSize().x / 30, this->texture.getSize().y);
this->sprite.setTexture(texture);
this->sprite.setTextureRect(this->intRect);
}
void Logo::setPosition(int x, int y)
{
this->sprite.setPositio... | true |
73a933f9986bfbf6aa235b21797d91c24891daa4 | C++ | eralmual/AirWar- | /Game/GameManager.cpp | UTF-8 | 28,555 | 2.90625 | 3 | [] | no_license | //
// Created by erick on 26/03/17.
//
#include "GameManager.h"
GameManager::GameManager(GLshort width, GLshort height){
this->Width = width;
this->Height = height;
//Player setUp w/2 - playerSize.x/2 h - playerSize.y
Player = new GameObject( glm::vec2( width / 2 - 100.0f / 2, height - 1... | true |
57efe8ba7febe8388da6d19cceedec03d095b6c5 | C++ | zmbilx/cxxPrimerPlus6th | /05第五章/5-04-formore.cpp | UTF-8 | 517 | 3.28125 | 3 | [] | no_license | #include <iostream>
const int ArSize = 16;
int main(){
long long factorials[ArSize];
factorials[1] = factorials[0] = 1LL;
for (int i=2; i<ArSize; i++){
factorials[i] = i * factorials[i-1];
}
for (int i=0; i< ArSize; i++){
std::cout<< i << "! = "<<factorials[i]<<std::endl;
}
return 0;
}
/*
out:
0! = 1
... | true |
acd94b65004b78f675b911cd3493bc69bf1cd6d7 | C++ | zh593245631/Cpp | /HashTable/hash.h | GB18030 | 5,973 | 3.09375 | 3 | [] | no_license | #pragma once
//ɢ
#include<vector>
#include<iostream>
using namespace std;
namespace CLOSE
{
enum STATA
{
EMPTY,
DELETE,
EXIST
};
template<class K, class V>
struct HashNode
{
pair<K, V> _kv;
STATA _stata = EMPTY;
};
template<class K, class V>
class HashTable
{
public:
typedef HashNode<K, V> Nod... | true |
fad55b3d3d9dc1e7f3a633c62336b582e02caaa9 | C++ | lcj2393/taller2-apuntadores_y_estructuras | /6-PUNTERO_NNUMEROS_BUSQUEDA.cpp | ISO-8859-10 | 1,032 | 3.40625 | 3 | [] | no_license | //EJERCICIO TERMINADO, FUNCIONA CORRECTAMENTE
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
void llenar_arreglo(int *,int);
void busqueda(int *, int);
using namespace std;
int main()
{
int nnum;
printf("\nDigite tamao del vector: ");
cin>>nnum;
int arreglo[nnum],*p... | true |
868cff8f9da15012733c74fad8c60190c9f35cb1 | C++ | salva00/ProgrammiCeck_P1 | /EserciziClasse/BMI Calculator/main.cpp | UTF-8 | 790 | 3.828125 | 4 | [] | no_license | #include <iostream> //allows program to perform input and output
using std::cin; //program uses names from the std namespace
using std::cout;
using std::endl;
int main() {
//variables to store weight and height
int weight{ 0 };
float height{ 0 };
//prompt the user for their weight and height and read them in
cout... | true |
93fe5168ad25352e76d1a4109e7b3e337e7faf73 | C++ | supreme19981021/labworks | /chapt5/5_13/main.cpp | GB18030 | 1,092 | 3.703125 | 4 | [] | no_license | //example5_13.cpp:ֵݹʾ
#include<iostream>
using namespace std;
class Base
{
int b;
public:
Base(int x) :b(x) {}
int getb()
{
return b;
}
};
class Derived :public Base
{
int d;
public:
Derived(int x, int y) :Base(x), d(y) {}
int getd()
{
return d;
}
};
int main()
{
Base b1(11);
Derived d1(22, 33);
b1... | true |
706eab7b5cd3208227dcb4a0a357f48f2f46f72d | C++ | abc80486/codeBus | /OnlineJudge/PAT/PAT_B_20/1027**.cpp | UTF-8 | 603 | 2.90625 | 3 | [] | no_license | //打印沙漏
#include<iostream>
using namespace std;
int main(){
int N,row=0;
char c;
cin>>N>>c;
for(int i=0;i<N;i++){
if((2*i*(i+2)+1)>N){
row=i-1;break;
}
}
for(int i=row;i>=1;i--){
for(int k=row-i;k>=1;k--) cout<<" ";
for(int j=i*2+1;j>=1;j--) cout<<c;
... | true |
7a6d3a25127da8ce7420c804e3d185f97e19f4e2 | C++ | lonelam/SolveSet | /poj2932.cpp | UTF-8 | 1,501 | 2.8125 | 3 | [] | no_license |
#include<iostream>
#include<vector>
#include<iterator>
#include<algorithm>
#include<cstdio>
#include<set>
using namespace std;
int n;
const int maxn = 45000;
double x[maxn], y[maxn], r[maxn];
bool inside(int i, int j)
{
double dx = x[i] - x[j], dy = y[i] - y[j];
return dx * dx + dy * dy <= r[j] * r[j];
}
void... | true |
86b84f419c89175ed27d1018b82512496a584022 | C++ | basanets/SoftwareDesignPatterns | /structural/decorator/Decorator/encryptiondecorator.cpp | UTF-8 | 484 | 2.796875 | 3 | [] | no_license | #include "encryptiondecorator.h"
EncryptionDecorator::EncryptionDecorator(DataStream *dataStream)
: DataStreamDecorator(dataStream)
{
}
std::string EncryptionDecorator::read(uint32_t bytes)
{
std::string readData = m_dataStream->read(bytes);
// decode
readData += " decoded";
return readData;
}
... | true |
abf234ab3ddb8715d3286347ceff0b3c4e3ab842 | C++ | Zeratul31/leetcode | /261-Graph_Valid_Tree.cpp | UTF-8 | 2,694 | 3.203125 | 3 | [] | no_license | class Solution {
public:
/**
* @param n: An integer
* @param edges: a list of undirected edges
* @return: true if it's a valid tree, or false
*/
bool validTree(int n, vector<vector> &edges) {
// write your code here
//条件一:n个node, n-1个edge
if( static_cast<int>(edges.size()) != n - 1) { return false; }
... | true |
0f6f2a1a4a5abbf63a5245ac5db460f30eb5a5f1 | C++ | FuzeT/LeetCode | /Algorithm/121-180/134_Gas_Station.cpp | UTF-8 | 1,345 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <set>
#include <math.h>
#include <unordered_set>
using namespace std;
class Solution {
public:
int canCompleteCircuit(vector<int>& gas, ve... | true |
2e43333b9752c04dd5073d8ac148f7c8258cda9b | C++ | r00tman/f-plotter | /widget.cpp | UTF-8 | 4,192 | 2.5625 | 3 | [] | no_license | #include "widget.h"
#include <functional>
#include <QApplication>
#include <QMessageBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QPen>
#include "parser.h"
/*---------------------------------------------------------------------*/
/*- Из задачи ... | true |
e5954e70dff72d9d7e61ddfe77d786cc38dfd9dd | C++ | niceSimon7/ObserveDesign2 | /ConcreteSubject.cpp | UTF-8 | 412 | 2.578125 | 3 | [] | no_license | #include "ConcreateSubject.h"
void ConcreteSubject::Attach(Observer *pObserver)
{
m_ObserverList.push_back(pObserver);
}
void ConcreteSubject::Detach(Observer *pObserver)
{
m_ObserverList.remove(pObserver);
}
void ConcreteSubject::Notify()
{
list<Observer* >::iterator it = m_ObserverList.begin();
whi... | true |
6f994e56b0070c675032bb51de6a71e008c726d0 | C++ | ZoranPandovski/al-go-rithms | /data_structures/Graphs/graphsearch/transitive_closure_graph/cpp/transitive_closure_graph_floyd_warshall.cpp | UTF-8 | 1,860 | 3.640625 | 4 | [
"CC0-1.0"
] | permissive | #include <iostream>
#include <vector>
#include <bitset>
// Floyd-Warshall algorithm. Time complexity: O(n ^ 3)
void transitive_closure_graph(std::vector<std::vector<int>> &graph) {
int n = (int) graph.size();
for (int k = 0; k < n; k++) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n... | true |
6474138e2f5f573964dea6c6b99bcfd2b6865319 | C++ | aLagoG/kygerand-notebook | /data_structures/suffix_array/test.cpp | UTF-8 | 461 | 2.59375 | 3 | [] | no_license | #include "catch.hpp"
#include "nLog2n.h"
using Catch::Matchers::Equals;
TEST_CASE("banana", "[SuffixArray]") {
vector<int> v{1, 0, 13, 0, 13, 0};
vector<int> ans{5, 3, 1, 0, 4, 2};
REQUIRE_THAT(buildSuffixArray(v), Equals(ans));
}
TEST_CASE("yabbadabbado", "[SuffixArray]") {
vector<int> v{24, 0, 1, ... | true |
acfb4e2cd6660902cad60a1f5c21c3489055428c | C++ | rahat664/online-judge-solved | /Codechef/Decimal to binary.cpp | UTF-8 | 380 | 2.65625 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int Test,num,i,j,binary[10];
scanf("%d",&Test);
for(i = 0; i < Test; i++)
{
scanf("%d",&num);
for(j = 0; num > 0 ; j++)
{
binary[j] = num % 2;
num = num/2;
}
for(j = j-1;j >=0; j--)
{
print... | true |
57a0caa0970d6fcabbc659b75a940460669b9aba | C++ | tricktreat/oj-program | /zju_septembertest/euleriancircuit.cpp | UTF-8 | 1,180 | 2.65625 | 3 | [] | no_license | #include<iostream>
#include<cstring>
#include<algorithm>
#define MAXN 1010
using namespace std;
int n,m;
int fa[MAXN];
int height[MAXN];
int degree[MAXN];
void init(){
for (int i = 0; i < n; ++i) {
fa[i]=i;
height[i]=0;
}
}
int find(int x){
if(fa[x]==x){
return x;
}
retur... | true |
f65a211289b9b96f67f05c631bd2fe4e63aa0c74 | C++ | KGoinger/coj | /oj练习六_1(拆礼物,我怎么想的这么复杂).cpp | UTF-8 | 728 | 3.109375 | 3 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
char s[60];
int count=0;
cin>>s;
for(int i=0;i<strlen(s);i++)
{
if(s[i]=='('&&s[i+1]!=')'&&s[i+1]!='p')
{
count++;
continue;
}
if(s[i]=='('&&s[i+1]==')')
{
i=i+2;
continue;
}
if(s[i]==')'&&s[i+1]=='(')i=i+2;
if(s[... | true |
7399a7775f3084c19a651181161c9de4d91d716b | C++ | BOJ-expedition/Challenges-of-the-week | /2021W01/hyeseong/자유/Programmers/12940 최대공약수와 최소공배수 (Lv.1).cpp | UTF-8 | 604 | 3.25 | 3 | [] | no_license | // https://programmers.co.kr/learn/courses/30/lessons/12940
#include <string>
#include <vector>
using namespace std;
vector<int> solution(int n, int m)
{
vector<int> answer;
int x = n < m ? n : m;
int y = n < m ? m : n;
for (int i = x; i >= 1; --i)
{
if ((x % i == 0) && (y % i =... | true |
a18d83b3c8420eac0377014e20df11201468b02c | C++ | Bampereza/Algoritmos | /Ejemplo If else.cpp | UTF-8 | 541 | 3.390625 | 3 | [] | no_license | /* SENTENCIA IF */
/* if (condicion) {
Instrucciones "SI se cumple la condicion" ;
}
else{
Instrucciones "si NO se cumple la condicion";
}
*/
#include<iostream>
using namespace std;
int main (){
int numero = 2021;
int dato;
cout << "BIENVENIDO, ALGORITMO CON ESTRUCTURA SI" << "\n";
co... | true |
86bd653d940830a620690184f244e8b5739b10b2 | C++ | tapeshpuhan/ApplicationSourceCode | /stl_algorithm/copy/copy.cpp | UTF-8 | 439 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
template<typename T>
void print(T&& var)
{
for(auto& at : var)
{
std::cout<<at<<std::endl;
}
}
int main()
{
std::set<int> v_ = {1,2,3,4,5,7,8,9,3,7,8,};
std::vector<int> s_;
std::move(v_.begin(),v_.end(),std... | true |