This file contains hidden or 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
| local function keyCode(key, modifiers) | |
| modifiers = modifiers or {} | |
| return function() | |
| hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), true):post() | |
| hs.timer.usleep(1000) | |
| hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), false):post() | |
| end | |
| end | |
| local function remapKey(modifiers, key, keyCode) |
This file contains hidden or 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
| public class Solution { | |
| public int countPrimes(int n) { | |
| int count = 0; | |
| boolean[] notPrime = new boolean[n]; | |
| for (int i = 2; i < n; i++) { | |
| if (!notPrime[i]) { | |
| count++; | |
| for (int j = 2; j * i < n; j++) { |
This file contains hidden or 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 DavisStaircase { | |
| public static void main(String[] args) { | |
| DavisStaircaseSolution.main(args); | |
| } | |
| } | |
| class DavisStaircaseSolution { | |
| static int[] dp; |
This file contains hidden or 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
| class PascalTriangle { | |
| int N; | |
| long[][] dp; | |
| PascalTriangle(int N) { | |
| this.N = N; | |
| this.dp = new long[N + 1][N + 1]; | |
| makeTriangle(); | |
| } |
This file contains hidden or 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; | |
| import java.util.Arrays; | |
| public class ABC057DDSolve { | |
| public static void main(String[] args) { | |
| ABC057DD solve = new ABC057DD(); | |
| solve.main(); | |
| } | |
| } |
This file contains hidden or 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 ABC057CC { | |
| public static void main(String[] args) { | |
| ABC057CCSolve solve = new ABC057CCSolve(); | |
| solve.main(); | |
| } | |
| } | |
| class ABC057CCSolve { | |
This file contains hidden or 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 sigmoid(x): | |
| return 1 / (1 + np.exp(-x)) | |
This file contains hidden or 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 step_function(x): | |
| if x > 0: | |
| return 1 | |
| else: | |
| return 0 | |
This file contains hidden or 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
| y = h(b + w1*x1 + w2*x2) //hという関数を定義して考える | |
| h(x) => 0 (x <= 0) | |
| h(x) => 1 (x > 0) |
This file contains hidden or 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 AND(x1, x2): | |
| x = np.array([x1, x2]) | |
| w = np.array([???, ???]) # 重みの設定 | |
| b = ??? # バイアスの設定 | |
| tmp = np.sum(w * x) + b | |
| if tmp <= 0: | |
| return 0 | |
| else: | |
| return 1 |
NewerOlder