This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program numbers; | |
uses sysutils, math; | |
procedure delay(n : integer); | |
var | |
i, j : integer; | |
begin | |
for i := 1 to n do | |
for j := 1 to n do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <time.h> | |
#include <math.h> | |
#include <ncurses.h> | |
#include <unistd.h> | |
#include <string.h> | |
#define N 100 | |
int usleep(unsigned usec); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program temp | |
implicit none | |
integer, parameter :: NX = 3, NY = 3 | |
integer :: i, j, oiter, numiter = 100 | |
real, dimension(0:nx+1, 0:ny+1) :: t | |
t = 0.0 | |
t(:,0) = 100. | |
t(0,:) = 100. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class ChocoDist { | |
private static int distributeOneChocolate(int x, int y) { | |
int count = 0; | |
if (x == y) return 1; | |
while (x > 0 && y > 0) { | |
// The minimum of width (x) and height (y) is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.solutions; | |
import java.util.Scanner; | |
public class BrideGroom { | |
private static void rotate(char[] arr, int atIndex) { | |
char head = arr[atIndex]; | |
for (int i = atIndex + 1; i < arr.length; i++) { | |
arr[i - 1] = arr[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Scanner; | |
public class Bitscore { | |
private static String calculateScore(int number) { | |
String n = number + ""; | |
char[] digits = n.toCharArray(); | |
if (digits.length < 2) return ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_score(n): | |
s = sorted([x for x in str(n)]) | |
if len(s) >= 2: | |
maxn = int(s[-1]) | |
minn = int(s[0]) | |
score = str(maxn * 11 + minn * 7) | |
if len(score) >= 2: | |
return score[len(score) - 2:] | |
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def match(brides, grooms, n=0): | |
if len(brides) == 0: | |
return 0 | |
if n == len(grooms) + 1: | |
return len(grooms) | |
if brides[0] == grooms[0]: | |
return match(brides[1:], grooms[1:]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dist_one(x, y): | |
count = 0 | |
if x == y: | |
return 1 | |
while x > 0 and y > 0: | |
cut = min(x, y) | |
count = count + 1 | |
if x > cut: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> | |
int value(char c) | |
{ | |
switch (c) { | |
case 'A': |