Skip to content

Instantly share code, notes, and snippets.

View mfrazi's full-sized avatar
😼
...

Fahrul Razi mfrazi

😼
...
View GitHub Profile
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){char t[100];scanf("%s",t);int l=strlen(t),x=l*3-3,y=l-1;for(int i=-y;i<=y;i++,printf("\n"))for(int j=x;j>=-x;j--){int m=abs(i+j),n=abs(i-j);printf("%c",(!m||m==(l-1)*3||!n||n==(l-1)*3||abs(i)==y&&(abs(j)>=l&&abs(j)<=(l-1)*2))?(abs(j)>=l*2-1?t[abs(m-n)/2]:t[abs(l-1-abs(j))]):' ');}return 0;}
/*
Input
programming
Output
#include<stdio.h>
#define print_diamonds for(int j=0; j<n+x; j++) printf(j<n-x-1?" ":"%d", j<n-1?x-(n-j)+2:n-j+x); printf("\n")
int main() {
int n; scanf("%d", &n);
for(int i=0, x=0; i<n; i++, x++){print_diamonds;}
for(int i=1, x=n-2; i<n; i++, x--){print_diamonds;}
return 0;
}
/*
{
"files.autoSave": "onFocusChange",
"editor.fontSize": 18,
"editor.wordWrap": "on",
"editor.lineHeight": 23,
"eslint.autoFixOnSave": true,
"workbench.colorTheme": "One Dark Pro",
"window.zoomLevel": 0,
@mfrazi
mfrazi / readsnk.py
Last active May 8, 2021 18:15
Download Shingeki no Kyojin from https://ww5.readsnk.com/
from bs4 import BeautifulSoup
import requests
import os
import shutil
# Taken from http://stackoverflow.com/questions/23793987/python-write-file-to-directory-doesnt-exist
# Taken from http://stackoverflow.com/a/600612/119527
def mkdir_p(path):
try:
# See the raw format
# Copy the square
# Paste it before your text in-game
OLIVE 
PINK 
RED 
ORANGE 
DARK YELLOW 
LIGH GREEN 
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
int data;
struct node *left;
struct node *right;
int height;
}node_avl;
@mfrazi
mfrazi / ex_tree.cpp
Created May 4, 2016 03:58
Expression Tree - Infix to Postfix
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node {
int data;
struct node *left,
*right,
*parent;
}node_t;
BEAUTIFUL_VIEW = 1;
PC_1 = [ 57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4 ];
#include <stdio.h>
// Cara 1 (Slow) (TLE)
void hitung1(int hari, int berat, int maks_hari, unsigned int *total){
//printf("%d %d %d\n", hari, maks_hari, *total);
if(hari>maks_hari)
return;
if(berat==1)
*total = *total + 1;
#include <stdio.h>
#include <string.h>
int main(){
char data[100];
scanf("%s", data);
int Q=0, W=0, E=0, i, awal=0;
for(i=0; i<strlen(data); i++){
//printf("%c %d %d %d %d\n", data[i], Q, W, E, awal);
if(data[i]=='R'){