Skip to content

Instantly share code, notes, and snippets.

View andraantariksa's full-sized avatar
🦀

Andra Antariksa andraantariksa

🦀
View GitHub Profile
@andraantariksa
andraantariksa / bigint-single.cpp
Created December 26, 2018 01:24
libBG single
#include <string>
#include <sstream>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cctype>
// included bigint.h
#ifndef DODECAHEDRON_BIGINT_H_
#define DODECAHEDRON_BIGINT_H_
@andraantariksa
andraantariksa / weight.cpp
Created February 12, 2019 07:43
Assignment Structured Programming 1
/*input
175
70
*/
#include <iostream>
int main(int argc, char const *argv[]){
float height, weight;
std::cout<<"Your height (in centimeters): ";
std::cin>>height;
@andraantariksa
andraantariksa / cashier.cpp
Created February 12, 2019 07:43
Assignment Structured Programming 2
#include <iostream>
int main(int argc, char const *argv[]){
short command;
unsigned int itemstotal = 5;
float total[2] = {0};
struct Items{
std::string name;
unsigned int price;
@andraantariksa
andraantariksa / factor.cpp
Created February 12, 2019 09:57
Assignment Structured Programming 3
/*input
36
*/
#include <iostream>
#include <cmath>
int main(int argc, char const *argv[]){
int n;
std::cout<<"Calculate factor of: ";
std::cin>>n;
@andraantariksa
andraantariksa / main.rs
Created March 3, 2019 04:27
Rust simple input macro
macro_rules! input_vec {
() => {
input!()
.split_whitespace()
.map(|x| x.parse().unwrap())
.collect()
};
($delimiter:expr) => {
input!()
.split($delimiter)
#include <iostream>
#include <fstream>
bool is_palindrome(const std::string s){
for(unsigned int i = 0; i < s.length()/2; i++){
if(s[i] != s[s.length()-i-1]){
return false;
}
}
return true;
#include <iostream>
#include <iomanip>
#include <fstream>
typedef unsigned short u16;
struct student {
std::string id;
u16 score1;
u16 score2;
@andraantariksa
andraantariksa / cp-cppsnippet.md
Created April 6, 2019 10:52
C++ Snippets for Competitive Programming

Main

#include <bits/stdc++.h>
#define MOD 1000000007	
using namespace std;
typedef short i16;
typedef unsigned short u16;
typedef int i32;
typedef unsigned int u32;
#include <iostream>
#include <vector>
struct Date {
short hour, minute, date, month, year;
};
struct Customer{
std::string name, address;
char gender;
#include <iostream>
int main(int argc, const char *argv[]){
unsigned int money, chocolate_t, chocolate, coupon;
std::cin >> money;
coupon = money;
chocolate = money;
while(coupon >= 7){
chocolate_t = coupon / 7;
chocolate += chocolate_t;