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 <iostream> | |
#include <cstdio> | |
#include <cmath> | |
#include <ctime> | |
#include <vector> | |
#include <algorithm> | |
#include <array> | |
float getVal() { |
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 <iostream> | |
#include <thread> | |
int main() | |
{ | |
for (int i = 0; i < 1000; ++i) { | |
int a = 5; | |
int b = 5; | |
int sum = 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
#include <iostream> | |
#include <vector> | |
#include <limits> | |
#include <assert.h> | |
size_t solution(const std::vector<double>& data) { | |
std::vector<double> avgs(data.size(), 0); | |
size_t l = data.size(); | |
avgs[l - 1] = data[l - 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
function calcNearest() { | |
// build queue | |
var nodeList = _toNodeList(distTable); | |
var queue = _.sortBy(nodeList, 'value'); | |
// build path | |
var path = []; | |
var l = 0; | |
var idToFind = null; |
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
results = [{ | |
method: 'Метод "Иди в ближний"', | |
values: [{ | |
path: '1-2-3-4-5-1', | |
l: 10 | |
}, { | |
path: '1-3-2-4-5-1', | |
l: 20 | |
}] | |
}, { |
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.example.igor.test; | |
import android.content.Context; | |
import android.graphics.Color; | |
import android.util.AttributeSet; | |
import android.view.GestureDetector; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.view.ViewConfiguration; | |
import android.view.ViewGroup; |
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
using Generation = std::vector<Genome>; | |
constexpr int buildingSize = 100; | |
Genome createGenome() { | |
Genome genome; | |
int currentFloor = 0; | |
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
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
) | |
const ( | |
CONN_HOST = "localhost" |
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 <exception> | |
#include <stdexcept> | |
#include <string> | |
class NotImplementedException : public std::runtime_error { | |
public: | |
NotImplementedException(const std::string& str) | |
: std::runtime_error(str) { | |
} |
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 random | |
def sample(p): | |
x, y = random.random(), random.random() | |
return 1 if x*x + y*y < 1 else 0 | |
def run(sc, num_samples): | |
count = sc.parallelize(xrange(0, num_samples)).map(sample) \ | |
.reduce(lambda a, b: a + b) | |
print "Pi is roughly %f" % (4.0 * count / num_samples) |
OlderNewer