A:3時と4時の間で、時計の長針と短針が一直線の位置にくる時刻
B:7時と8時の間で、6の目盛りをはさんで時計の長針と短針が左右対称の位置にくる時刻
[分]を角度の単位にして、x[分]に題意を満たすとすると、
(A) x=(15+x/12)+30
(B) 30-x=(35+x/12)-30
計算結果は、割り切れずに、□/11とか、□/13になることが多いようです。(^_^;
そこで、下記のプログラムでは、[分]を帯分数で表すように工夫してみました。
● ClockArith1.java
/* * ClockArith1.java * http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q12112425027 */ class ClockArith1 { static int gcd(int a, int b){ return( b == 0 ? a : gcd(b, a % b) ); } public static void main(String[] args) { final int M = 11*12*13; // Magic Number int iLng, iSht; System.out.print("(A)"); for(int t=0; t< 60*M; t++){ // 角度は[分]を単位にして、Mをかけておく iLng=12*t; iSht=t; int g=gcd(iLng,M); if(iLng==15*M+iSht+30*M) System.out.printf("%2d [時] %2d + %d / %d [分]\n", 3,iLng/M,(iLng%M)/g,M/g); } System.out.print("(B)"); for(int t=0; t< 60*M; t++){ iLng=12*t; iSht=t; int g=gcd(iLng,M); if(30*M-iLng==(35*M+iSht)-30*M) System.out.printf("%2d [時] %2d + %d / %d [分]\n", 7,iLng/M,(iLng%M)/g,M/g); } } }
●実行結果
(A) 3 [時] 49 + 1 / 11 [分] (B) 7 [時] 23 + 1 / 13 [分]
※参考URL
●速さと比(時計算その2)|受験算数アーカイブス
http://archives.jpn.org/arithmetic/hayasa/hayasa12.html