Java初心者の競技プログラミング日記

Dvorak配列でjavaを書いてます

2018-02-24から1日間の記事一覧

Javaで使える数学系メソッドまとめ

//最大公約数・最小公倍数(セットで使う) static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;} static int lcm (int a, int b) {return a*b/gcd(a,b);} //素数判定 static boolean isPrime (int n) { if (n==2) return true; if (n<2 || n%2==0) re…

yukicoder No.652 E869120 and TimeZone

A問題に引き続いて時刻の問題。 import java.util.*; import static java.lang.System.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int h = sc.nextInt(); int m = sc.nextInt(); String…

yukicoder No.651 E869120 and Driving

はじめてyukicoderコンテストに出場しました。結果はABC完答、DE放棄。 時速100kmでakm移動したときにかかる時間は。a/100時間。小数の問題があるのと、どちらにせよこのあと現在時刻にかかった時間を足して計算しなければならないので、分に直す。 目的地に…