Skip to content

Instantly share code, notes, and snippets.

View yuikns's full-sized avatar

Yu yuikns

  • 09:22 (UTC +08:00)
View GitHub Profile
pub struct DataSet<X, Y> {
d: Vec<(Vec<X>, Y)>
}
impl DataSet {
pub fn new<X, Y>() -> DataSet<X, Y> {
DataSet { d: Vec::<(Vec<X>, Y)>::new() }
}
}
@yuikns
yuikns / CMakeLists.txt
Created May 27, 2016 04:02 — forked from eruffaldi/CMakeLists.txt
A tiny example of CUDA + OpenGL interop with write-only surfaces and CUDA kernels. Uses GLFW+GLAD.
#sudo pip install --upgrade git+https://github.com/dav1dde/glad.git#egg=glad
#python main.py --api gl=3.3 --generator=c --out-path=GL
find_package(CUDA)
find_package(GLFW)
include_directories(${GLFW_INCLUDE_DIRS})
include_directories(GL/include)
cuda_add_executable(main main.c assert_cuda.c interop.c GL/src/glad.c kernel.cu)
target_link_libraries(main ${GLFW_LIBRARY})
// Copyright 2014 Yu Jing<[email protected]>
#include <cstdio>
#include <syslog.h> // syslog
#include <vector>
#include <string>
#include <map>
#include <set>
const size_t K_TH_FIND_LENGTH_THRESHOLD = 5;
template <typename T>
bool k_th_find_default_comparator(T l, T r) {
return l < r;
}
template <typename T>
void k_th_find_partition(std::vector<T> *_v, T e, //
import scala.collection.mutable.{ Map => MMap }
object Solution {
case class PrefixTrieNode(next: MMap[Char, PrefixTrieNode]) {
var v: Boolean = false
}
class PrefixTrieTree {
val root: PrefixTrieNode = PrefixTrieNode(MMap[Char, PrefixTrieNode]())
/**********************************************************************
Author: Sherlock
Created Time: 2008-10-28 16:24:47
File Name:
Description:
**********************************************************************/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
import scala.collection.mutable.{ Map => MMap }
object Solution {
case class PrefixTrieNode(
base: Char, // current node
next: MMap[Char, PrefixTrieNode]) {
var v: Boolean = false
}
class PrefixTrieTree {
package org.aminer.io.utils
import scala.util.Try
import com.google.common.cache.CacheBuilder
import com.google.common.cache.CacheLoader
import com.google.common.cache.LoadingCache
//import com.google.common.cache.CacheBuilder
//import com.google.common.cache.CacheLoader
object Solution {
def main(args: Array[String]): Unit = {
val n = Console.in.readLine().toInt
val sl = (1 to n).map(i => (Console.in.readLine(),i))
//io.Source.stdin.getLines().take(1).map(_.toInt)
println(math.abs(sl.par.foldLeft(0){(l,e) =>
val i = e._2 - 1
val arr = e._1.split(" ")
l + arr(i).toInt - arr(n - i - 1).toInt
<?xml version="1.0" encoding="UTF-8"?>
<rexster>
<http>
<server-port>8182</server-port>
<server-host>0.0.0.0</server-host>
<base-uri>http://127.0.0.1</base-uri>
<web-root>public</web-root>
<character-set>UTF-8</character-set>
<enable-jmx>false</enable-jmx>
<enable-doghouse>true</enable-doghouse>