Skip to content

Instantly share code, notes, and snippets.

View alepar's full-sized avatar

Alexey Parfenov alepar

View GitHub Profile
/* The Computer Language Benchmarks Game
https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
Contributed by Michael Ganss, derived from
Regex-Redux by Josh Goldfoot
order variants by execution time by Anthony Lloyd
*/
using System;
using System.Threading.Tasks;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
class Solution {
public static class Range {
public final int start;
public final int end;
#include <Adafruit_NeoPixel.h>
#include "nerf_teensy.h"
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NEOPIXEL_COUNT, PIN_LED_NEOPIXEL, NEOPIXEL_MODE);
uint16_t curDispVal;
uint32_t lastUpdateMillis;
void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b) {
#define PIN_LED_STATUS 13
#define PIN_LED_NEOPIXEL 23
#define NEOPIXEL_COUNT 8
#define NEOPIXEL_MODE NEO_GRB+NEO_KHZ800
#define PIN_VOLTAGE_SENSOR A0
#define PIN_JUDGE_SENSOR 12
const uint8_t GAMMAS[] = {
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Regexp {
public static void main(String[] args) {
final String[] strings = new String[] {
"word 123 123 asd 123",
"word !@#asdj asd 123 123 asd 123",
"word asd -123 123 asd 123",
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Regexp {
public static void main(String[] args) {
final String[] strings = new String[] {
"word 123 123 asd 123",
"word !@#asdj asd 123 123 asd 123",
"word asd -123 123 asd 123",
1. Первый, твой, вариант - медленный
public static int sumOfDivisors(int c) {
int sum = 0;
for (int i = 1; i <= c - 1; i++) {
if (c % i == 0) {
sum = sum + i;
}
}
import java.util.*;
import java.lang.*;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{ for(int m=0;m<=100;m++);{
isSimple(m);
System.out.println(m);}