2020-01-01から1年間の記事一覧
A - Odds of Oddness https://atcoder.jp/contests/abc142/tasks/abc142_a かかった時間 3分 N=int(input()) K=0 for i in range(1,N+1): if i%2!=0: K+=1 print(K/N) B - Roller Coaster https://atcoder.jp/contests/abc142/tasks/abc142_b かかった時間 1…
A - Curtain https://atcoder.jp/contests/abc143/tasks/abc143_a かかった時間 2分30秒 A,B=map(int,input().split()) if A>B+B: print(A-(B+B)) else: print(0) B - TAKOYAKI FESTIVAL 2019 https://atcoder.jp/contests/abc143/tasks/abc143_b かかった時…
A - 9x9 https://atcoder.jp/contests/abc144/tasks/abc144_a かかった時間 2分 A,B=map(int,input().split()) if A>=10 or B>=10: print(-1) else: print(A*B) B - 81 https://atcoder.jp/contests/abc144/tasks/abc144_b かかった時間 2分 N=int(input()) …
A - Circle https://atcoder.jp/contests/abc145/tasks/abc145_a かかった時間 2分 r=int(input()) print(r*r) B - Echo https://atcoder.jp/contests/abc145/tasks/abc145_b かかった時間 2分30秒 N=int(input()) S=str(input()) if S[0:N//2]==S[N//2:]: p…
A - Can't Wait for Holiday https://atcoder.jp/contests/abc146/tasks/abc146_a かかった時間 3分 List=["SUN","MON","TUE","WED","THU","FRI","SAT"] S=str(input()) num=List.index(S) print(7-num) B - ROT N https://atcoder.jp/contests/abc146/tasks…
A - Blackjack https://atcoder.jp/contests/abc147/tasks/abc147_a かかった時間 6分 A = list(map(int, input().split())) if sum(A)>=22: print("bust") else: print("win") 基本的な文法エラーで大幅に時間が取られた。 B - Palindrome-philia https://a…
A - Round One https://atcoder.jp/contests/abc148/tasks/abc148_a かかった時間 3分 m=[1,2,3] for i in range(2): line=int(input()) m.remove(line) print(m[0]) B - Strings with the Same Length https://atcoder.jp/contests/abc148/tasks/abc148_b …
A - Strings https://atcoder.jp/contests/abc149/tasks/abc149_a S,T=map(str,input().split()) print(T+S) B - Greedy Takahashi https://atcoder.jp/contests/abc149/tasks/abc149_b A,B,K=map(int,input().split()) A,B,K=map(int,input().split()) if A…
A - 500 Yen Coins https://atcoder.jp/contests/abc150/tasks/abc150_a K,X=map(int,input().split()) if K*500>=X: print("Yes") else: print("No") B - Count ABC https://atcoder.jp/contests/abc150/tasks/abc150_b N=int(input()) S=str(input()) prin…
A - Next Alphabet https://atcoder.jp/contests/abc151/tasks/abc151_a C=str(input()) num=ord(C) print(chr(num+1)) chr,ordの使い方は以下の記事を参考に https://note.nkmk.me/python-chr-ord-unicode-code-point/ B - Achieve the Goal https://atcode…
A - AC or WA https://atcoder.jp/contests/abc152/tasks/abc152_a N,M=map(int,input().split()) if N==M: print("Yes") else: print("No") B - Comparing Strings https://atcoder.jp/contests/abc152/tasks/abc152_b a,b=map(int,input().split()) list=[…
A - Serval vs Monster https://atcoder.jp/contests/abc153/tasks/abc153_a H,A=map(int,input().split()) ans=0 while H>0: H-=A ans+=1 print(ans) B - Common Raccoon vs Monster https://atcoder.jp/contests/abc153/tasks/abc153_b H,N=map(int,input(…
A - Remaining Balls https://atcoder.jp/contests/abc154/tasks/abc154_a S,T=map(str,input().split()) A,B=map(int,input().split()) U=str(input()) if U=="red": A-=1 else: B-=1 print(A,B) B - I miss you... https://atcoder.jp/contests/abc154/tas…
A - Poor https://atcoder.jp/contests/abc155/tasks/abc155_a A,B,C=map(int,input().split()) if A==B==C: print("No") elif A==B or B==C or A==C: print("Yes") else: print("No") B - Papers, Please https://atcoder.jp/contests/abc155/tasks/abc155_…
A - Beginner https://atcoder.jp/contests/abc156/tasks/abc156_a N,R=map(int,input().split()) if N>=10: print(R) else: num=100*(10-N) print(num+R) C - Rally https://atcoder.jp/contests/abc156/tasks/abc156_c N=int(input()) X=list(map(int,inpu…
A - Duplex Printing https://atcoder.jp/contests/abc157/tasks/abc157_a N=int(input()) if N%2==0: print(N%2) else: print(N//2+1) 割り切れるならそそまま出力、あまりが出るなら切り捨てて1を足せば答えになります B - Bingo https://atcoder.jp/conte…
公式サイト https://react-hook-form.com/jp/完成したフォーム コピペOKです。 今回はrect-hooks-formとmaterial-ulを使っています インストールコマンド npm install react-hook-form npm install @material-ui/core npm install @material-ui/icons npm in…
Reactの状態管理ライブラリのRecoilを使っている時にバグに遭遇したので記録として、同じ状況の人がいたら参考にしていただけたら幸いです。バグの内容はRecoilをHMR環境で使うと Duplicate atom key "UserStatus". This is a FATAL ERROR in production. Bu…
最近Next.jsを使い始めたので、簡単なページネーションをしてみました。 今回はSSGをしています。 とりあえず、チュートリアルの通りにVercelでデプロイしてみました。 完成した物 https://next-pagination.vercel.app/ codesanboxにコードをあげようかと思…
練習代わりにTwitter風にルーティングをしてみました。 思ったよりコンポーネントの数が多く、その分名前を決めるのも大変で、所々変な所もありますが、ひとまず完成です。なぜか、bodyのmarginが消えなかったので、デベロッパーツールで各自消してください。
使うファイル index.js App.js Item.js公式サイト https://react-dnd.github.io/react-dnd/about参考動画 https://www.youtube.com/watch?v=aK2PD_REk7A&list=PLmiHocWADqPGYeEqgwl5w9BKCi5ju3_Xj&index=10&t=1s まずはインストールから npm install react-d…
最近、HTML5から追加されたレンジ入力というものを発見したので簡単に使い方をまとめておきます。 <input type="range" min ="10"max="50" step="1"> inputのタイプをrangeに変更するだけです。 基本のプロパティはmin,max,stepの3つ覚えておけば大丈夫です。min :最低値 max :最大値 step :刻むステップ値…
使うファイル index.tsx App.tsx TreeView.tsx index.tsx App.tsx TreeView.tsx index.tsx import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>…
実行環境 パーケッジ名 バージョン Laravel 7.15.0 React 16.2.0 GraphQL 15.1.0 nuwave/lighthouse 4.14 graphql-tag 2.10.3 react-apollo 3.1.5 apollo-boost 0.4.9 react-router-dom 5.2.0 本当は@apollo/react-hooksを使ってhookをやりたかったのですがR…
Recoilが新しくでたので、使ってみました。まず、フォルダ構成は以下の通り Recoilのフォルダ構成は上記のようにatomのフォルダを作ってその中に書いていた記事が多かったので、それと同じようにしました。create-react-appを使ってTypeScriptを導入する場合…
useEffectを使う時にちょっとわからなかった事があったので、そのメモ用です。 まず、前提としてuseEffectはコンポーネントのレンダリングが終わってから実行されます。 そして、第2引数で実行タイミングを決めます この時の私はこのことも知らなかったです…
まず下記記事を参考に、Gitをインストールして名前とメールアドレスを設定しておいてください。 https://eng-entrance.com/git-install 次に、GitHubでリポジトリを作っておきます。次に公開したいプロジェクトの中でgh-pgaseをインストールします。 npm ins…
今回はLaravel+ReactでLaravelでバリデーションを行い、そのエラーメッセージをReactで表示してみたいと思います。とりあえず、分かりやすいようにReact側では新規登録の画面を作っていきます。 import React from 'react'; import ReactDOM from 'react-dom…
まずプロジェクトを作ります composer create-project --prefer-dist laravel/laravel SampleProject次にLaravelでReactを利用できるようにします。 composer require laravel/ui php artisan ui react認証機能を使う場合は php artisan ui react --auth最後…
Laravelで多対多のリレーションがややこしかったので、ここにまとめて起きます。今回は学生テーブルと科目テーブルで多対多のリレーションをしていきます。外部キーを使う場合と使わない場合の2種類でやっていきます。 php artisan make:model Student --mig…