(xy % z) = ((x % z) * (y % z)) % z
k = 2tの場合 a^k = a^t * a^t
p(a, k, m) = (p(a, k/2, m) * p(a, k/2, m)) % m
k = 2t + 1の場合
(xy % z) = ((x % z) * (y % z)) % z
k = 2tの場合 a^k = a^t * a^t
p(a, k, m) = (p(a, k/2, m) * p(a, k/2, m)) % m
k = 2t + 1の場合
vはleft以上、right未満の範囲に存在する
va[left] <= v < va[right]
function contaions(int v, int[] va) {
if (va.length == 0) {
return false;
}
int left = 0, int right = va.length;
| // http://jsfiddle.net/L6bfa | |
| var TreeNode = function (value, left, right) { | |
| this.value = value; | |
| this.left = left; | |
| this.right = right; | |
| }; | |
| var Tree = function (root) { | |
| this.root = root; |
| // http://play.golang.org/p/dB_zEZf_Rz | |
| package main | |
| import "fmt" | |
| type TreeNode struct { | |
| value int | |
| left *TreeNode | |
| right *TreeNode |
| public interface A { | |
| default int hoge() { | |
| return 100; | |
| } | |
| } |
| import javax.tools.*; | |
| import javax.tools.JavaCompiler.CompilationTask; | |
| import java.io.IOException; | |
| import java.lang.reflect.InvocationTargetException; | |
| import java.lang.reflect.Method; | |
| import java.net.URI; | |
| import java.security.SecureClassLoader; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import java.util.Locale; |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <beans xmlns="http://www.springframework.org/schema/beans" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | |
| <bean class="org.mockito.Mockito" factory-method="mock"> | |
| <constructor-arg value="com.example.repository.SomeRepository" /> | |
| </bean> | |
| <bean class="com.example.service.SomeService"/> |
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>com.example</groupId> | |
| <artifactId>jggug-helloworld</artifactId> | |
| <packaging>jar</packaging> | |
| <version>1.0.0-SNAPSHOT</version> | |
| <name>jggug-helloworld</name> | |
| <!-- ここから --> | |
| <parent> |
| package com.example; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RestController; | |
| @RestController | |
| @EnableAutoConfiguration | |
| public class App { |
| mvn spring-boot:run -Drun.arguments="--server.port=8888" |