Skip to content

Instantly share code, notes, and snippets.

View 3tomcha's full-sized avatar

Tomoya Hoshino 3tomcha

  • Minato-ku Tokyo
View GitHub Profile
@3tomcha
3tomcha / テスト.md
Created June 29, 2020 03:30
テスト
  • リスト 1
  • リスト 2
@3tomcha
3tomcha / gist:9698ccf711565057a75d77eb65ca1d16
Created February 4, 2020 01:33
includeした場合に元のファイルの内容がincludeされるスクリプト
<?php
$compile = "";
$compile .= file_get_contents("index.php");
if(preg_match("/include/", $compile)){
$compile = preg_replace_callback("/include.*\"(.*\.php)\"/",
function($matches){
return preg_replace("/^<\?php/", "", file_get_contents($matches[1]));
}, $compile);
}
<?php
if($_GET['status']=='create'){?>
<!DOCTYPE html>
<html>
<head>
<title>作成ページです</title>
</head>
<body>
<p>りんご</p>
@3tomcha
3tomcha / php04.php
Last active February 2, 2019 04:29
<?php
// 下記を関数にする
// $result = 0;
// for($i = 1; $i <= 5; $i++ ){
// $result += $i;
// }
// print $result.PHP_EOL;
// $result = 0;
// for($i = 1; $i <= 6; $i++ ){
@3tomcha
3tomcha / Main.php
Last active January 26, 2019 05:47
<?php
// Your code here!
$dinner = "hamburg";
// 何か
if ($dinner == 'hamburg') {
echo 'おいしそう!お肉は大好きです';
}
<?php
// Your code here!
// 1.引数に数値を指定して実行すると、数値を2倍にして返す関数を作成してください
function times2($num){
return $num * 2;
}
// echo times2(5).PHP_EOL;
// $a と $b を仮引数に持ち、 $a と $b を足した結果を返す関数を作成してください。
<?php
// $name にあなたの名前を代入し、 if文で $name があなたの名前だったら 「私は あなたの名前 です」、
// もし違ったら「あなたの名前ではありません」と表示するように実装してください。
$name = "Tomoya";
if($name == "Tomoya"){
echo "私は ".$name."です".PHP_EOL;
}else{
echo $name."ではありません".PHP_EOL;
}
<?php
//https://tech-boost.jp/common/books/125
// $a という変数に3を、$b という変数に7を代入して、echoを使って$a+$bの結果を表示してみましょう。
$a = 3;
$b = 7;
$result = $a + $b;
echo $result.PHP_EOL;
// $array_month という配列に1月〜12月の文字列を代入し、echoで8月を表示してみましょう。
# coding: utf-8
# Your code here!
import math
n = int(input())
xs = list(map(int,input().split()))
ys = list(map(int,input().split()))
ds = [abs(x-y) for(x,y) in zip(xs,ys)]